1
Fork 0

Apply EarlyBinder only to TraitRef in ImplTraitHeader

This commit is contained in:
Yoshitomo Nakanishi 2024-03-05 20:19:05 +01:00
parent 8c9a75b323
commit 9669934798
22 changed files with 74 additions and 82 deletions

View file

@ -1519,10 +1519,7 @@ fn suggest_impl_trait<'tcx>(
None
}
fn impl_trait_header(
tcx: TyCtxt<'_>,
def_id: LocalDefId,
) -> Option<ty::EarlyBinder<ty::ImplTraitHeader<'_>>> {
fn impl_trait_header(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::ImplTraitHeader<'_>> {
let icx = ItemCtxt::new(tcx, def_id);
let item = tcx.hir().expect_item(def_id);
let impl_ = item.expect_impl();
@ -1558,11 +1555,11 @@ fn impl_trait_header(
} else {
icx.astconv().instantiate_mono_trait_ref(ast_trait_ref, selfty)
};
ty::EarlyBinder::bind(ty::ImplTraitHeader {
trait_ref,
ty::ImplTraitHeader {
trait_ref: ty::EarlyBinder::bind(trait_ref),
unsafety: impl_.unsafety,
polarity: polarity_of_impl(tcx, def_id, impl_, item.span)
})
}
})
}