]> git.lizzy.rs Git - rust.git/commitdiff
test -- update tests with new error messages
authorNiko Matsakis <niko@alum.mit.edu>
Mon, 10 Feb 2014 12:44:03 +0000 (07:44 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Tue, 11 Feb 2014 21:55:25 +0000 (16:55 -0500)
49 files changed:
src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs
src/test/compile-fail/borrowck-assign-comp-idx.rs
src/test/compile-fail/borrowck-autoref-3261.rs
src/test/compile-fail/borrowck-borrow-mut-object-twice.rs
src/test/compile-fail/borrowck-insert-during-each.rs
src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
src/test/compile-fail/borrowck-loan-rcvr.rs
src/test/compile-fail/borrowck-loan-vec-content.rs
src/test/compile-fail/borrowck-move-by-capture.rs
src/test/compile-fail/borrowck-object-lifetime.rs
src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
src/test/compile-fail/borrowck-vec-pattern-nesting.rs
src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
src/test/compile-fail/issue-3154.rs
src/test/compile-fail/issue-4335.rs
src/test/compile-fail/kindck-owned-trait-contains.rs
src/test/compile-fail/moves-based-on-type-access-to-field.rs
src/test/compile-fail/mut-cant-alias.rs
src/test/compile-fail/mut-ptr-cant-outlive-ref.rs
src/test/compile-fail/regionck-closure-lifetimes.rs
src/test/compile-fail/regions-addr-of-arg.rs
src/test/compile-fail/regions-addr-of-self.rs
src/test/compile-fail/regions-addr-of-upvar-self.rs
src/test/compile-fail/regions-bounds.rs
src/test/compile-fail/regions-creating-enums3.rs
src/test/compile-fail/regions-creating-enums4.rs
src/test/compile-fail/regions-escape-loop-via-variable.rs
src/test/compile-fail/regions-escape-loop-via-vec.rs
src/test/compile-fail/regions-free-region-ordering-callee.rs
src/test/compile-fail/regions-free-region-ordering-caller1.rs
src/test/compile-fail/regions-free-region-ordering-incorrect.rs
src/test/compile-fail/regions-freevar.rs
src/test/compile-fail/regions-glb-free-free.rs
src/test/compile-fail/regions-infer-at-fn-not-param.rs
src/test/compile-fail/regions-infer-call-3.rs
src/test/compile-fail/regions-infer-not-param.rs
src/test/compile-fail/regions-infer-paramd-indirect.rs
src/test/compile-fail/regions-nested-fns-2.rs
src/test/compile-fail/regions-nested-fns.rs
src/test/compile-fail/regions-ret-borrowed-1.rs
src/test/compile-fail/regions-ret-borrowed.rs
src/test/compile-fail/regions-steal-closure.rs
src/test/compile-fail/regions-trait-3.rs
src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs
src/test/compile-fail/trait-coercion-generic-regions.rs
src/test/compile-fail/vec-mut-iter-borrow.rs
src/test/run-pass/lambda-infer-unresolved.rs
src/test/run-pass/regions-copy-closure.rs

index dfdbd882acff6ed23749f209168734c5911e6ed7..653f37d96d473d8bb41cb12cfcc808d59c3e6ff3 100644 (file)
@@ -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
index b50a657eae79a93e2dd3d86c32de888055599f9c..dec248a3015d58f2cc175e22a90326e369c72bd4 100644 (file)
@@ -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() {
index b8735fb2d3cf93277c934f4613f3dc77999c069f..29016a2f44f14921b9f94ab318ff6e7da54634b8 100644 (file)
@@ -21,13 +21,14 @@ pub fn with(&self, blk: |x: &Either<(uint,uint),extern fn()>|) {
 
 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!()
+            }
+        })
 }
index c338aac2ddf5ecc452633ee2e7143c5e6c3bc3ac..34b9c31fdd82fb8aeb101ce0f87347e68cb0d689 100644 (file)
@@ -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() {}
index 94ed47b01e1ee65f7bd06256e2dd083cfd0fdfc1..38ff840ada4089ce71b530e42f3675f588b3e6ae 100644 (file)
@@ -23,9 +23,10 @@ pub fn foo(&mut self, fun: |&int|) {
 }
 
 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() {
index c193288468a20ba3aa120c884469d332a2867b16..18fd411101834bb9598c3bd562850176289b32e0 100644 (file)
@@ -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() {
index a54476abb26d691c55f5f533f0f878a9f786df6b..6a0d3ef82fb21d40de474cf76e88d4c1ef584123 100644 (file)
@@ -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() {
index a0071938ce437ee50ee4f879264286c45e01c91b..dbeeb5213069b2fa8de90f8a0565403282ac62bd 100644 (file)
@@ -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;
     })
 }
 
