mirror of
https://github.com/rust-lang/rust
synced 2024-10-17 22:13:59 +00:00
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
This commit is contained in:
commit
f8e5b1ce9e
|
@ -577,6 +577,9 @@ fn lower_inline_const(
|
|||
self.errors.push(PatternError::ConstParamInPattern(span));
|
||||
return PatKind::Wild;
|
||||
}
|
||||
ConstKind::Error(_) => {
|
||||
return PatKind::Wild;
|
||||
}
|
||||
_ => bug!("Expected ConstKind::Param"),
|
||||
},
|
||||
mir::ConstantKind::Val(_, _) => self.const_to_pat(value, id, span, false).kind,
|
||||
|
|
9
src/test/ui/consts/invalid-inline-const-in-match-arm.rs
Normal file
9
src/test/ui/consts/invalid-inline-const-in-match-arm.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#![allow(incomplete_features)]
|
||||
#![feature(inline_const_pat)]
|
||||
|
||||
fn main() {
|
||||
match () {
|
||||
const { (|| {})() } => {}
|
||||
//~^ ERROR cannot call non-const closure in constants
|
||||
}
|
||||
}
|
12
src/test/ui/consts/invalid-inline-const-in-match-arm.stderr
Normal file
12
src/test/ui/consts/invalid-inline-const-in-match-arm.stderr
Normal file
|
@ -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`.
|
Loading…
Reference in a new issue