From ab0e8b314507cdda07a54f8b8de6a7a6a68e6ce4 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Sat, 10 Feb 2024 22:06:58 +0000 Subject: [PATCH] Eagerly dismiss binder --- compiler/rustc_middle/src/ty/mod.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 574ca0ee7eb..a45cd9aa396 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1590,13 +1590,11 @@ pub fn impls_are_allowed_to_overlap( def_id1: DefId, def_id2: DefId, ) -> Option { - let impl_trait_ref1 = self.impl_trait_ref(def_id1).unwrap(); - let impl_trait_ref2 = self.impl_trait_ref(def_id2).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().instantiate_identity(); // If either trait impl references an error, they're allowed to overlap, // as one of them essentially doesn't exist. - if impl_trait_ref1.instantiate_identity().references_error() - || impl_trait_ref2.instantiate_identity().references_error() - { + if impl_trait_ref1.references_error() || impl_trait_ref2.references_error() { return Some(ImplOverlapKind::Permitted { marker: false }); } @@ -1615,9 +1613,8 @@ pub fn impls_are_allowed_to_overlap( }; let is_marker_overlap = { - let is_marker_impl = |trait_ref: EarlyBinder>| -> bool { - self.trait_def(trait_ref.skip_binder().def_id).is_marker - }; + let is_marker_impl = + |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) };