Skip to content

Commit 00a0e86

Browse files
committed
Add debug logging in hir_typeck::upvar
This aims to make each major part responsible for modifying the precision be visible in the logs.
1 parent af3aaba commit 00a0e86

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_hir_typeck/src/upvar.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
761761
/// ],
762762
/// }
763763
/// ```
764+
#[instrument(level = "debug", skip(self))]
764765
fn compute_min_captures(
765766
&self,
766767
closure_def_id: LocalDefId,
@@ -2028,6 +2029,7 @@ struct InferBorrowKind<'tcx> {
20282029
}
20292030

20302031
impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
2032+
#[instrument(skip(self), level = "debug")]
20312033
fn fake_read(
20322034
&mut self,
20332035
place_with_id: &PlaceWithHirId<'tcx>,
@@ -2118,6 +2120,7 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
21182120
}
21192121

21202122
/// Rust doesn't permit moving fields out of a type that implements drop
2123+
#[instrument(skip(fcx), ret, level = "debug")]
21212124
fn restrict_precision_for_drop_types<'a, 'tcx>(
21222125
fcx: &'a FnCtxt<'a, 'tcx>,
21232126
mut place: Place<'tcx>,
@@ -2177,6 +2180,7 @@ fn restrict_precision_for_unsafe(
21772180
/// - No Index projections are captured, since arrays are captured completely.
21782181
/// - No unsafe block is required to capture `place`
21792182
/// Returns the truncated place and updated capture mode.
2183+
#[instrument(ret, level = "debug")]
21802184
fn restrict_capture_precision(
21812185
place: Place<'_>,
21822186
curr_mode: ty::UpvarCapture,
@@ -2205,6 +2209,7 @@ fn restrict_capture_precision(
22052209
}
22062210

22072211
/// Truncate deref of any reference.
2212+
#[instrument(ret, level = "debug")]
22082213
fn adjust_for_move_closure(
22092214
mut place: Place<'_>,
22102215
mut kind: ty::UpvarCapture,
@@ -2219,6 +2224,7 @@ fn adjust_for_move_closure(
22192224
}
22202225

22212226
/// Truncate deref of any reference.
2227+
#[instrument(ret, level = "debug")]
22222228
fn adjust_for_use_closure(
22232229
mut place: Place<'_>,
22242230
mut kind: ty::UpvarCapture,
@@ -2234,6 +2240,7 @@ fn adjust_for_use_closure(
22342240

22352241
/// Adjust closure capture just that if taking ownership of data, only move data
22362242
/// from enclosing stack frame.
2243+
#[instrument(ret, level = "debug")]
22372244
fn adjust_for_non_move_closure(
22382245
mut place: Place<'_>,
22392246
mut kind: ty::UpvarCapture,
@@ -2557,6 +2564,7 @@ fn determine_place_ancestry_relation<'tcx>(
25572564
/// // it is constrained to `'a`
25582565
/// }
25592566
/// ```
2567+
#[instrument(ret, level = "debug")]
25602568
fn truncate_capture_for_optimization(
25612569
mut place: Place<'_>,
25622570
mut curr_mode: ty::UpvarCapture,

0 commit comments

Comments
 (0)