diff options
Diffstat (limited to 'src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs')
| -rw-r--r-- | src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs b/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs index 4abf045501c..c60e321219b 100644 --- a/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs +++ b/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs @@ -10,43 +10,43 @@ // ignore-tidy-linelength -struct Foo<'x> { bar: int } -fn foo1<'a>(x: &Foo) -> &'a int { -//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a int +struct Foo<'x> { bar: isize } +fn foo1<'a>(x: &Foo) -> &'a isize { +//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a isize &x.bar //~ ERROR: cannot infer } -fn foo2<'a, 'b>(x: &'a Foo) -> &'b int { -//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo2<'a>(x: &'a Foo) -> &'a int +fn foo2<'a, 'b>(x: &'a Foo) -> &'b isize { +//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo2<'a>(x: &'a Foo) -> &'a isize &x.bar //~ ERROR: cannot infer } -fn foo3<'a>(x: &Foo) -> (&'a int, &'a int) { -//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo3<'a>(x: &'a Foo) -> (&'a int, &'a int) +fn foo3<'a>(x: &Foo) -> (&'a isize, &'a isize) { +//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo3<'a>(x: &'a Foo) -> (&'a isize, &'a isize) (&x.bar, &x.bar) //~ ERROR: cannot infer //~^ ERROR: cannot infer } -fn foo4<'a, 'b>(x: &'a Foo) -> (&'b int, &'a int, &'b int) { -//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo4<'a>(x: &'a Foo) -> (&'a int, &'a int, &'a int) +fn foo4<'a, 'b>(x: &'a Foo) -> (&'b isize, &'a isize, &'b isize) { +//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo4<'a>(x: &'a Foo) -> (&'a isize, &'a isize, &'a isize) (&x.bar, &x.bar, &x.bar) //~ ERROR: cannot infer //~^ ERROR: cannot infer } -struct Cat<'x, T> { cat: &'x int, t: T } -struct Dog<'y> { dog: &'y int } +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 int { -//~^ HELP: consider using an explicit lifetime parameter as shown: fn cat2<'x>(x: Cat<'x, Dog<'x>>) -> &'x int +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 } struct Baz<'x> { - bar: &'x int + bar: &'x isize } impl<'a> Baz<'a> { - fn baz2<'b>(&self, x: &int) -> (&'b int, &'b int) { + fn baz2<'b>(&self, x: &isize) -> (&'b isize, &'b 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 |
