diff options
| author | Luqman Aden <me@luqman.ca> | 2013-03-05 17:43:37 -0800 |
|---|---|---|
| committer | Luqman Aden <me@luqman.ca> | 2013-03-18 17:31:41 -0700 |
| commit | 787f5bb0dbbbd50f59848f6703bd89438e60053f (patch) | |
| tree | 6cf9b62600ac6b7d5fcd9aea43ad6cf8f8b68415 | |
| parent | 42f95d055c2f22078f5c94c0d0ca229e1561ccb8 (diff) | |
| download | rust-787f5bb0dbbbd50f59848f6703bd89438e60053f.tar.gz rust-787f5bb0dbbbd50f59848f6703bd89438e60053f.zip | |
Now actually allow using constants in those constant expressions for [T * n].
| -rw-r--r-- | src/librustc/middle/lint.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index f2e736ac86d..ccd7e35f817 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -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) { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index a8952f313a5..159b23f4f99 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -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)) diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 6a0f1a2ec46..a159c98d21b 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -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 => () } } |
