diff options
| author | gaurikholkar <f2013002@goa.bits-pilani.ac.in> | 2017-09-11 19:59:57 +0530 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2017-09-26 11:55:52 -0400 |
| commit | e58f528bb0664c33355ff6b0aa125b8a751fee2a (patch) | |
| tree | 2bea64ce73bddceed3317e3d00ed1d715a3c0c2a /src/test | |
| parent | 1c4510adc81bd7623bc2993b42ee7d87320f1f2b (diff) | |
| download | rust-e58f528bb0664c33355ff6b0aa125b8a751fee2a.tar.gz rust-e58f528bb0664c33355ff6b0aa125b8a751fee2a.zip | |
merge fixes, addressing CR comments
Diffstat (limited to 'src/test')
4 files changed, 24 insertions, 76 deletions
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index e3fd0192053..4a1673a531d 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -1,27 +1,11 @@ -error[E0312]: lifetime of reference outlives lifetime of borrowed content... +error[E0621]: explicit lifetime required in the type of `self` --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5 | +16 | fn foo<'a>(&self, x: &'a i32) -> &i32 { + | ----- consider changing the type of `self` to `&'a Foo` +17 | 18 | x - | ^ - | -note: ...the reference is valid for the anonymous lifetime #1 defined on the method body at 16:3... - --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:16:3 - | -16 | / fn foo<'a>(&self, x: &'a i32) -> &i32 { -17 | | -18 | | x -19 | | -20 | | } - | |___^ -note: ...but the borrowed content is only valid for the lifetime 'a as defined on the method body at 16:3 - --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:16:3 - | -16 | / fn foo<'a>(&self, x: &'a i32) -> &i32 { -17 | | -18 | | x -19 | | -20 | | } - | |___^ + | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index 8551f015db5..973c5ed72f8 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -1,27 +1,11 @@ -error[E0312]: lifetime of reference outlives lifetime of borrowed content... +error[E0621]: explicit lifetime required in the type of `self` --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30 | +16 | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { + | ----- consider changing the type of `self` to `&'a Foo` +17 | 18 | if true { x } else { self } - | ^^^^ - | -note: ...the reference is valid for the lifetime 'a as defined on the method body at 16:5... - --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:16:5 - | -16 | / fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { -17 | | -18 | | if true { x } else { self } -19 | | -20 | | } - | |_____^ -note: ...but the borrowed content is only valid for the anonymous lifetime #1 defined on the method body at 16:5 - --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:16:5 - | -16 | / fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { -17 | | -18 | | if true { x } else { self } -19 | | -20 | | } - | |_____^ + | ^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr index 890f9b311e7..c6b1280ca95 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr @@ -1,23 +1,13 @@ -error[E0312]: lifetime of reference outlives lifetime of borrowed content... +error[E0621]: explicit lifetime required in the type of `self` --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5 | +16 | fn foo<'a>(&self, x: &i32) -> &i32 { + | ---- ---- + | | + | this parameter and the return type are + declared with different lifetimes... 17 | x - | ^ - | -note: ...the reference is valid for the anonymous lifetime #1 defined on the method body at 16:3... - --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:16:3 - | -16 | / fn foo<'a>(&self, x: &i32) -> &i32 { -17 | | x -18 | | } - | |___^ -note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined on the method body at 16:3 - --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:16:3 - | -16 | / fn foo<'a>(&self, x: &i32) -> &i32 { -17 | | x -18 | | } - | |___^ + | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr index 43f00c32c62..9b15de1b173 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr @@ -1,23 +1,13 @@ -error[E0312]: lifetime of reference outlives lifetime of borrowed content... +error[E0623]: lifetime mismatch --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:19 | +16 | fn foo<'a>(&self, x: &Foo) -> &Foo { + | ---- ---- + | | + | this parameter and the return type are + declared with different lifetimes... 17 | if true { x } else { self } - | ^ - | -note: ...the reference is valid for the anonymous lifetime #1 defined on the method body at 16:5... - --> $DIR/ex3-both-anon-regions-self-is-anon.rs:16:5 - | -16 | / fn foo<'a>(&self, x: &Foo) -> &Foo { -17 | | if true { x } else { self } -18 | | } - | |_____^ -note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined on the method body at 16:5 - --> $DIR/ex3-both-anon-regions-self-is-anon.rs:16:5 - | -16 | / fn foo<'a>(&self, x: &Foo) -> &Foo { -17 | | if true { x } else { self } -18 | | } - | |_____^ + | ^ ...but data from `x` is returned here error: aborting due to previous error |
