Skip to content

Commit 8b5a96e

Browse files
committed
Some tracing cleanups
1 parent 8a746f4 commit 8b5a96e

File tree

2 files changed

+5
-8
lines changed
  • compiler
    • rustc_borrowck/src/type_check
    • rustc_middle/src/mir

2 files changed

+5
-8
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11531153
category: ConstraintCategory<'tcx>,
11541154
) -> Fallible<()> {
11551155
let annotated_type = self.user_type_annotations[user_ty.base].inferred_ty;
1156+
trace!(?annotated_type);
11561157
let mut curr_projected_ty = PlaceTy::from_ty(annotated_type);
11571158

11581159
let tcx = self.infcx.tcx;
@@ -1170,10 +1171,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11701171
);
11711172
curr_projected_ty = projected_ty;
11721173
}
1173-
debug!(
1174-
"user_ty base: {:?} freshened: {:?} projs: {:?} yields: {:?}",
1175-
user_ty.base, annotated_type, user_ty.projs, curr_projected_ty
1176-
);
1174+
trace!(?curr_projected_ty);
11771175

11781176
let ty = curr_projected_ty.ty;
11791177
self.relate_types(ty, v.xform(ty::Variance::Contravariant), a, locations, category)?;

compiler/rustc_middle/src/mir/tcx.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ impl<'tcx> PlaceTy<'tcx> {
3232
/// not carry a `Ty` for `T`.)
3333
///
3434
/// Note that the resulting type has not been normalized.
35+
#[instrument(level = "debug", skip(tcx), ret)]
3536
pub fn field_ty(self, tcx: TyCtxt<'tcx>, f: Field) -> Ty<'tcx> {
36-
let answer = match self.ty.kind() {
37+
match self.ty.kind() {
3738
ty::Adt(adt_def, substs) => {
3839
let variant_def = match self.variant_index {
3940
None => adt_def.non_enum_variant(),
@@ -47,9 +48,7 @@ impl<'tcx> PlaceTy<'tcx> {
4748
}
4849
ty::Tuple(tys) => tys[f.index()],
4950
_ => bug!("extracting field of non-tuple non-adt: {:?}", self),
50-
};
51-
debug!("field_ty self: {:?} f: {:?} yields: {:?}", self, f, answer);
52-
answer
51+
}
5352
}
5453

5554
/// Convenience wrapper around `projection_ty_core` for

0 commit comments

Comments
 (0)