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#111054 - cjgillot:cfg-eval-recover, r=b-naber
Do not recover when parsing stmt in cfg-eval. `parse_stmt` does recovery on its own. When parsing the statement fails, we always get `Ok(None)` instead of an `Err` variant with the diagnostic that we can emit. To avoid this behaviour, we need to opt-out of recovery for cfg_eval. Fixes rust-lang#105228
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 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
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,13 @@ | ||
// Verify that we do not ICE when failing to parse a statement in `cfg_eval`. | ||
|
||
#![feature(cfg_eval)] | ||
#![feature(stmt_expr_attributes)] | ||
|
||
#[cfg_eval] | ||
fn main() { | ||
#[cfg_eval] | ||
let _ = #[cfg(FALSE)] 0; | ||
//~^ ERROR removing an expression is not supported in this position | ||
//~| ERROR expected expression, found `;` | ||
//~| ERROR removing an expression is not supported in this position | ||
} |
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,20 @@ | ||
error: removing an expression is not supported in this position | ||
--> $DIR/cfg-stmt-recovery.rs:9:13 | ||
| | ||
LL | let _ = #[cfg(FALSE)] 0; | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: expected expression, found `;` | ||
--> $DIR/cfg-stmt-recovery.rs:9:28 | ||
| | ||
LL | let _ = #[cfg(FALSE)] 0; | ||
| ^ expected expression | ||
|
||
error: removing an expression is not supported in this position | ||
--> $DIR/cfg-stmt-recovery.rs:9:13 | ||
| | ||
LL | let _ = #[cfg(FALSE)] 0; | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|