Skip to content

Commit 1d6fb24

Browse files
committed
Hack to make [] and []/~ the same type in preparation for switching to []/~.
1 parent 275c1e4 commit 1d6fb24

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

src/rustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ fn mk_nil_ptr(cx: ctxt) -> t {
684684
mk_ptr(cx, {ty: mk_nil(cx), mutbl: ast::m_imm})
685685
}
686686

687-
fn mk_vec(cx: ctxt, tm: mt) -> t { mk_t(cx, ty_vec(tm)) }
687+
fn mk_vec(cx: ctxt, tm: mt) -> t { mk_evec(cx, tm, vstore_uniq) }
688688

689689
fn mk_evec(cx: ctxt, tm: mt, t: vstore) -> t {
690690
mk_t(cx, ty_evec(tm, t))

src/rustc/middle/typeck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ fn require_same_types(
218218

219219
fn arg_is_argv_ty(_tcx: ty::ctxt, a: ty::arg) -> bool {
220220
alt ty::get(a.ty).struct {
221-
ty::ty_vec(mt) {
221+
ty::ty_evec(mt, vstore_uniq) {
222222
if mt.mutbl != ast::m_imm { ret false; }
223223
alt ty::get(mt.ty).struct {
224224
ty::ty_str { ret true; }

src/rustc/middle/typeck/astconv.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy>(
170170
ret ty::mk_evec(tcx, mt, vst);
171171
}
172172

173+
// HACK: if we get a []/~, we assume that it was actually a
174+
// [] that got written down, and we throw away the /~...
175+
ty::ty_evec(mt, vstore_uniq) {
176+
ret ty::mk_evec(tcx, mt, vst);
177+
}
178+
173179
ty::ty_str {
174180
ret ty::mk_estr(tcx, vst);
175181
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// error-pattern:expected `str` but found `[int]`
1+
// error-pattern:expected `str` but found `[int]/~`
22
fn main() { fail [0i]; }

0 commit comments

Comments
 (0)