-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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 #107580 - lenko-d:default_value_for_a_lifetime_generi…
…c_parameter_produces_confusing_diagnostic, r=compiler-errors Recover from lifetimes with default lifetimes in generic args Fixes [#107492](#107492)
- Loading branch information
Showing
5 changed files
with
41 additions
and
1 deletion.
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
6 changes: 6 additions & 0 deletions
6
tests/ui/lifetimes/issue-107492-default-value-for-lifetime.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,6 @@ | ||
pub struct DefaultLifetime<'a, 'b = 'static> { | ||
//~^ ERROR unexpected default lifetime parameter | ||
_marker: std::marker::PhantomData<&'a &'b ()>, | ||
} | ||
|
||
fn main(){} |
8 changes: 8 additions & 0 deletions
8
tests/ui/lifetimes/issue-107492-default-value-for-lifetime.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,8 @@ | ||
error: unexpected default lifetime parameter | ||
--> $DIR/issue-107492-default-value-for-lifetime.rs:1:35 | ||
| | ||
LL | pub struct DefaultLifetime<'a, 'b = 'static> { | ||
| ^^^^^^^^^ lifetime parameters cannot have default values | ||
|
||
error: aborting due to previous error | ||
|