Now actually allow using constants in those constant expressions for [T * n].

This commit is contained in:
Luqman Aden 2013-03-05 17:43:37 -08:00
parent 42f95d055c
commit 787f5bb0db
3 changed files with 12 additions and 4 deletions

View File

@ -498,7 +498,12 @@ fn check_item(i: @ast::item, cx: ty::ctxt) {
// not traverse into subitems, since that is handled by the outer
// lint visitor.
fn item_stopping_visitor<E>(v: visit::vt<E>) -> visit::vt<E> {
visit::mk_vt(@visit::Visitor {visit_item: |_i, _e, _v| { },.. **v})
visit::mk_vt(@visit::Visitor {visit_item: |_i, _e, _v| { },
.. **(ty_stopping_visitor(v))})
}
fn ty_stopping_visitor<E>(v: visit::vt<E>) -> visit::vt<E> {
visit::mk_vt(@visit::Visitor {visit_ty: |_t, _e, _v| { },.. **v})
}
fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {

View File

@ -622,10 +622,10 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
}
ty_tup(ref tys) => ty_tup(tys.map(|ty| fld.fold_ty(*ty))),
ty_path(path, id) => ty_path(fld.fold_path(path), fld.new_id(id)),
ty_fixed_length_vec(ref mt, vs) => {
ty_fixed_length_vec(ref mt, e) => {
ty_fixed_length_vec(
fold_mt(mt, fld),
vs
fld.fold_expr(e)
)
}
ty_mac(ref mac) => ty_mac(fold_mac(*mac))

View File

@ -246,7 +246,10 @@ pub fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
(v.visit_ty)(f.decl.output, e, v);
},
ty_path(p, _) => visit_path(p, e, v),
ty_fixed_length_vec(ref mt, _) => (v.visit_ty)(mt.ty, e, v),
ty_fixed_length_vec(ref mt, ex) => {
(v.visit_ty)(mt.ty, e, v);
(v.visit_expr)(ex, e, v);
},
ty_nil | ty_bot | ty_mac(_) | ty_infer => ()
}
}