-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't ICE with inline const errors during MIR build
- Loading branch information
1 parent
742d3f0
commit 93921dd
Showing
3 changed files
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(inline_const_pat)] | ||
|
||
fn main() { | ||
match () { | ||
const { (|| {})() } => {} | ||
//~^ ERROR cannot call non-const closure in constants | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/consts/invalid-inline-const-in-match-arm.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,12 @@ | ||
error[E0015]: cannot call non-const closure in constants | ||
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17 | ||
| | ||
LL | const { (|| {})() } => {} | ||
| ^^^^^^^^^ | ||
| | ||
= note: closures need an RFC before allowed to be called in constants | ||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0015`. |