Skip to content

Commit f8e5b1c

Browse files
authored
Rollup merge of #104294 - compiler-errors:inline-ct-err-in-mir-build, r=davidtwco
Don't ICE with inline const errors during MIR build Fixes #104277
2 parents abda584 + 93921dd commit f8e5b1c

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

compiler/rustc_mir_build/src/thir/pattern/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
577577
self.errors.push(PatternError::ConstParamInPattern(span));
578578
return PatKind::Wild;
579579
}
580+
ConstKind::Error(_) => {
581+
return PatKind::Wild;
582+
}
580583
_ => bug!("Expected ConstKind::Param"),
581584
},
582585
mir::ConstantKind::Val(_, _) => self.const_to_pat(value, id, span, false).kind,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![allow(incomplete_features)]
2+
#![feature(inline_const_pat)]
3+
4+
fn main() {
5+
match () {
6+
const { (|| {})() } => {}
7+
//~^ ERROR cannot call non-const closure in constants
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0015]: cannot call non-const closure in constants
2+
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
3+
|
4+
LL | const { (|| {})() } => {}
5+
| ^^^^^^^^^
6+
|
7+
= note: closures need an RFC before allowed to be called in constants
8+
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0015`.

0 commit comments

Comments
 (0)