Skip to content

Commit c407549

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 6d4ed52 commit c407549

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/librustc/middle/typeck/astconv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
214214
let mut mt = ast_mt_to_mt(self, rscope, mt);
215215
if a_seq_ty.mutbl == ast::m_mutbl ||
216216
a_seq_ty.mutbl == ast::m_const {
217-
mt = ty::mt { ty: mt.ty, mutbl: ast::m_mutbl };
217+
mt = ty::mt { ty: mt.ty, mutbl: a_seq_ty.mutbl };
218218
}
219219
return ty::mk_evec(tcx, mt, vst);
220220
}

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

+7
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)