-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #82717 - estebank:issue-70152, r=lcnr
Account for macros when suggesting adding lifetime Fix #70152.
- Loading branch information
Showing
3 changed files
with
77 additions
and
8 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
16 changes: 16 additions & 0 deletions
16
src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs
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,16 @@ | ||
#[derive(Eq, PartialEq)] | ||
struct Test { | ||
a: &'b str, | ||
//~^ ERROR use of undeclared lifetime name `'b` | ||
//~| ERROR use of undeclared lifetime name `'b` | ||
} | ||
|
||
trait T { | ||
fn foo(&'static self) {} | ||
} | ||
|
||
impl T for Test { | ||
fn foo(&'b self) {} //~ ERROR use of undeclared lifetime name `'b` | ||
} | ||
|
||
fn main() {} |
40 changes: 40 additions & 0 deletions
40
src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
error[E0261]: use of undeclared lifetime name `'b` | ||
--> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:13:13 | ||
| | ||
LL | fn foo(&'b self) {} | ||
| ^^ undeclared lifetime | ||
| | ||
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes | ||
help: consider introducing lifetime `'b` here | ||
| | ||
LL | impl<'b> T for Test { | ||
| ^^^^ | ||
help: consider introducing lifetime `'b` here | ||
| | ||
LL | fn foo<'b>(&'b self) {} | ||
| ^^^^ | ||
|
||
error[E0261]: use of undeclared lifetime name `'b` | ||
--> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9 | ||
| | ||
LL | struct Test { | ||
| - help: consider introducing lifetime `'b` here: `<'b>` | ||
LL | a: &'b str, | ||
| ^^ undeclared lifetime | ||
| | ||
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes | ||
|
||
error[E0261]: use of undeclared lifetime name `'b` | ||
--> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9 | ||
| | ||
LL | #[derive(Eq, PartialEq)] | ||
| -- lifetime `'b` is missing in item created through this procedural macro | ||
LL | struct Test { | ||
LL | a: &'b str, | ||
| ^^ undeclared lifetime | ||
| | ||
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0261`. |