Skip to content

Commit c0a089e

Browse files
authored
Rollup merge of #112634 - mj10021:issue-112438-fix, r=compiler-errors
add InlineConst check add check to close #112438
2 parents c4c5e0b + b1f7ab2 commit c0a089e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

compiler/rustc_middle/src/mir/interpret/queries.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ impl<'tcx> TyCtxt<'tcx> {
9595
// used generic parameters is a bug of evaluation, so checking for it
9696
// here does feel somewhat sensible.
9797
if !self.features().generic_const_exprs && ct.substs.has_non_region_param() {
98-
assert!(matches!(self.def_kind(ct.def), DefKind::AnonConst));
98+
assert!(matches!(
99+
self.def_kind(ct.def),
100+
DefKind::InlineConst | DefKind::AnonConst
101+
));
99102
let mir_body = self.mir_for_ctfe(ct.def);
100103
if mir_body.is_polymorphic {
101104
let Some(local_def_id) = ct.def.as_local() else { return };

tests/ui/match/issue-112438.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// run-pass
2+
#![feature(inline_const_pat)]
3+
#![allow(dead_code)]
4+
#![allow(incomplete_features)]
5+
fn foo<const V: usize>() {
6+
match 0 {
7+
const { 1 << 5 } | _ => {}
8+
}
9+
}
10+
11+
fn main() {}

0 commit comments

Comments
 (0)