Skip to content

Commit 9308401

Browse files
committed
tracing: debug to trace
1 parent e87157b commit 9308401

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

compiler/rustc_type_ir/src/binder.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use derive_where::derive_where;
88
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
99
#[cfg(feature = "nightly")]
1010
use rustc_serialize::Decodable;
11-
use tracing::debug;
11+
use tracing::instrument;
1212

1313
use crate::data_structures::SsoHashSet;
1414
use crate::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
@@ -831,28 +831,20 @@ impl<'a, I: Interner> ArgFolder<'a, I> {
831831
/// As indicated in the diagram, here the same type `&'a i32` is instantiated once, but in the
832832
/// first case we do not increase the De Bruijn index and in the second case we do. The reason
833833
/// is that only in the second case have we passed through a fn binder.
834+
#[instrument(level = "trace", skip(self), fields(binders_passed = self.binders_passed), ret)]
834835
fn shift_vars_through_binders<T: TypeFoldable<I>>(&self, val: T) -> T {
835-
debug!(
836-
"shift_vars(val={:?}, binders_passed={:?}, has_escaping_bound_vars={:?})",
837-
val,
838-
self.binders_passed,
839-
val.has_escaping_bound_vars()
840-
);
841-
842836
if self.binders_passed == 0 || !val.has_escaping_bound_vars() {
843-
return val;
837+
val
838+
} else {
839+
ty::fold::shift_vars(self.cx, val, self.binders_passed)
844840
}
845-
846-
let result = ty::fold::shift_vars(TypeFolder::cx(self), val, self.binders_passed);
847-
debug!("shift_vars: shifted result = {:?}", result);
848-
849-
result
850841
}
851842

852843
fn shift_region_through_binders(&self, region: I::Region) -> I::Region {
853844
if self.binders_passed == 0 || !region.has_escaping_bound_vars() {
854-
return region;
845+
region
846+
} else {
847+
ty::fold::shift_region(self.cx, region, self.binders_passed)
855848
}
856-
ty::fold::shift_region(self.cx, region, self.binders_passed)
857849
}
858850
}

compiler/rustc_type_ir/src/fold.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
use std::mem;
4949

5050
use rustc_index::{Idx, IndexVec};
51-
use tracing::debug;
51+
use tracing::instrument;
5252

5353
use crate::data_structures::Lrc;
5454
use crate::inherent::*;
@@ -417,15 +417,14 @@ pub fn shift_region<I: Interner>(cx: I, region: I::Region, amount: u32) -> I::Re
417417
}
418418
}
419419

420+
#[instrument(level = "trace", skip(cx), ret)]
420421
pub fn shift_vars<I: Interner, T>(cx: I, value: T, amount: u32) -> T
421422
where
422423
T: TypeFoldable<I>,
423424
{
424-
debug!("shift_vars(value={:?}, amount={})", value, amount);
425-
426425
if amount == 0 || !value.has_escaping_bound_vars() {
427-
return value;
426+
value
427+
} else {
428+
value.fold_with(&mut Shifter::new(cx, amount))
428429
}
429-
430-
value.fold_with(&mut Shifter::new(cx, amount))
431430
}

0 commit comments

Comments
 (0)