index 6527ddfa2ecf67999fe385f3dc60dd8098a48622..0e721d7107f8ba6084816944e8f474a68f1e8f16 100644 (file)
@@ -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() {
index 5af1f8312aaa55b78cd9ed4a1aebdce5cc3e9fed..f3869e5c9fdbaddb0b4a36482922aff5597a6806 100644 (file)
@@ -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
     };
 }
index daeb5b728571663425c87be3ea05bf72756d7864..92b77d8243efc93182d96e878d94b7e63dbd6b32 100644 (file)
@@ -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) {
index 909af7da96084246efc0bef160681643a92bb2f9..cca8ed93388bc26fa4ca867bb354a30562c03ab1 100644 (file)
@@ -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];
 }
index be66dcf372ed39123c70973c399b5245e4bc2bea..cb1a7d393a88fe34e52d0bb46a33ae90297c2ec4 100644 (file)
@@ -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
         }
     }
 }
index cf20d57ac58bea82672db985de39c06f241e8b39..b471d40a950f122d4dbff5b69c412b02bc3a2793 100644 (file)
@@ -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
index 1cfed882d6c5119d12beaaaab85f4285934c96d1..dcb705856d997b6ad2916298621c21a226b772a2 100644 (file)
@@ -13,7 +13,7 @@ struct thing<'a, Q> {
 }
 
 fn thing<Q>(x: &Q) -> thing<Q> {
-    thing{ x: x } //~ ERROR cannot infer an appropriate lifetime
+    thing{ x: x } //~ ERROR cannot infer
 }
 
 fn main() {
index 4cfa543a93fbefc7527130a3895017f8484393e5..8e4aa799d1fb93f63e15fd47ee4ffd008577fab0 100644 (file)
@@ -11,7 +11,7 @@
 fn id<T>(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() {
index 5fe9b13f83befeb30a22a18d99ac7be3510fc3bb..ed1725f3240fa3326c8684d344893dfe913f00fe 100644 (file)
@@ -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()));
index f07d4fcf70c2058bb3be731c9ebc71a435a1f806..1557b290c2cb19e3fb3399b49a438a3becafd73c 100644 (file)
@@ -17,13 +17,13 @@ fn touch<A>(_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`
 }
 
index 5b8079b832e79a914bfee15306c2272c63aa8b0d..e3e2ace71adc06c7204ea14e3e8dd1c2959dee16 100644 (file)
@@ -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
 }
index ca276700e8b61d1a26f5ca7d1ec4b4f8f20cae44..2e5cf1b504b65d0b3be19f8c1483bb0b2d2c0fb0 100644 (file)
@@ -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
     }
 }
index f66b17d68c76fa954eff2ba7432ee359e703c6fd..ec51f2dc2124434d7161a8975bce842e1b162796 100644 (file)
@@ -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;
     }
 
index ff13548b4946f9417e655dc7950799fa90dbc022..3e568180b53a4ba26d2a151a747337947e84e9dc 100644 (file)
@@ -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() {
index 2cd96735a07090685e9da4e3d72b0bb9f8f40c1d..ce89b66cd5b944b76a3021c8842b914adf28bbe8 100644 (file)
@@ -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;
     }
 
index c8fe60a2490fa4b2816a713ad66d75409be0831f..7a146c043c8389cfb776c42dc104be176c666f5e 100644 (file)
@@ -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;
         };
     }
index f74244c49843789d455b6d727cc2b15219dc04c2..5ef043634fbe344f4252acf3ba3f4ca0fbe1d10f 100644 (file)
@@ -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() { }
index 9e36ecc2b75ec82ac4d71d12a1bae90825699a7c..2c3f39795a4f0008be718b2907740bb4c0c8d94c 100644 (file)
@@ -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() {
index 7683b678b2b6a55abf6d298aab2117ce96968b53..0cd5a97596045439c9be46acc8488bc1eb788da6 100644 (file)
@@ -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() {
index 19bd0bf9747bbdb70f56cca7110ba487f5506b24..f588655d1afa85af5b19e7fc1af8c8a46594d233 100644 (file)
@@ -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
     }
 }
index 92e2cd73dfbd8c13ca5bb6cc655c258dcfda6ced..ccfcc52945daf8121f6871ebb1599f131856cf85 100644 (file)
@@ -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
     }
 }
index 94c617b21826617339f10052014fd6a849e39519..9762e5c4690ec82ebe14274cfe018d05b5ee6545 100644 (file)
@@ -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!();
 }
 
index 1408f75be896e39cbf5aa1153ed4d38ab03ffe31..b117a1a647643c994d62a726b8b3d906d7bdcb18 100644 (file)
@@ -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() {}
index 54352092794c6bd350d4983852211b99f6e7d24b..6f6b6761735c25c318a5eef00ae5b12ea56546b0 100644 (file)
@@ -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
     }
   }
 }
index 940a7f9afbbb3f29c16a1d6a518714e81523fb0b..af460dbdd7868cab621b2a21b6a130e1e1d271fa 100644 (file)
@@ -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);
     })
 }
index 8f6754b34bc09ef4cae1e38cee8d8a9987eed8b5..1aafd9057c266809770ea7c8e08dabaa8fc12f62 100644 (file)
@@ -24,7 +24,7 @@ pub fn flag<'r>(name: &'r str, desc: &'r str) -> Flag<'r> {
 
     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,
index 46de570eaf4d08278aead0e27adc11d621df5a67..ad6d1b2742d10c0a564b12e6cbeef1d71009c776 100644 (file)
@@ -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 }
index bb7c487005faa961cc981ef6666f50beac05c01b..66f958c789336a1b778d7028d062e942379bb91d 100644 (file)
@@ -16,7 +16,7 @@ fn with<T>(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
 }
 
index b5fce9e21bda7e10824177744c10147f7aad8720..6596a1d8c2384032b0a8dd88f6db2b7e6b962847 100644 (file)
@@ -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() {}
index 63d3338cc8955a98b7ac60686f071ef286073ef8..e2f4f791652a59d9966e5b06ac373301c3099db6 100644 (file)
@@ -32,7 +32,7 @@ fn set_f_ok(&self, b: @b<'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
     }
 }
 
index 8e9a7546541d09675fbb5d4b26564490b41c2ddb..60eae9ce80af1ce41e32e8624a7e129e676893cc 100644 (file)
@@ -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() {}
index 11610f422a0c8121ca7192cf9c1118fd346de6da..c66e5616b849ab395779d74e1ef66764e9741839 100644 (file)
@@ -12,7 +12,7 @@ fn ignore<T>(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;
     });
index 7eb5fa3c60be6de41b98526e9e562609c5591008..0c335b9d5575fa5a6d0351c5bc8474c306d5abbc 100644 (file)
@@ -19,7 +19,7 @@ fn with<R>(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() {
index 2f6f2f44cda585e9cf60a53ca65e74ef607b2b2b..469421751df2b69c4bca156b1725f7d735704c58 100644 (file)
@@ -22,7 +22,7 @@ fn with<R>(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() {
index 32fde3747c1d3f23cac1fa045321f0a1abb5e6b9..f80e5616bd5554f4fca5ab4749eb4fbad95116f9 100644 (file)
@@ -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)();
 }
index 52d80f49aa67f47bf0378495aa1b9f45aaffc20d..9222fde7789ee7bc6ac91034ffde997972046019 100644 (file)
@@ -38,7 +38,7 @@ fn get_ctxt(&self) -> &'a uint { self.r }
 }
 
 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() {
index 0201f9dd51cbfeb76f57659f1b3054645867d267..cb6c11537c60985e0fc74cc521481d6a924c7ce1 100644 (file)
@@ -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() {
index 2aeebc0f1a8dc0badacd0019243137d3733e5631..76c877dcca821b14ad743382c491234e6c203b9f 100644 (file)
@@ -24,7 +24,7 @@ fn f(&self, x: &'static str) {
 
 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 };
 }
 
index 21ffc1ae7f9341312f1f3062ea8666ef4f4c0c2d..72dbd82e947f1701c64905708828b482bebe077d 100644 (file)
@@ -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`
     }
 }
index 65f95f78ea86f6dbb89a7d22aadcb551077c5f64..59baf63d28400403a044653a80bf5b553a40562c 100644 (file)
@@ -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);
 }
index 718394e943fe95bcc2bc05f821b70eb0696deae4..55cb5c626846206b469de8d017242b9bf0332c04 100644 (file)
@@ -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);
 }