forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#104294 - compiler-errors:inline-ct-err-in-m…
…ir-build, r=davidtwco Don't ICE with inline const errors during MIR build Fixes rust-lang#104277
- Loading branch information
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`. |