Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
merge fixes, addressing CR comments
- Loading branch information
1 parent
1c4510a
commit e58f528
Showing
7 changed files
with
138 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 5 additions & 21 deletions
26
src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
26 changes: 5 additions & 21 deletions
26
src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
24 changes: 7 additions & 17 deletions
24
src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
Oops, something went wrong.