mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Rollup merge of #112634 - mj10021:issue-112438-fix, r=compiler-errors
add InlineConst check add check to close #112438
This commit is contained in:
commit
c0a089e118
@ -95,7 +95,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
// used generic parameters is a bug of evaluation, so checking for it
|
||||
// here does feel somewhat sensible.
|
||||
if !self.features().generic_const_exprs && ct.substs.has_non_region_param() {
|
||||
assert!(matches!(self.def_kind(ct.def), DefKind::AnonConst));
|
||||
assert!(matches!(
|
||||
self.def_kind(ct.def),
|
||||
DefKind::InlineConst | DefKind::AnonConst
|
||||
));
|
||||
let mir_body = self.mir_for_ctfe(ct.def);
|
||||
if mir_body.is_polymorphic {
|
||||
let Some(local_def_id) = ct.def.as_local() else { return };
|
||||
|
11
tests/ui/match/issue-112438.rs
Normal file
11
tests/ui/match/issue-112438.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// run-pass
|
||||
#![feature(inline_const_pat)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(incomplete_features)]
|
||||
fn foo<const V: usize>() {
|
||||
match 0 {
|
||||
const { 1 << 5 } | _ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user