forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#119284 - Nadrieril:fix-bodiless-arm-parse, r=…
…cjgillot Don't drop a hir node after lowering Fixes rust-lang#119271. It seems that all hir nodes that get allocated an id must be placed within the hir on pain of ICEs. In rust-lang#118527 I dropped guards on never patterns since they're not useful, which caused the ICE.
- Loading branch information
Showing
3 changed files
with
38 additions
and
3 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
10 changes: 10 additions & 0 deletions
10
tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.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,10 @@ | ||
fn main() {} | ||
|
||
fn attr_in_guard() { | ||
match None::<u32> { | ||
Some(!) //~ ERROR `!` patterns are experimental | ||
if #[deny(unused_mut)] //~ ERROR attributes on expressions are experimental | ||
false //~ ERROR a guard on a never pattern will never be run | ||
} | ||
match false {} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.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,27 @@ | ||
error[E0658]: attributes on expressions are experimental | ||
--> $DIR/ICE-119271-never-arm-attr-in-guard.rs:6:16 | ||
| | ||
LL | if #[deny(unused_mut)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information | ||
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable | ||
|
||
error[E0658]: `!` patterns are experimental | ||
--> $DIR/ICE-119271-never-arm-attr-in-guard.rs:5:14 | ||
| | ||
LL | Some(!) | ||
| ^ | ||
| | ||
= note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information | ||
= help: add `#![feature(never_patterns)]` to the crate attributes to enable | ||
|
||
error: a guard on a never pattern will never be run | ||
--> $DIR/ICE-119271-never-arm-attr-in-guard.rs:7:13 | ||
| | ||
LL | false | ||
| ^^^^^ help: remove this guard | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |