From 6822ec3eb4cb39a3a075b8373fcc974424ef63e8 Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Sat, 14 Jul 2012 13:55:41 -0700 Subject: Treat bare vector and string literals as fixed length vecs. Closes #2922. --- src/test/compile-fail/alt-range-fail.rs | 4 ++-- src/test/compile-fail/binop-bitxor-str.rs | 2 +- src/test/compile-fail/issue-2063.rs | 2 +- src/test/compile-fail/minus-string.rs | 2 +- src/test/compile-fail/missing-do.rs | 2 +- src/test/compile-fail/mutable-huh-variance-vec1.rs | 2 +- src/test/compile-fail/mutable-huh-variance-vec2.rs | 2 +- src/test/compile-fail/mutable-huh-variance-vec4.rs | 6 +++--- src/test/compile-fail/non-exhaustive-match-nested.rs | 4 ++-- src/test/compile-fail/unsendable-class.rs | 4 ++-- src/test/run-pass/macro-by-example-2.rs | 6 ++---- 11 files changed, 17 insertions(+), 19 deletions(-) (limited to 'src/test') diff --git a/src/test/compile-fail/alt-range-fail.rs b/src/test/compile-fail/alt-range-fail.rs index 0a9acdcd4b9..b9c1c6f0a1e 100644 --- a/src/test/compile-fail/alt-range-fail.rs +++ b/src/test/compile-fail/alt-range-fail.rs @@ -9,11 +9,11 @@ fn main() { }; alt "wow" { - "wow" to "woow" { } + "bar" to "foo" { } }; alt 5u { 'c' to 100u { } _ { } }; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/binop-bitxor-str.rs b/src/test/compile-fail/binop-bitxor-str.rs index b698eb7c426..29dd7dd0a21 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` -fn main() { let x = "a" ^ "b"; } +fn main() { let x = ~"a" ^ ~"b"; } diff --git a/src/test/compile-fail/issue-2063.rs b/src/test/compile-fail/issue-2063.rs index 1fbc6691c74..13f857a5a13 100644 --- a/src/test/compile-fail/issue-2063.rs +++ b/src/test/compile-fail/issue-2063.rs @@ -7,7 +7,7 @@ enum t = @t; //~ ERROR this type cannot be instantiated // the compiler to attempt autoderef and then // try to resolve the method. impl methods for t { - fn to_str() -> ~str { "t" } + fn to_str() -> ~str { ~"t" } } fn new_t(x: t) { diff --git a/src/test/compile-fail/minus-string.rs b/src/test/compile-fail/minus-string.rs index 00037ce0fda..eea621c5189 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` -fn main() { -"foo"; } +fn main() { -~"foo"; } diff --git a/src/test/compile-fail/missing-do.rs b/src/test/compile-fail/missing-do.rs index a54c5961d55..9ea339641b3 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? } diff --git a/src/test/compile-fail/mutable-huh-variance-vec1.rs b/src/test/compile-fail/mutable-huh-variance-vec1.rs index 18ca917e8b6..02fcc3bf8c5 100644 --- a/src/test/compile-fail/mutable-huh-variance-vec1.rs +++ b/src/test/compile-fail/mutable-huh-variance-vec1.rs @@ -5,7 +5,7 @@ fn main() { let v: ~[mut ~[int]] = ~[mut ~[0]]; fn f(&&v: ~[mut ~[const int]]) { - v[0] = [mut 3] + v[0] = ~[mut 3] } f(v); //~ ERROR (values differ in mutability) diff --git a/src/test/compile-fail/mutable-huh-variance-vec2.rs b/src/test/compile-fail/mutable-huh-variance-vec2.rs index 0135c08c128..74b9b5daf3e 100644 --- a/src/test/compile-fail/mutable-huh-variance-vec2.rs +++ b/src/test/compile-fail/mutable-huh-variance-vec2.rs @@ -5,7 +5,7 @@ fn main() { let v: ~[mut ~[mut int]] = ~[mut ~[mut 0]]; fn f(&&v: ~[mut ~[const int]]) { - v[0] = [3] + v[0] = ~[3] } f(v); //~ ERROR (values differ in mutability) diff --git a/src/test/compile-fail/mutable-huh-variance-vec4.rs b/src/test/compile-fail/mutable-huh-variance-vec4.rs index f234bc677c4..b7bf33570ba 100644 --- a/src/test/compile-fail/mutable-huh-variance-vec4.rs +++ b/src/test/compile-fail/mutable-huh-variance-vec4.rs @@ -8,18 +8,18 @@ fn main() { let x = ~[mut ~[mut 0]]; fn f(&&v: ~[mut ~[int]]) { - v[0] = [3] + v[0] = ~[3] } fn g(&&v: ~[const ~[const int]]) { } fn h(&&v: ~[mut ~[mut int]]) { - v[0] = [mut 3] + v[0] = ~[mut 3] } fn i(&&v: ~[mut ~[const int]]) { - v[0] = [mut 3] + v[0] = ~[mut 3] } fn j(&&v: ~[~[const int]]) { diff --git a/src/test/compile-fail/non-exhaustive-match-nested.rs b/src/test/compile-fail/non-exhaustive-match-nested.rs index a4efbb5684c..37490724a23 100644 --- a/src/test/compile-fail/non-exhaustive-match-nested.rs +++ b/src/test/compile-fail/non-exhaustive-match-nested.rs @@ -6,8 +6,8 @@ enum u { c, d } fn main() { let x = a(c); alt x { - a(d) { fail "hello"; } - b { fail "goodbye"; } + a(d) { fail ~"hello"; } + b { fail ~"goodbye"; } } } diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index 35b81cdecb1..bd291b3fded 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -8,8 +8,8 @@ class foo { } fn main() { - let cat = "kitty"; + let cat = ~"kitty"; let po = comm::port(); //~ ERROR missing `send` let ch = comm::chan(po); //~ ERROR missing `send` comm::send(ch, foo(42, @cat)); //~ ERROR missing `send` -} \ No newline at end of file +} diff --git a/src/test/run-pass/macro-by-example-2.rs b/src/test/run-pass/macro-by-example-2.rs index 668405c19f7..8f39817d0c3 100644 --- a/src/test/run-pass/macro-by-example-2.rs +++ b/src/test/run-pass/macro-by-example-2.rs @@ -1,8 +1,6 @@ +// xfail-test // I can't for the life of me manage to untangle all of the brackets -// in this test. I am just suppessing the old_vec diagnostic. This -// doesn't actually care what sort of vector it uses, so if we change -// what vectors mean, it shouldn't mind... -#[warn(no_old_vecs)]; +// in this test, so I am xfailing it... fn main() { #macro[[#zip_or_unzip[[x, ...], [y, ...]], [[x, y], ...]], -- cgit 1.4.1-3-g733a5