tracing: debug to trace

This commit is contained in:
lcnr 2024-07-23 14:59:01 +02:00
parent e87157ba2a
commit 9308401df5
2 changed files with 13 additions and 22 deletions

View file

@ -8,7 +8,7 @@ use derive_where::derive_where;
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
#[cfg(feature = "nightly")]
use rustc_serialize::Decodable;
use tracing::debug;
use tracing::instrument;
use crate::data_structures::SsoHashSet;
use crate::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
@ -831,28 +831,20 @@ impl<'a, I: Interner> ArgFolder<'a, I> {
/// As indicated in the diagram, here the same type `&'a i32` is instantiated once, but in the
/// first case we do not increase the De Bruijn index and in the second case we do. The reason
/// is that only in the second case have we passed through a fn binder.
#[instrument(level = "trace", skip(self), fields(binders_passed = self.binders_passed), ret)]
fn shift_vars_through_binders<T: TypeFoldable<I>>(&self, val: T) -> T {
debug!(
"shift_vars(val={:?}, binders_passed={:?}, has_escaping_bound_vars={:?})",
val,
self.binders_passed,
val.has_escaping_bound_vars()
);
if self.binders_passed == 0 || !val.has_escaping_bound_vars() {
return val;
val
} else {
ty::fold::shift_vars(self.cx, val, self.binders_passed)
}
let result = ty::fold::shift_vars(TypeFolder::cx(self), val, self.binders_passed);
debug!("shift_vars: shifted result = {:?}", result);
result
}
fn shift_region_through_binders(&self, region: I::Region) -> I::Region {
if self.binders_passed == 0 || !region.has_escaping_bound_vars() {
return region;
region
} else {
ty::fold::shift_region(self.cx, region, self.binders_passed)
}
ty::fold::shift_region(self.cx, region, self.binders_passed)
}
}

View file

@ -48,7 +48,7 @@
use std::mem;
use rustc_index::{Idx, IndexVec};
use tracing::debug;
use tracing::instrument;
use crate::data_structures::Lrc;
use crate::inherent::*;
@ -417,15 +417,14 @@ pub fn shift_region<I: Interner>(cx: I, region: I::Region, amount: u32) -> I::Re
}
}
#[instrument(level = "trace", skip(cx), ret)]
pub fn shift_vars<I: Interner, T>(cx: I, value: T, amount: u32) -> T
where
T: TypeFoldable<I>,
{
debug!("shift_vars(value={:?}, amount={})", value, amount);
if amount == 0 || !value.has_escaping_bound_vars() {
return value;
value
} else {
value.fold_with(&mut Shifter::new(cx, amount))
}
value.fold_with(&mut Shifter::new(cx, amount))
}