Skip to content

Commit 787f5bb

Browse files
committed
Now actually allow using constants in those constant expressions for [T * n].
1 parent 42f95d0 commit 787f5bb

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/librustc/middle/lint.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,12 @@ fn check_item(i: @ast::item, cx: ty::ctxt) {
498498
// not traverse into subitems, since that is handled by the outer
499499
// lint visitor.
500500
fn item_stopping_visitor<E>(v: visit::vt<E>) -> visit::vt<E> {
501-
visit::mk_vt(@visit::Visitor {visit_item: |_i, _e, _v| { },.. **v})
501+
visit::mk_vt(@visit::Visitor {visit_item: |_i, _e, _v| { },
502+
.. **(ty_stopping_visitor(v))})
503+
}
504+
505+
fn ty_stopping_visitor<E>(v: visit::vt<E>) -> visit::vt<E> {
506+
visit::mk_vt(@visit::Visitor {visit_ty: |_t, _e, _v| { },.. **v})
502507
}
503508

504509
fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {

src/libsyntax/fold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,10 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
622622
}
623623
ty_tup(ref tys) => ty_tup(tys.map(|ty| fld.fold_ty(*ty))),
624624
ty_path(path, id) => ty_path(fld.fold_path(path), fld.new_id(id)),
625-
ty_fixed_length_vec(ref mt, vs) => {
625+
ty_fixed_length_vec(ref mt, e) => {
626626
ty_fixed_length_vec(
627627
fold_mt(mt, fld),
628-
vs
628+
fld.fold_expr(e)
629629
)
630630
}
631631
ty_mac(ref mac) => ty_mac(fold_mac(*mac))

src/libsyntax/visit.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ pub fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
246246
(v.visit_ty)(f.decl.output, e, v);
247247
},
248248
ty_path(p, _) => visit_path(p, e, v),
249-
ty_fixed_length_vec(ref mt, _) => (v.visit_ty)(mt.ty, e, v),
249+
ty_fixed_length_vec(ref mt, ex) => {
250+
(v.visit_ty)(mt.ty, e, v);
251+
(v.visit_expr)(ex, e, v);
252+
},
250253
ty_nil | ty_bot | ty_mac(_) | ty_infer => ()
251254
}
252255
}

0 commit comments

Comments
 (0)