diff --git a/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs b/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs index dfdbd882acf..653f37d96d4 100644 --- a/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs +++ b/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs @@ -15,7 +15,7 @@ fn main() { let mut y = None; x.write_downgrade(|write_mode| { y = Some(x.downgrade(write_mode)); - //~^ ERROR cannot infer an appropriate lifetime + //~^ ERROR cannot infer }); y.unwrap(); // Adding this line causes a method unification failure instead diff --git a/src/test/compile-fail/borrowck-assign-comp-idx.rs b/src/test/compile-fail/borrowck-assign-comp-idx.rs index b50a657eae7..dec248a3015 100644 --- a/src/test/compile-fail/borrowck-assign-comp-idx.rs +++ b/src/test/compile-fail/borrowck-assign-comp-idx.rs @@ -32,9 +32,9 @@ fn b() { let mut p = ~[1]; - borrow(p, || { - p[0] = 5; //~ ERROR cannot assign to - }); + borrow( + p, + || p[0] = 5); //~ ERROR cannot borrow `p` as mutable } fn c() { diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs index b8735fb2d3c..29016a2f44f 100644 --- a/src/test/compile-fail/borrowck-autoref-3261.rs +++ b/src/test/compile-fail/borrowck-autoref-3261.rs @@ -21,13 +21,14 @@ impl X { fn main() { let mut x = X(Right(main)); - (&mut x).with(|opt| { - match opt { - &Right(ref f) => { - x = X(Left((0,0))); //~ ERROR cannot assign to `x` - (*f)() - }, - _ => fail!() - } - }) + (&mut x).with( + |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time + match opt { + &Right(ref f) => { + x = X(Left((0,0))); + (*f)() + }, + _ => fail!() + } + }) } diff --git a/src/test/compile-fail/borrowck-borrow-mut-object-twice.rs b/src/test/compile-fail/borrowck-borrow-mut-object-twice.rs index c338aac2ddf..34b9c31fdd8 100644 --- a/src/test/compile-fail/borrowck-borrow-mut-object-twice.rs +++ b/src/test/compile-fail/borrowck-borrow-mut-object-twice.rs @@ -18,7 +18,7 @@ trait Foo { fn test(x: &mut Foo) { let _y = x.f1(); - x.f2(); //~ ERROR cannot borrow `*x` because it is already borrowed as mutable + x.f2(); //~ ERROR cannot borrow `*x` as mutable } fn main() {} diff --git a/src/test/compile-fail/borrowck-insert-during-each.rs b/src/test/compile-fail/borrowck-insert-during-each.rs index 94ed47b01e1..38ff840ada4 100644 --- a/src/test/compile-fail/borrowck-insert-during-each.rs +++ b/src/test/compile-fail/borrowck-insert-during-each.rs @@ -23,9 +23,10 @@ impl Foo { } fn bar(f: &mut Foo) { - f.foo(|a| { - f.n.insert(*a); //~ ERROR cannot borrow - }) + f.foo( + |a| { //~ ERROR closure requires unique access to `f` + f.n.insert(*a); + }) } fn main() { diff --git a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs index c193288468a..18fd4111018 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs @@ -21,7 +21,9 @@ fn box_imm() { info!("v={}", *v); //~^ ERROR cannot move `v` into closure }); +} +fn box_imm_explicit() { let v = ~3; let _w = &v; task::spawn(proc() { diff --git a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs index a54476abb26..6a0d3ef82fb 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs @@ -14,11 +14,12 @@ fn borrow(v: &int, f: |x: &int|) { fn box_imm() { let mut v = ~3; - borrow(v, |w| { - v = ~4; //~ ERROR cannot assign to `v` because it is borrowed - assert_eq!(*v, 3); - assert_eq!(*w, 4); - }) + borrow(v, + |w| { //~ ERROR cannot borrow `v` as mutable + v = ~4; + assert_eq!(*v, 3); + assert_eq!(*w, 4); + }) } fn main() { diff --git a/src/test/compile-fail/borrowck-loan-rcvr.rs b/src/test/compile-fail/borrowck-loan-rcvr.rs index a0071938ce4..dbeeb521306 100644 --- a/src/test/compile-fail/borrowck-loan-rcvr.rs +++ b/src/test/compile-fail/borrowck-loan-rcvr.rs @@ -32,8 +32,8 @@ fn a() { p.impurem(); // But in this case we do not honor the loan: - p.blockm(|| { - p.x = 10; //~ ERROR cannot assign + p.blockm(|| { //~ ERROR cannot borrow `p` as mutable + p.x = 10; }) } diff --git a/src/test/compile-fail/borrowck-loan-vec-content.rs b/src/test/compile-fail/borrowck-loan-vec-content.rs index 6527ddfa2ec..0e721d7107f 100644 --- a/src/test/compile-fail/borrowck-loan-vec-content.rs +++ b/src/test/compile-fail/borrowck-loan-vec-content.rs @@ -23,9 +23,11 @@ fn has_mut_vec_and_does_not_try_to_change_it() { fn has_mut_vec_but_tries_to_change_it() { let mut v = ~[1, 2, 3]; - takes_imm_elt(&v[0], || { - v[1] = 4; //~ ERROR cannot assign - }) + takes_imm_elt( + &v[0], + || { //~ ERROR cannot borrow `v` as mutable + v[1] = 4; + }) } fn main() { diff --git a/src/test/compile-fail/borrowck-move-by-capture.rs b/src/test/compile-fail/borrowck-move-by-capture.rs index 5af1f8312aa..f3869e5c9fd 100644 --- a/src/test/compile-fail/borrowck-move-by-capture.rs +++ b/src/test/compile-fail/borrowck-move-by-capture.rs @@ -9,10 +9,8 @@ // except according to those terms. pub fn main() { - // FIXME(#2202) - Due to the way that borrowck treats closures, - // you get two error reports here. let bar = ~3; - let _g = || { //~ ERROR capture of moved value - let _h: proc() -> int = proc() *bar; //~ ERROR capture of moved value + let _g = || { + let _h: proc() -> int = proc() *bar; //~ ERROR cannot move out of captured outer variable }; } diff --git a/src/test/compile-fail/borrowck-object-lifetime.rs b/src/test/compile-fail/borrowck-object-lifetime.rs index daeb5b72857..92b77d8243e 100644 --- a/src/test/compile-fail/borrowck-object-lifetime.rs +++ b/src/test/compile-fail/borrowck-object-lifetime.rs @@ -17,7 +17,7 @@ fn borrowed_receiver<'a>(x: &'a Foo) -> &'a () { } fn owned_receiver(x: ~Foo) -> &() { - x.borrowed() //~ ERROR borrowed value does not live long enough + x.borrowed() //~ ERROR `*x` does not live long enough } fn mut_owned_receiver(mut x: ~Foo) { diff --git a/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs b/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs index 909af7da960..cca8ed93388 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs @@ -14,6 +14,6 @@ fn main() { [1, 2, ..tail] => tail, _ => unreachable!() }; - a[0] = 0; //~ ERROR cannot assign to `a[]` because it is borrowed + a[0] = 0; //~ ERROR cannot assign to `a[..]` because it is borrowed t[0]; } diff --git a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs index be66dcf372e..cb1a7d393a8 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs @@ -12,7 +12,7 @@ fn a() { let mut vec = ~[~1, ~2, ~3]; match vec { [~ref _a] => { - vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed + vec[0] = ~4; //~ ERROR cannot assign } _ => fail!("foo") } @@ -22,7 +22,7 @@ fn b() { let mut vec = ~[~1, ~2, ~3]; match vec { [.._b] => { - vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed + vec[0] = ~4; //~ ERROR cannot assign } } } diff --git a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs index cf20d57ac58..b471d40a950 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs @@ -11,7 +11,7 @@ fn a() -> &int { let vec = ~[1, 2, 3, 4]; let tail = match vec { - [_a, ..tail] => &tail[0], //~ ERROR borrowed value does not live long enough + [_a, ..tail] => &tail[0], //~ ERROR `vec[..]` does not live long enough _ => fail!("foo") }; tail diff --git a/src/test/compile-fail/issue-3154.rs b/src/test/compile-fail/issue-3154.rs index 1cfed882d6c..dcb705856d9 100644 --- a/src/test/compile-fail/issue-3154.rs +++ b/src/test/compile-fail/issue-3154.rs @@ -13,7 +13,7 @@ struct thing<'a, Q> { } fn thing(x: &Q) -> thing { - thing{ x: x } //~ ERROR cannot infer an appropriate lifetime + thing{ x: x } //~ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/compile-fail/issue-4335.rs index 4cfa543a93f..8e4aa799d1f 100644 --- a/src/test/compile-fail/issue-4335.rs +++ b/src/test/compile-fail/issue-4335.rs @@ -11,7 +11,7 @@ fn id(t: T) -> T { t } fn f<'r, T>(v: &'r T) -> 'r || -> T { - id(|| *v) //~ ERROR cannot infer an appropriate lifetime + id(|| *v) //~ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/kindck-owned-trait-contains.rs b/src/test/compile-fail/kindck-owned-trait-contains.rs index 5fe9b13f83b..ed1725f3240 100644 --- a/src/test/compile-fail/kindck-owned-trait-contains.rs +++ b/src/test/compile-fail/kindck-owned-trait-contains.rs @@ -24,7 +24,7 @@ fn main() { let y = { let tmp0 = 3; - let tmp1 = &tmp0; //~ ERROR borrowed value does not live long enough + let tmp1 = &tmp0; //~ ERROR `tmp0` does not live long enough repeater(tmp1) }; assert!(3 == *(y.get())); diff --git a/src/test/compile-fail/moves-based-on-type-access-to-field.rs b/src/test/compile-fail/moves-based-on-type-access-to-field.rs index f07d4fcf70c..1557b290c2c 100644 --- a/src/test/compile-fail/moves-based-on-type-access-to-field.rs +++ b/src/test/compile-fail/moves-based-on-type-access-to-field.rs @@ -17,13 +17,13 @@ fn touch(_a: &A) {} fn f10() { let x = Foo { f: ~"hi", y: 3 }; - consume(x.f); //~ NOTE `x.f` moved here + consume(x.f); touch(&x.y); //~ ERROR use of partially moved value: `x` } fn f20() { let x = ~[~"hi"]; - consume(x[0]); //~ NOTE `(*x)[]` moved here + consume(x[0]); touch(&x[0]); //~ ERROR use of partially moved value: `x` } diff --git a/src/test/compile-fail/mut-cant-alias.rs b/src/test/compile-fail/mut-cant-alias.rs index 5b8079b832e..e3e2ace71ad 100644 --- a/src/test/compile-fail/mut-cant-alias.rs +++ b/src/test/compile-fail/mut-cant-alias.rs @@ -14,5 +14,5 @@ fn main() { let m = RefCell::new(0); let mut b = m.borrow_mut(); let b1 = b.get(); - let b2 = b.get(); //~ ERROR cannot borrow `b` because it is already borrowed as mutable + let b2 = b.get(); //~ ERROR cannot borrow } diff --git a/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs b/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs index ca276700e8b..2e5cf1b504b 100644 --- a/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs +++ b/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs @@ -15,6 +15,6 @@ fn main() { let p; { let b = m.borrow(); - p = b.get(); //~ ERROR borrowed value does not live long enough + p = b.get(); //~ ERROR `b` does not live long enough } } diff --git a/src/test/compile-fail/regionck-closure-lifetimes.rs b/src/test/compile-fail/regionck-closure-lifetimes.rs index f66b17d68c7..ec51f2dc212 100644 --- a/src/test/compile-fail/regionck-closure-lifetimes.rs +++ b/src/test/compile-fail/regionck-closure-lifetimes.rs @@ -18,7 +18,7 @@ fn env<'a>(_: &'a uint, blk: |p: 'a |||) { let mut state = 0; let statep = &mut state; - blk(|| *statep = 1); //~ ERROR cannot infer an appropriate lifetime + blk(|| *statep = 1); //~ ERROR cannot infer } fn no_env_no_for<'a>(_: &'a uint, blk: |p: 'a |||) { @@ -40,7 +40,7 @@ fn repeating_loop() { let state = 0; loop { - closure = || state; //~ ERROR cannot infer an appropriate lifetime + closure = || state; //~ ERROR cannot infer break; } @@ -56,7 +56,7 @@ fn repeating_while() { let state = 0; while true { - closure = || state; //~ ERROR cannot infer an appropriate lifetime + closure = || state; //~ ERROR cannot infer break; } diff --git a/src/test/compile-fail/regions-addr-of-arg.rs b/src/test/compile-fail/regions-addr-of-arg.rs index ff13548b494..3e568180b53 100644 --- a/src/test/compile-fail/regions-addr-of-arg.rs +++ b/src/test/compile-fail/regions-addr-of-arg.rs @@ -12,7 +12,7 @@ // bounded by the current function call. fn foo(a: int) { - let _p: &'static int = &a; //~ ERROR borrowed value does not live long enough + let _p: &'static int = &a; //~ ERROR `a` does not live long enough } fn bar(a: int) { @@ -20,7 +20,7 @@ fn bar(a: int) { } fn zed<'a>(a: int) -> &'a int { - &a //~ ERROR borrowed value does not live long enough + &a //~ ERROR `a` does not live long enough } fn main() { diff --git a/src/test/compile-fail/regions-addr-of-self.rs b/src/test/compile-fail/regions-addr-of-self.rs index 2cd96735a07..ce89b66cd5b 100644 --- a/src/test/compile-fail/regions-addr-of-self.rs +++ b/src/test/compile-fail/regions-addr-of-self.rs @@ -14,8 +14,7 @@ struct dog { impl dog { pub fn chase_cat(&mut self) { - let p: &'static mut uint = &mut self.cats_chased; - //~^ ERROR cannot infer an appropriate lifetime + let p: &'static mut uint = &mut self.cats_chased; //~ ERROR cannot infer *p += 1u; } diff --git a/src/test/compile-fail/regions-addr-of-upvar-self.rs b/src/test/compile-fail/regions-addr-of-upvar-self.rs index c8fe60a2490..7a146c043c8 100644 --- a/src/test/compile-fail/regions-addr-of-upvar-self.rs +++ b/src/test/compile-fail/regions-addr-of-upvar-self.rs @@ -17,8 +17,7 @@ struct dog { impl dog { pub fn chase_cat(&mut self) { let _f = || { - let p: &'static mut uint = &mut self.food; - //~^ ERROR cannot infer an appropriate lifetime + let p: &'static mut uint = &mut self.food; //~ ERROR cannot infer *p = 3u; }; } diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/compile-fail/regions-bounds.rs index f74244c4984..5ef043634fb 100644 --- a/src/test/compile-fail/regions-bounds.rs +++ b/src/test/compile-fail/regions-bounds.rs @@ -17,12 +17,12 @@ struct a_class<'a> { x:&'a int } fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { return e; //~ ERROR mismatched types: expected `an_enum<'b>` but found `an_enum<'a>` - //~^ ERROR cannot infer an appropriate lifetime + //~^ ERROR cannot infer } fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { return e; //~ ERROR mismatched types: expected `a_class<'b>` but found `a_class<'a>` - //~^ ERROR cannot infer an appropriate lifetime + //~^ ERROR cannot infer } fn main() { } diff --git a/src/test/compile-fail/regions-creating-enums3.rs b/src/test/compile-fail/regions-creating-enums3.rs index 9e36ecc2b75..2c3f39795a4 100644 --- a/src/test/compile-fail/regions-creating-enums3.rs +++ b/src/test/compile-fail/regions-creating-enums3.rs @@ -14,7 +14,7 @@ enum ast<'a> { } fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { - add(x, y) //~ ERROR cannot infer an appropriate lifetime + add(x, y) //~ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/regions-creating-enums4.rs b/src/test/compile-fail/regions-creating-enums4.rs index 7683b678b2b..0cd5a975960 100644 --- a/src/test/compile-fail/regions-creating-enums4.rs +++ b/src/test/compile-fail/regions-creating-enums4.rs @@ -14,7 +14,7 @@ enum ast<'a> { } fn mk_add_bad2<'a>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast { - add(x, y) //~ ERROR cannot infer an appropriate lifetime + add(x, y) //~ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/regions-escape-loop-via-variable.rs b/src/test/compile-fail/regions-escape-loop-via-variable.rs index 19bd0bf9747..f588655d1af 100644 --- a/src/test/compile-fail/regions-escape-loop-via-variable.rs +++ b/src/test/compile-fail/regions-escape-loop-via-variable.rs @@ -18,6 +18,6 @@ fn main() { loop { let x = 1 + *p; - p = &x; //~ ERROR borrowed value does not live long enough + p = &x; //~ ERROR `x` does not live long enough } } diff --git a/src/test/compile-fail/regions-escape-loop-via-vec.rs b/src/test/compile-fail/regions-escape-loop-via-vec.rs index 92e2cd73dfb..ccfcc52945d 100644 --- a/src/test/compile-fail/regions-escape-loop-via-vec.rs +++ b/src/test/compile-fail/regions-escape-loop-via-vec.rs @@ -14,7 +14,7 @@ fn broken() { let mut _y = ~[&mut x]; while x < 10 { let mut z = x; - _y.push(&mut z); //~ ERROR borrowed value does not live long enough + _y.push(&mut z); //~ ERROR `z` does not live long enough x += 1; //~ ERROR cannot assign } } diff --git a/src/test/compile-fail/regions-free-region-ordering-callee.rs b/src/test/compile-fail/regions-free-region-ordering-callee.rs index 94c617b2182..9762e5c4690 100644 --- a/src/test/compile-fail/regions-free-region-ordering-callee.rs +++ b/src/test/compile-fail/regions-free-region-ordering-callee.rs @@ -20,13 +20,13 @@ fn ordering1<'a, 'b>(x: &'a &'b uint) -> &'a uint { fn ordering2<'a, 'b>(x: &'a &'b uint, y: &'a uint) -> &'b uint { // However, it is not safe to assume that 'b <= 'a - &*y //~ ERROR cannot infer an appropriate lifetime + &*y //~ ERROR cannot infer } fn ordering3<'a, 'b>(x: &'a uint, y: &'b uint) -> &'a &'b uint { // Do not infer an ordering from the return value. let z: &'b uint = &*x; - //~^ ERROR cannot infer an appropriate lifetime + //~^ ERROR cannot infer fail!(); } diff --git a/src/test/compile-fail/regions-free-region-ordering-caller1.rs b/src/test/compile-fail/regions-free-region-ordering-caller1.rs index 1408f75be89..b117a1a6476 100644 --- a/src/test/compile-fail/regions-free-region-ordering-caller1.rs +++ b/src/test/compile-fail/regions-free-region-ordering-caller1.rs @@ -18,7 +18,7 @@ fn call1<'a>(x: &'a uint) { let y: uint = 3; let z: &'a & uint = &(&y); //~^ ERROR borrowed value does not live long enough - //~^^ ERROR borrowed value does not live long enough + //~^^ ERROR `y` does not live long enough } fn main() {} diff --git a/src/test/compile-fail/regions-free-region-ordering-incorrect.rs b/src/test/compile-fail/regions-free-region-ordering-incorrect.rs index 54352092794..6f6b6761735 100644 --- a/src/test/compile-fail/regions-free-region-ordering-incorrect.rs +++ b/src/test/compile-fail/regions-free-region-ordering-incorrect.rs @@ -24,7 +24,7 @@ impl<'b, T> Node<'b, T> { fn get<'a>(&'a self) -> &'b T { match self.next { Some(ref next) => next.get(), - None => &self.val //~ ERROR cannot infer an appropriate lifetime + None => &self.val //~ ERROR cannot infer } } } diff --git a/src/test/compile-fail/regions-freevar.rs b/src/test/compile-fail/regions-freevar.rs index 940a7f9afbb..af460dbdd78 100644 --- a/src/test/compile-fail/regions-freevar.rs +++ b/src/test/compile-fail/regions-freevar.rs @@ -12,8 +12,7 @@ fn wants_static_fn(_x: 'static ||) {} fn main() { let i = 3; - wants_static_fn(|| { - //~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements + wants_static_fn(|| { //~ ERROR cannot infer info!("i={}", i); }) } diff --git a/src/test/compile-fail/regions-glb-free-free.rs b/src/test/compile-fail/regions-glb-free-free.rs index 8f6754b34bc..1aafd9057c2 100644 --- a/src/test/compile-fail/regions-glb-free-free.rs +++ b/src/test/compile-fail/regions-glb-free-free.rs @@ -24,7 +24,7 @@ mod argparse { impl<'a> Flag<'a> { pub fn set_desc(self, s: &str) -> Flag<'a> { - Flag { //~ ERROR cannot infer an appropriate lifetime + Flag { //~ ERROR cannot infer name: self.name, desc: s, max_count: self.max_count, diff --git a/src/test/compile-fail/regions-infer-at-fn-not-param.rs b/src/test/compile-fail/regions-infer-at-fn-not-param.rs index 46de570eaf4..ad6d1b2742d 100644 --- a/src/test/compile-fail/regions-infer-at-fn-not-param.rs +++ b/src/test/compile-fail/regions-infer-at-fn-not-param.rs @@ -22,7 +22,7 @@ struct not_parameterized2 { fn take1(p: parameterized1) -> parameterized1 { p } //~^ ERROR mismatched types -//~^^ ERROR cannot infer an appropriate lifetime +//~^^ ERROR cannot infer fn take3(p: not_parameterized1) -> not_parameterized1 { p } fn take4(p: not_parameterized2) -> not_parameterized2 { p } diff --git a/src/test/compile-fail/regions-infer-call-3.rs b/src/test/compile-fail/regions-infer-call-3.rs index bb7c487005f..66f958c7893 100644 --- a/src/test/compile-fail/regions-infer-call-3.rs +++ b/src/test/compile-fail/regions-infer-call-3.rs @@ -16,7 +16,7 @@ fn with(f: |x: &int| -> T) -> T { fn manip<'a>(x: &'a int) -> int { let z = with(|y| { select(x, y) }); - //~^ ERROR cannot infer an appropriate lifetime + //~^ ERROR cannot infer *z } diff --git a/src/test/compile-fail/regions-infer-not-param.rs b/src/test/compile-fail/regions-infer-not-param.rs index b5fce9e21bd..6596a1d8c23 100644 --- a/src/test/compile-fail/regions-infer-not-param.rs +++ b/src/test/compile-fail/regions-infer-not-param.rs @@ -23,11 +23,11 @@ struct indirect2<'a> { } fn take_direct(p: direct) -> direct { p } //~ ERROR mismatched types -//~^ ERROR cannot infer an appropriate lifetime +//~^ ERROR cannot infer fn take_indirect1(p: indirect1) -> indirect1 { p } fn take_indirect2(p: indirect2) -> indirect2 { p } //~ ERROR mismatched types -//~^ ERROR cannot infer an appropriate lifetime +//~^ ERROR cannot infer fn main() {} diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/compile-fail/regions-infer-paramd-indirect.rs index 63d3338cc89..e2f4f791652 100644 --- a/src/test/compile-fail/regions-infer-paramd-indirect.rs +++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs @@ -32,7 +32,7 @@ impl<'a> set_f<'a> for c<'a> { fn set_f_bad(&self, b: @b) { self.f = b; //~ ERROR mismatched types: expected `@@&'a int` but found `@@&int` - //~^ ERROR cannot infer an appropriate lifetime + //~^ ERROR cannot infer } } diff --git a/src/test/compile-fail/regions-nested-fns-2.rs b/src/test/compile-fail/regions-nested-fns-2.rs index 8e9a7546541..60eae9ce80a 100644 --- a/src/test/compile-fail/regions-nested-fns-2.rs +++ b/src/test/compile-fail/regions-nested-fns-2.rs @@ -12,9 +12,10 @@ fn ignore(_f: <'z>|&'z int| -> &'z int) {} fn nested() { let y = 3; - ignore(|z| { - if false { &y } else { z } //~ ERROR borrowed value does not live long enough - }); + ignore( + |z| { //~ ERROR `y` does not live long enough + if false { &y } else { z } + }); } fn main() {} diff --git a/src/test/compile-fail/regions-nested-fns.rs b/src/test/compile-fail/regions-nested-fns.rs index 11610f422a0..c66e5616b84 100644 --- a/src/test/compile-fail/regions-nested-fns.rs +++ b/src/test/compile-fail/regions-nested-fns.rs @@ -12,7 +12,7 @@ fn ignore(t: T) {} fn nested<'x>(x: &'x int) { let y = 3; - let mut ay = &y; //~ ERROR cannot infer an appropriate lifetime + let mut ay = &y; //~ ERROR cannot infer ignore::< <'z>|&'z int|>(|z| { ay = x; @@ -22,7 +22,7 @@ fn nested<'x>(x: &'x int) { ignore::< <'z>|&'z int| -> &'z int>(|z| { if false { return x; } //~ ERROR mismatched types - //~^ ERROR cannot infer an appropriate lifetime + //~^ ERROR cannot infer if false { return ay; } return z; }); diff --git a/src/test/compile-fail/regions-ret-borrowed-1.rs b/src/test/compile-fail/regions-ret-borrowed-1.rs index 7eb5fa3c60b..0c335b9d557 100644 --- a/src/test/compile-fail/regions-ret-borrowed-1.rs +++ b/src/test/compile-fail/regions-ret-borrowed-1.rs @@ -19,7 +19,7 @@ fn with(f: <'a>|x: &'a int| -> R) -> R { fn return_it<'a>() -> &'a int { with(|o| o) //~ ERROR mismatched types //~^ ERROR lifetime of return value does not outlive the function call - //~^^ ERROR cannot infer an appropriate lifetime + //~^^ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/regions-ret-borrowed.rs b/src/test/compile-fail/regions-ret-borrowed.rs index 2f6f2f44cda..469421751df 100644 --- a/src/test/compile-fail/regions-ret-borrowed.rs +++ b/src/test/compile-fail/regions-ret-borrowed.rs @@ -22,7 +22,7 @@ fn with(f: |x: &int| -> R) -> R { fn return_it() -> &int { with(|o| o) //~ ERROR mismatched types //~^ ERROR lifetime of return value does not outlive the function call - //~^^ ERROR cannot infer an appropriate lifetime + //~^^ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/regions-steal-closure.rs b/src/test/compile-fail/regions-steal-closure.rs index 32fde3747c1..f80e5616bd5 100644 --- a/src/test/compile-fail/regions-steal-closure.rs +++ b/src/test/compile-fail/regions-steal-closure.rs @@ -19,7 +19,7 @@ fn box_it<'r>(x: 'r ||) -> closure_box<'r> { fn main() { let cl_box = { let mut i = 3; - box_it(|| i += 1) //~ ERROR cannot infer an appropriate lifetime + box_it(|| i += 1) //~ ERROR cannot infer }; (cl_box.cl)(); } diff --git a/src/test/compile-fail/regions-trait-3.rs b/src/test/compile-fail/regions-trait-3.rs index 52d80f49aa6..9222fde7789 100644 --- a/src/test/compile-fail/regions-trait-3.rs +++ b/src/test/compile-fail/regions-trait-3.rs @@ -38,7 +38,7 @@ impl get_ctxt for Foo<'a> { } fn make_gc2<'a,'b>(foo: Foo<'a>) -> @get_ctxt<'b> { - return @foo as @get_ctxt; //~ ERROR cannot infer an appropriate lifetime + return @foo as @get_ctxt; //~ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs b/src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs index 0201f9dd51c..cb6c11537c6 100644 --- a/src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs +++ b/src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: cannot infer an appropriate lifetime +// error-pattern: cannot infer extern mod sync; use sync::RWLock; fn main() { diff --git a/src/test/compile-fail/trait-coercion-generic-regions.rs b/src/test/compile-fail/trait-coercion-generic-regions.rs index 2aeebc0f1a8..76c877dcca8 100644 --- a/src/test/compile-fail/trait-coercion-generic-regions.rs +++ b/src/test/compile-fail/trait-coercion-generic-regions.rs @@ -24,7 +24,7 @@ impl Trait<&'static str> for Struct { fn main() { let person = ~"Fred"; - let person: &str = person; //~ ERROR borrowed value does not live long enough + let person: &str = person; //~ ERROR `person[..]` does not live long enough let s: ~Trait<&'static str> = ~Struct { person: person }; } diff --git a/src/test/compile-fail/vec-mut-iter-borrow.rs b/src/test/compile-fail/vec-mut-iter-borrow.rs index 21ffc1ae7f9..72dbd82e947 100644 --- a/src/test/compile-fail/vec-mut-iter-borrow.rs +++ b/src/test/compile-fail/vec-mut-iter-borrow.rs @@ -12,6 +12,6 @@ fn main() { let mut xs = ~[1, 2, 3, 4]; for x in xs.mut_iter() { - xs.push(1) //~ ERROR cannot borrow `xs` because it is already borrowed as mutable + xs.push(1) //~ ERROR cannot borrow `xs` } } diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index 65f95f78ea8..59baf63d284 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -16,5 +16,6 @@ struct Refs { refs: ~[int], n: int } pub fn main() { let mut e = Refs{refs: ~[], n: 0}; let _f: || = || error!("{}", e.n); - e.refs.push(1); + let x: &[int] = e.refs; + assert_eq!(x.len(), 0); } diff --git a/src/test/run-pass/regions-copy-closure.rs b/src/test/run-pass/regions-copy-closure.rs index 718394e943f..55cb5c62684 100644 --- a/src/test/run-pass/regions-copy-closure.rs +++ b/src/test/run-pass/regions-copy-closure.rs @@ -18,8 +18,11 @@ fn box_it<'r>(x: 'r ||) -> closure_box<'r> { pub fn main() { let mut i = 3; - let cl_box = box_it(|| i += 1); assert_eq!(i, 3); - (cl_box.cl)(); + { + let cl = || i += 1; + let cl_box = box_it(cl); + (cl_box.cl)(); + } assert_eq!(i, 4); }