Eagerly dismiss binder

This commit is contained in:
Oli Scherer 2024-02-10 22:06:58 +00:00
parent a9e0e968be
commit ab0e8b3145

View File

@ -1590,13 +1590,11 @@ pub fn impls_are_allowed_to_overlap(
def_id1: DefId, def_id1: DefId,
def_id2: DefId, def_id2: DefId,
) -> Option<ImplOverlapKind> { ) -> Option<ImplOverlapKind> {
let impl_trait_ref1 = self.impl_trait_ref(def_id1).unwrap(); let impl_trait_ref1 = self.impl_trait_ref(def_id1).unwrap().instantiate_identity();
let impl_trait_ref2 = self.impl_trait_ref(def_id2).unwrap(); let impl_trait_ref2 = self.impl_trait_ref(def_id2).unwrap().instantiate_identity();
// If either trait impl references an error, they're allowed to overlap, // If either trait impl references an error, they're allowed to overlap,
// as one of them essentially doesn't exist. // as one of them essentially doesn't exist.
if impl_trait_ref1.instantiate_identity().references_error() if impl_trait_ref1.references_error() || impl_trait_ref2.references_error() {
|| impl_trait_ref2.instantiate_identity().references_error()
{
return Some(ImplOverlapKind::Permitted { marker: false }); return Some(ImplOverlapKind::Permitted { marker: false });
} }
@ -1615,9 +1613,8 @@ pub fn impls_are_allowed_to_overlap(
}; };
let is_marker_overlap = { let is_marker_overlap = {
let is_marker_impl = |trait_ref: EarlyBinder<TraitRef<'_>>| -> bool { let is_marker_impl =
self.trait_def(trait_ref.skip_binder().def_id).is_marker |trait_ref: TraitRef<'_>| -> bool { self.trait_def(trait_ref.def_id).is_marker };
};
is_marker_impl(impl_trait_ref1) && is_marker_impl(impl_trait_ref2) is_marker_impl(impl_trait_ref1) && is_marker_impl(impl_trait_ref2)
}; };