Skip to content

Commit 9e27c6c

Browse files
committed
Some tracing/instrument cleanups
1 parent 0c13565 commit 9e27c6c

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

compiler/rustc_middle/src/ty/mod.rs

+2-21
Original file line numberDiff line numberDiff line change
@@ -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
}

compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub struct FutureCompatOverlapError<'tcx> {
2121
}
2222

2323
/// The result of attempting to insert an impl into a group of children.
24+
#[derive(Debug)]
2425
enum Inserted<'tcx> {
2526
/// The impl was inserted as a new child in this group of children.
2627
BecameNewSibling(Option<FutureCompatOverlapError<'tcx>>),
@@ -82,6 +83,7 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
8283

8384
/// Attempt to insert an impl into this set of children, while comparing for
8485
/// specialization relationships.
86+
#[instrument(level = "debug", skip(self, tcx), ret)]
8587
fn insert(
8688
&mut self,
8789
tcx: TyCtxt<'tcx>,
@@ -92,18 +94,13 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
9294
let mut last_lint = None;
9395
let mut replace_children = Vec::new();
9496

95-
debug!("insert(impl_def_id={:?}, simplified_self={:?})", impl_def_id, simplified_self,);
96-
9797
let possible_siblings = match simplified_self {
9898
Some(st) => PotentialSiblings::Filtered(filtered_children(self, st)),
9999
None => PotentialSiblings::Unfiltered(iter_children(self)),
100100
};
101101

102102
for possible_sibling in possible_siblings {
103-
debug!(
104-
"insert: impl_def_id={:?}, simplified_self={:?}, possible_sibling={:?}",
105-
impl_def_id, simplified_self, possible_sibling,
106-
);
103+
debug!(?possible_sibling);
107104

108105
let create_overlap_error = |overlap: traits::coherence::OverlapResult<'tcx>| {
109106
let trait_ref = overlap.impl_header.trait_ref.unwrap();

0 commit comments

Comments
 (0)