Skip to content

Commit 94474f8

Browse files
committed
librustc: Fix silly bug in AST conversion for const vstores. rs=bugfix
Means that we'll need another snapshot to rid the language of `[const T]`.
1 parent 1fef182 commit 94474f8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/librustc/middle/typeck/astconv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ pub fn ast_ty_to_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
218218
let mut mt = ast_mt_to_mt(self, rscope, mt);
219219
if a_seq_ty.mutbl == ast::m_mutbl ||
220220
a_seq_ty.mutbl == ast::m_const {
221-
mt = ty::mt { ty: mt.ty, mutbl: ast::m_mutbl };
221+
mt = ty::mt { ty: mt.ty, mutbl: a_seq_ty.mutbl };
222222
}
223223
return ty::mk_evec(tcx, mt, vst);
224224
}

src/test/run-pass/const-vec-syntax.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn f(_: &const [int]) {}
2+
3+
fn main() {
4+
let v = [ 1, 2, 3 ];
5+
f(v);
6+
}
7+

0 commit comments

Comments
 (0)