]> git.proxmox.com Git - rustc.git/blobdiff - src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / lifetime-inference-give-expl-lifetime-param.rs
index e32ed1c42a09088e421b6c12ea59feec6a27ad8a..73d89beb2202f84369e048588a346945b6cd2179 100644 (file)
@@ -39,8 +39,8 @@ struct Cat<'x, T> { cat: &'x isize, t: T }
 struct Dog<'y> { dog: &'y isize }
 
 fn cat2<'x, 'y>(x: Cat<'x, Dog<'y>>) -> &'x isize {
-//~^ HELP: consider using an explicit lifetime parameter as shown: fn cat2<'x>(x: Cat<'x, Dog<'x>>) -> &'x isize
-    x.t.dog //~ ERROR: cannot infer
+    //~^ HELP consider using an explicit lifetime parameter as shown: fn cat2<'x>(x: Cat<'x, Dog<'x>>) -> &'x isize
+    x.t.dog //~ ERROR E0312
 }
 
 struct Baz<'x> {
@@ -49,11 +49,9 @@ struct Baz<'x> {
 
 impl<'a> Baz<'a> {
     fn baz2<'b>(&self, x: &isize) -> (&'b isize, &'b isize) {
-         //~^ HELP: parameter as shown: fn baz2<'b>(&self, x: &'b isize) -> (&'a isize, &'a isize)
-        // The lifetime that gets assigned to `x` seems somewhat random.
-        // I have disabled this test for the time being. --pcwalton
-        (self.bar, x) //~ ERROR: cannot infer
-        //~^ ERROR: cannot infer
+        //~^ HELP consider using an explicit lifetime parameter as shown: fn baz2<'b>(&self, x: &'b isize) -> (&'a isize, &'a isize)
+        (self.bar, x) //~ ERROR E0312
+        //~^ ERROR E0312
     }
 }