From 858d3362095851bde4f9cc3c132542f2ce9e9a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Fri, 23 Feb 2024 06:47:09 +0100 Subject: [PATCH] Slightly simplify feeding of assoc const eq bounds --- compiler/rustc_hir_analysis/src/astconv/bounds.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/astconv/bounds.rs b/compiler/rustc_hir_analysis/src/astconv/bounds.rs index 117df5482e6..c72096ea465 100644 --- a/compiler/rustc_hir_analysis/src/astconv/bounds.rs +++ b/compiler/rustc_hir_analysis/src/astconv/bounds.rs @@ -433,12 +433,10 @@ pub(super) fn add_predicates_for_ast_type_binding( }); // Provide the resolved type of the associated constant to `type_of(AnonConst)`. - if !speculative && let ty::AssocKind::Const = assoc_kind { - let hir::TypeBindingKind::Equality { term: hir::Term::Const(anon_const) } = + if !speculative + && let hir::TypeBindingKind::Equality { term: hir::Term::Const(anon_const) } = binding.kind - else { - bug!() - }; + { let ty = alias_ty.map_bound(|ty| tcx.type_of(ty.def_id).instantiate(tcx, ty.args)); // Since the arguments passed to the alias type above may contain early-bound // generic parameters, the instantiated type may contain some as well.