forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#117967 - adetaylor:fix-lifetime-elision-bug, …
…r=<try> Fix lifetime elision ```rust struct Concrete(u32); impl Concrete { fn m(self: &Box<Self>) -> &u32 { &self.0 } } ``` resulted in a confusing error. ```rust impl Concrete { fn n(self: &Box<&Self>) -> &u32 { &self.0 } } ``` resulted in no error or warning, despite apparent ambiguity over the elided lifetime. Fixes rust-lang#117715
- Loading branch information
Showing
13 changed files
with
445 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self-async.rs:22:74 | ||
| | ||
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 { | ||
| ------------------ --- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | async fn wrap_ref_Self_ref_Self<'a>(self: Wrap<&'a Self, &'a Self>, f: &'a u8) -> &'a u8 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self-async.rs:28:84 | ||
| | ||
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ||
| ----------------------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | async fn box_wrap_ref_Self_ref_Self<'a>(self: Box<Wrap<&'a Self, &'a Self>>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self-async.rs:34:84 | ||
| | ||
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ||
| ----------------------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | async fn pin_wrap_ref_Self_ref_Self<'a>(self: Pin<Wrap<&'a Self, &'a Self>>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self-async.rs:40:93 | ||
| | ||
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ||
| ---------------------------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | async fn box_box_wrap_ref_Self_ref_Self<'a>(self: Box<Box<Wrap<&'a Self, &'a Self>>>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self-async.rs:46:93 | ||
| | ||
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ||
| ---------------------------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | async fn box_pin_wrap_ref_Self_ref_Self<'a>(self: Box<Pin<Wrap<&'a Self, &'a Self>>>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/multiple-ref-self-async.rs:24:9 | ||
| | ||
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 { | ||
| - let's call the lifetime of this reference `'1` | ||
LL | | ||
LL | f | ||
| ^ returning this value requires that `'1` must outlive `'static` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/multiple-ref-self-async.rs:30:9 | ||
| | ||
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ||
| - let's call the lifetime of this reference `'1` | ||
LL | | ||
LL | f | ||
| ^ returning this value requires that `'1` must outlive `'static` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/multiple-ref-self-async.rs:36:9 | ||
| | ||
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ||
| - let's call the lifetime of this reference `'1` | ||
LL | | ||
LL | f | ||
| ^ returning this value requires that `'1` must outlive `'static` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/multiple-ref-self-async.rs:42:9 | ||
| | ||
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ||
| - let's call the lifetime of this reference `'1` | ||
LL | | ||
LL | f | ||
| ^ returning this value requires that `'1` must outlive `'static` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/multiple-ref-self-async.rs:48:9 | ||
| | ||
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ||
| - let's call the lifetime of this reference `'1` | ||
LL | | ||
LL | f | ||
| ^ returning this value requires that `'1` must outlive `'static` | ||
|
||
error: aborting due to 10 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0106`. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self.rs:20:68 | ||
| | ||
LL | fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 { | ||
| ------------------ --- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | fn wrap_ref_Self_ref_Self<'a>(self: Wrap<&'a Self, &'a Self>, f: &'a u8) -> &'a u8 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self.rs:25:78 | ||
| | ||
LL | fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ||
| ----------------------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | fn box_wrap_ref_Self_ref_Self<'a>(self: Box<Wrap<&'a Self, &'a Self>>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self.rs:30:78 | ||
| | ||
LL | fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ||
| ----------------------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | fn pin_wrap_ref_Self_ref_Self<'a>(self: Pin<Wrap<&'a Self, &'a Self>>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self.rs:35:87 | ||
| | ||
LL | fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ||
| ---------------------------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | fn box_box_wrap_ref_Self_ref_Self<'a>(self: Box<Box<Wrap<&'a Self, &'a Self>>>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/multiple-ref-self.rs:40:87 | ||
| | ||
LL | fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ||
| ---------------------------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | fn box_pin_wrap_ref_Self_ref_Self<'a>(self: Box<Pin<Wrap<&'a Self, &'a Self>>>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0106`. |
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
Oops, something went wrong.