-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #108230 - LittleFall:enhance/warning, r=estebank
Convert a hard-warning about named static lifetimes into lint "unused_lifetimes" Fixes #96956. Some changes are ported from #98079, thanks to jeremydavis519. r? `@estebank` `@petrochenkov` Any feedback is appreciated! ## Actions - [x] resolve conflicts - [x] fix build - [x] address review comments in last pr - [x] update tests
- Loading branch information
Showing
21 changed files
with
96 additions
and
121 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
File renamed without changes.
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
2 changes: 2 additions & 0 deletions
2
...d-types/unsatified-item-lifetime-bound.rs → ...-types/unsatisfied-item-lifetime-bound.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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#![warn(unused_lifetimes)] | ||
|
||
pub trait X { | ||
type Y<'a: 'static>; | ||
//~^ WARNING unnecessary lifetime parameter | ||
|
19 changes: 12 additions & 7 deletions
19
...pes/unsatified-item-lifetime-bound.stderr → ...es/unsatisfied-item-lifetime-bound.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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,17 +1,9 @@ | ||
warning: unnecessary lifetime parameter `'z` | ||
--> $DIR/issue-30438-c.rs:7:74 | ||
| | ||
LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static { | ||
| ^^ | ||
| | ||
= help: you can use the `'static` lifetime directly, in place of `'z` | ||
|
||
error[E0515]: cannot return reference to local variable `x` | ||
--> $DIR/issue-30438-c.rs:10:5 | ||
--> $DIR/issue-30438-c.rs:9:5 | ||
| | ||
LL | &x | ||
| ^^ returns a reference to data owned by the current function | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0515`. |
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
7 changes: 6 additions & 1 deletion
7
tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
warning: unnecessary lifetime parameter `'a` | ||
--> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:12:11 | ||
--> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:14:11 | ||
| | ||
LL | where 'a: 'static | ||
| ^^ | ||
| | ||
= help: you can use the `'static` lifetime directly, in place of `'a` | ||
note: the lint level is defined here | ||
--> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:11:9 | ||
| | ||
LL | #![warn(unused_lifetimes)] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
warning: 1 warning emitted | ||
|
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
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
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 |
---|---|---|
@@ -1,20 +1,12 @@ | ||
warning: unnecessary lifetime parameter `'a` | ||
--> $DIR/bounds-are-checked.rs:8:6 | ||
| | ||
LL | fn f<'a: 'static>(t: &'a str) -> X<'a> { | ||
| ^^ | ||
| | ||
= help: you can use the `'static` lifetime directly, in place of `'a` | ||
|
||
error[E0792]: expected generic lifetime parameter, found `'static` | ||
--> $DIR/bounds-are-checked.rs:10:5 | ||
--> $DIR/bounds-are-checked.rs:9:5 | ||
| | ||
LL | type X<'a> = impl Into<&'static str> + From<&'a str>; | ||
| -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type | ||
... | ||
LL | t | ||
| ^ | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0792`. |
Oops, something went wrong.