We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ecb2838 commit 30ddd00Copy full SHA for 30ddd00
1 file changed
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
@@ -511,15 +511,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
511
let anon_const_def_id = match tcx.def_kind(parent_def_id) {
512
DefKind::AnonConst => parent_def_id,
513
DefKind::InlineConst | DefKind::Closure => {
514
- let mut current = tcx.local_parent(parent_def_id);
515
- loop {
516
- match tcx.def_kind(current) {
517
- DefKind::AnonConst => break current,
518
- DefKind::InlineConst | DefKind::Closure => {
519
- current = tcx.local_parent(current);
520
- }
521
- _ => return None,
522
+ let root = tcx.typeck_root_def_id(parent_def_id.into());
+ match tcx.def_kind(root) {
+ DefKind::AnonConst => root.expect_local(),
+ _ => return None,
523
}
524
525
_ => return None,
0 commit comments