Slightly simplify feeding of assoc const eq bounds

This commit is contained in:
León Orell Valerian Liehr 2024-02-23 06:47:09 +01:00
parent b94498a378
commit 858d336209
No known key found for this signature in database
GPG Key ID: D17A07215F68E713

View File

@ -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.