@@ -2279,6 +2279,7 @@ impl<'tcx> TyCtxt<'tcx> {
22792279
22802280 /// Returns `true` if the impls are the same polarity and the trait either
22812281 /// has no items or is annotated `#[marker]` and prevents item overrides.
2282+ #[instrument(level = "debug", skip(self), ret)]
22822283 pub fn impls_are_allowed_to_overlap(
22832284 self,
22842285 def_id1: DefId,
@@ -2297,19 +2298,11 @@ impl<'tcx> TyCtxt<'tcx> {
22972298 match (self.impl_polarity(def_id1), self.impl_polarity(def_id2)) {
22982299 (ImplPolarity::Reservation, _) | (_, ImplPolarity::Reservation) => {
22992300 // `#[rustc_reservation_impl]` impls don't overlap with anything
2300- debug!(
2301- "impls_are_allowed_to_overlap({:?}, {:?}) = Some(Permitted) (reservations)",
2302- def_id1, def_id2
2303- );
23042301 return Some(ImplOverlapKind::Permitted { marker: false });
23052302 }
23062303 (ImplPolarity::Positive, ImplPolarity::Negative)
23072304 | (ImplPolarity::Negative, ImplPolarity::Positive) => {
23082305 // `impl AutoTrait for Type` + `impl !AutoTrait for Type`
2309- debug!(
2310- "impls_are_allowed_to_overlap({:?}, {:?}) - None (differing polarities)",
2311- def_id1, def_id2
2312- );
23132306 return None;
23142307 }
23152308 (ImplPolarity::Positive, ImplPolarity::Positive)
@@ -2324,30 +2317,18 @@ impl<'tcx> TyCtxt<'tcx> {
23242317 };
23252318
23262319 if is_marker_overlap {
2327- debug!(
2328- "impls_are_allowed_to_overlap({:?}, {:?}) = Some(Permitted) (marker overlap)",
2329- def_id1, def_id2
2330- );
23312320 Some(ImplOverlapKind::Permitted { marker: true })
23322321 } else {
23332322 if let Some(self_ty1) = self.issue33140_self_ty(def_id1) {
23342323 if let Some(self_ty2) = self.issue33140_self_ty(def_id2) {
23352324 if self_ty1 == self_ty2 {
2336- debug!(
2337- "impls_are_allowed_to_overlap({:?}, {:?}) - issue #33140 HACK",
2338- def_id1, def_id2
2339- );
23402325 return Some(ImplOverlapKind::Issue33140);
23412326 } else {
2342- debug!(
2343- "impls_are_allowed_to_overlap({:?}, {:?}) - found {:?} != {:?}",
2344- def_id1, def_id2, self_ty1, self_ty2
2345- );
2327+ debug!("found {self_ty1:?} != {self_ty2:?}");
23462328 }
23472329 }
23482330 }
23492331
2350- debug!("impls_are_allowed_to_overlap({:?}, {:?}) = None", def_id1, def_id2);
23512332 None
23522333 }
23532334 }
0 commit comments