tracing: make flag checking less noisy

This commit is contained in:
Oli Scherer 2022-10-11 11:05:41 +00:00
parent b2b859be8c
commit fedcc739c6

View File

@ -88,9 +88,11 @@ fn has_escaping_bound_vars(&self) -> bool {
self.has_vars_bound_at_or_above(ty::INNERMOST) self.has_vars_bound_at_or_above(ty::INNERMOST)
} }
#[instrument(level = "trace", ret)]
fn has_type_flags(&self, flags: TypeFlags) -> bool { fn has_type_flags(&self, flags: TypeFlags) -> bool {
self.visit_with(&mut HasTypeFlagsVisitor { flags }).break_value() == Some(FoundFlags) let res =
self.visit_with(&mut HasTypeFlagsVisitor { flags }).break_value() == Some(FoundFlags);
trace!(?self, ?flags, ?res, "has_type_flags");
res
} }
fn has_projections(&self) -> bool { fn has_projections(&self) -> bool {
self.has_type_flags(TypeFlags::HAS_PROJECTION) self.has_type_flags(TypeFlags::HAS_PROJECTION)
@ -560,10 +562,8 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
type BreakTy = FoundFlags; type BreakTy = FoundFlags;
#[inline] #[inline]
#[instrument(skip(self), level = "trace", ret)]
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> { fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
let flags = t.flags(); let flags = t.flags();
trace!(t.flags=?t.flags());
if flags.intersects(self.flags) { if flags.intersects(self.flags) {
ControlFlow::Break(FoundFlags) ControlFlow::Break(FoundFlags)
} else { } else {
@ -572,10 +572,8 @@ fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
} }
#[inline] #[inline]
#[instrument(skip(self), level = "trace", ret)]
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> { fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
let flags = r.type_flags(); let flags = r.type_flags();
trace!(r.flags=?flags);
if flags.intersects(self.flags) { if flags.intersects(self.flags) {
ControlFlow::Break(FoundFlags) ControlFlow::Break(FoundFlags)
} else { } else {
@ -584,7 +582,6 @@ fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
} }
#[inline] #[inline]
#[instrument(level = "trace", ret)]
fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> { fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
let flags = FlagComputation::for_const(c); let flags = FlagComputation::for_const(c);
trace!(r.flags=?flags); trace!(r.flags=?flags);
@ -596,14 +593,7 @@ fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
} }
#[inline] #[inline]
#[instrument(level = "trace", ret)]
fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> ControlFlow<Self::BreakTy> { fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> ControlFlow<Self::BreakTy> {
debug!(
"HasTypeFlagsVisitor: predicate={:?} predicate.flags={:?} self.flags={:?}",
predicate,
predicate.flags(),
self.flags
);
if predicate.flags().intersects(self.flags) { if predicate.flags().intersects(self.flags) {
ControlFlow::Break(FoundFlags) ControlFlow::Break(FoundFlags)
} else { } else {