Suggest typo fix for static lifetime

This commit is contained in:
Michael Goulet 2025-03-06 17:32:32 +00:00
parent 30f168ef81
commit ac40ea7129
3 changed files with 63 additions and 18 deletions

View file

@ -0,0 +1,7 @@
fn stati<T: 'stati>() {}
//~^ ERROR use of undeclared lifetime name `'stati`
fn statoc<T: 'statoc>() {}
//~^ ERROR use of undeclared lifetime name `'statoc`
fn main() {}

View file

@ -0,0 +1,26 @@
error[E0261]: use of undeclared lifetime name `'stati`
--> $DIR/static-typos.rs:1:13
|
LL | fn stati<T: 'stati>() {}
| ^^^^^^ undeclared lifetime
|
help: you may have misspelled the `'static` lifetime
|
LL | fn stati<T: 'static>() {}
| +
error[E0261]: use of undeclared lifetime name `'statoc`
--> $DIR/static-typos.rs:4:14
|
LL | fn statoc<T: 'statoc>() {}
| ^^^^^^^ undeclared lifetime
|
help: you may have misspelled the `'static` lifetime
|
LL - fn statoc<T: 'statoc>() {}
LL + fn statoc<T: 'static>() {}
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0261`.