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.
Rollup merge of rust-lang#69903 - estebank:icemation, r=oli-obk
Do not ICE in the face of invalid enum discriminant Fix rust-lang#67377. r? @pnkfelix
- Loading branch information
Showing
4 changed files
with
173 additions
and
5 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
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
35 changes: 35 additions & 0 deletions
35
src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.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,35 @@ | ||
mod a { | ||
use std::marker::PhantomData; | ||
|
||
enum Bug { | ||
V = [PhantomData; { [ () ].len() ].len() as isize, | ||
//~^ ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
} | ||
} | ||
|
||
mod b { | ||
enum Bug { | ||
V = [Vec::new; { [].len() ].len() as isize, | ||
//~^ ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
//~| ERROR type annotations needed | ||
} | ||
} | ||
|
||
mod c { | ||
enum Bug { | ||
V = [Vec::new; { [0].len() ].len() as isize, | ||
//~^ ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
//~| ERROR mismatched closing delimiter: `]` | ||
//~| ERROR type annotations needed | ||
} | ||
} | ||
|
||
fn main() {} |
123 changes: 123 additions & 0 deletions
123
src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.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,123 @@ | ||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 | ||
| | ||
LL | V = [PhantomData; { [ () ].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 | ||
| | ||
LL | V = [Vec::new; { [].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 | ||
| | ||
LL | V = [Vec::new; { [0].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 | ||
| | ||
LL | V = [PhantomData; { [ () ].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 | ||
| | ||
LL | V = [Vec::new; { [].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 | ||
| | ||
LL | V = [Vec::new; { [0].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 | ||
| | ||
LL | V = [PhantomData; { [ () ].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 | ||
| | ||
LL | V = [Vec::new; { [].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 | ||
| | ||
LL | V = [Vec::new; { [0].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 | ||
| | ||
LL | V = [PhantomData; { [ () ].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 | ||
| | ||
LL | V = [Vec::new; { [].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error: mismatched closing delimiter: `]` | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 | ||
| | ||
LL | V = [Vec::new; { [0].len() ].len() as isize, | ||
| - - ^ mismatched closing delimiter | ||
| | | | ||
| | unclosed delimiter | ||
| closing delimiter possibly meant for this | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:29 | ||
| | ||
LL | V = [Vec::new; { [].len() ].len() as isize, | ||
| ^^^ cannot infer type for type parameter `T` | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14 | ||
| | ||
LL | V = [Vec::new; { [0].len() ].len() as isize, | ||
| ^^^^^^^^ cannot infer type for type parameter `T` | ||
|
||
error: aborting due to 14 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0282`. |