Suggest typo fix for static lifetime
This commit is contained in:
parent
30f168ef81
commit
ac40ea7129
3 changed files with 63 additions and 18 deletions
7
tests/ui/lifetimes/static-typos.rs
Normal file
7
tests/ui/lifetimes/static-typos.rs
Normal 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() {}
|
||||
26
tests/ui/lifetimes/static-typos.stderr
Normal file
26
tests/ui/lifetimes/static-typos.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue