From 7b265035661daefd7d30f05896a748e55bb561b0 Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Wed, 11 Jul 2012 19:31:15 -0700 Subject: [PATCH] Make str be treated as str/~. --- src/rustc/middle/ty.rs | 2 +- src/rustc/middle/typeck.rs | 2 +- src/test/compile-fail/bad-const-type.rs | 2 +- src/test/compile-fail/binop-bitxor-str.rs | 2 +- src/test/compile-fail/fail-type-err.rs | 2 +- src/test/compile-fail/map-types.rs | 2 +- src/test/compile-fail/minus-string.rs | 2 +- src/test/compile-fail/missing-do.rs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index f4febfa05120..f24c382eb9e3 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -652,7 +652,7 @@ fn mk_mach_float(cx: ctxt, tm: ast::float_ty) -> t { mk_t(cx, ty_float(tm)) } fn mk_char(cx: ctxt) -> t { mk_t(cx, ty_int(ast::ty_char)) } -fn mk_str(cx: ctxt) -> t { mk_t(cx, ty_str) } +fn mk_str(cx: ctxt) -> t { mk_estr(cx, vstore_uniq) } fn mk_estr(cx: ctxt, t: vstore) -> t { mk_t(cx, ty_estr(t)) diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index 1e198f0f82e2..4f74da96b77c 100644 --- a/src/rustc/middle/typeck.rs +++ b/src/rustc/middle/typeck.rs @@ -223,7 +223,7 @@ fn arg_is_argv_ty(_tcx: ty::ctxt, a: ty::arg) -> bool { ty::ty_evec(mt, vstore_uniq) { if mt.mutbl != ast::m_imm { ret false; } alt ty::get(mt.ty).struct { - ty::ty_str { ret true; } + ty::ty_estr(vstore_uniq) { ret true; } _ { ret false; } } } diff --git a/src/test/compile-fail/bad-const-type.rs b/src/test/compile-fail/bad-const-type.rs index f5f788a2458a..8b86db098e51 100644 --- a/src/test/compile-fail/bad-const-type.rs +++ b/src/test/compile-fail/bad-const-type.rs @@ -1,4 +1,4 @@ -// error-pattern:expected `str` but found `int` +// error-pattern:expected `str/~` but found `int` const i: str = 10i; fn main() { log(debug, i); } diff --git a/src/test/compile-fail/binop-bitxor-str.rs b/src/test/compile-fail/binop-bitxor-str.rs index 65e0996fa627..53bb7d8f53d9 100644 --- a/src/test/compile-fail/binop-bitxor-str.rs +++ b/src/test/compile-fail/binop-bitxor-str.rs @@ -1,3 +1,3 @@ -// error-pattern:^ cannot be applied to type `str` +// error-pattern:^ cannot be applied to type `str/~` fn main() { let x = "a" ^ "b"; } diff --git a/src/test/compile-fail/fail-type-err.rs b/src/test/compile-fail/fail-type-err.rs index eb44ccf413c0..3f9bda61c80e 100644 --- a/src/test/compile-fail/fail-type-err.rs +++ b/src/test/compile-fail/fail-type-err.rs @@ -1,2 +1,2 @@ -// error-pattern:expected `str` but found `~[int]` +// error-pattern:expected `str/~` but found `~[int]` fn main() { fail ~[0i]; } diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index 084cbf9529c0..9386c1526484 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -8,5 +8,5 @@ import std::map::map; fn main() { let x: map = map::str_hash::() as map::; let y: map = x; - //~^ ERROR mismatched types: expected `std::map::map` + //~^ ERROR mismatched types: expected `std::map::map` } diff --git a/src/test/compile-fail/minus-string.rs b/src/test/compile-fail/minus-string.rs index 27ed51852a4d..043d46f121b5 100644 --- a/src/test/compile-fail/minus-string.rs +++ b/src/test/compile-fail/minus-string.rs @@ -1,3 +1,3 @@ -// error-pattern:cannot apply unary operator `-` to type `str` +// error-pattern:cannot apply unary operator `-` to type `str/~` fn main() { -"foo"; } diff --git a/src/test/compile-fail/missing-do.rs b/src/test/compile-fail/missing-do.rs index 23905d14ffa0..31595875058e 100644 --- a/src/test/compile-fail/missing-do.rs +++ b/src/test/compile-fail/missing-do.rs @@ -3,7 +3,7 @@ fn foo(f: fn()) { f() } fn main() { - "" || 42; //~ ERROR binary operation || cannot be applied to type `str` + "" || 42; //~ ERROR binary operation || cannot be applied to type `str/~` foo || {}; //~ ERROR binary operation || cannot be applied to type `extern fn(fn())` //~^ NOTE did you forget the 'do' keyword for the call? }