diff options
| author | P1start <rewi-github@whanau.org> | 2014-09-13 14:01:17 +1200 |
|---|---|---|
| committer | P1start <rewi-github@whanau.org> | 2014-10-02 11:09:29 +1300 |
| commit | a8577be6f4e2d92b4f397aa8191e4ac48e2b4c6d (patch) | |
| tree | 5f84143453fb6e5c040648326ca6a7a4d093ae32 /src/test | |
| parent | 60e7317345f246a8169bbfe721473f693d54cade (diff) | |
| download | rust-a8577be6f4e2d92b4f397aa8191e4ac48e2b4c6d.tar.gz rust-a8577be6f4e2d92b4f397aa8191e4ac48e2b4c6d.zip | |
Output a note when lifetimes cannot be elided from functions
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs index aef3f7a40b5..5fa8c5db5b0 100644 --- a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs +++ b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs @@ -10,11 +10,13 @@ // Lifetime annotation needed because we have no arguments. fn f() -> &int { //~ ERROR missing lifetime specifier +//~^ NOTE there is no value for it to be borrowed from fail!() } // Lifetime annotation needed because we have two by-reference parameters. -fn g(_: &int, _: &int) -> &int { //~ ERROR missing lifetime specifier +fn g(_x: &int, _y: &int) -> &int { //~ ERROR missing lifetime specifier +//~^ NOTE the signature does not say whether it is borrowed from `_x` or `_y` fail!() } @@ -24,7 +26,8 @@ struct Foo<'a> { // Lifetime annotation needed because we have two lifetimes: one as a parameter // and one on the reference. -fn h(_: &Foo) -> &int { //~ ERROR missing lifetime specifier +fn h(_x: &Foo) -> &int { //~ ERROR missing lifetime specifier +//~^ NOTE the signature does not say which one of `_x`'s 2 elided lifetimes it is borrowed from fail!() } |
