forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not ICE on default_field_value const with lifetimes
Fix rust-lang#135649.
- Loading branch information
Showing
3 changed files
with
34 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
6 changes: 6 additions & 0 deletions
6
tests/ui/structs/default-field-values/do-not-ice-on-invalid-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 @@ | ||
#![feature(default_field_values)] | ||
struct A<'a> { //~ ERROR lifetime parameter `'a` is never used | ||
x: Vec<A> = Vec::new(), //~ ERROR missing lifetime specifier | ||
} | ||
|
||
fn main() {} |
23 changes: 23 additions & 0 deletions
23
tests/ui/structs/default-field-values/do-not-ice-on-invalid-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,23 @@ | ||
error[E0106]: missing lifetime specifier | ||
--> $DIR/do-not-ice-on-invalid-lifetime.rs:3:12 | ||
| | ||
LL | x: Vec<A> = Vec::new(), | ||
| ^ expected named lifetime parameter | ||
| | ||
help: consider using the `'a` lifetime | ||
| | ||
LL | x: Vec<A<'a>> = Vec::new(), | ||
| ++++ | ||
|
||
error[E0392]: lifetime parameter `'a` is never used | ||
--> $DIR/do-not-ice-on-invalid-lifetime.rs:2:10 | ||
| | ||
LL | struct A<'a> { | ||
| ^^ unused lifetime parameter | ||
| | ||
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0106, E0392. | ||
For more information about an error, try `rustc --explain E0106`. |