merge fixes, addressing CR comments
This commit is contained in:
parent
1c4510adc8
commit
e58f528bb0
7 changed files with 142 additions and 162 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue