Skip to content

Commit ebeb2ff

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 1f2cfbb commit ebeb2ff

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,
@@ -2030,6 +2031,7 @@ struct InferBorrowKind<'tcx> {
20302031
}
20312032

20322033
impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
2034+
#[instrument(skip(self), level = "debug")]
20332035
fn fake_read(
20342036
&mut self,
20352037
place_with_id: &PlaceWithHirId<'tcx>,
@@ -2120,6 +2122,7 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
21202122
}
21212123

21222124
/// Rust doesn't permit moving fields out of a type that implements drop
2125+
#[instrument(skip(fcx), ret, level = "debug")]
21232126
fn restrict_precision_for_drop_types<'a, 'tcx>(
21242127
fcx: &'a FnCtxt<'a, 'tcx>,
21252128
mut place: Place<'tcx>,
@@ -2179,6 +2182,7 @@ fn restrict_precision_for_unsafe(
21792182
/// - No Index projections are captured, since arrays are captured completely.
21802183
/// - No unsafe block is required to capture `place`
21812184
/// Returns the truncated place and updated capture mode.
2185+
#[instrument(ret, level = "debug")]
21822186
fn restrict_capture_precision(
21832187
place: Place<'_>,
21842188
curr_mode: ty::UpvarCapture,
@@ -2208,6 +2212,7 @@ fn restrict_capture_precision(
22082212
}
22092213

22102214
/// Truncate deref of any reference.
2215+
#[instrument(ret, level = "debug")]
22112216
fn adjust_for_move_closure(
22122217
mut place: Place<'_>,
22132218
mut kind: ty::UpvarCapture,
@@ -2222,6 +2227,7 @@ fn adjust_for_move_closure(
22222227
}
22232228

22242229
/// Truncate deref of any reference.
2230+
#[instrument(ret, level = "debug")]
22252231
fn adjust_for_use_closure(
22262232
mut place: Place<'_>,
22272233
mut kind: ty::UpvarCapture,
@@ -2237,6 +2243,7 @@ fn adjust_for_use_closure(
22372243

22382244
/// Adjust closure capture just that if taking ownership of data, only move data
22392245
/// from enclosing stack frame.
2246+
#[instrument(ret, level = "debug")]
22402247
fn adjust_for_non_move_closure(
22412248
mut place: Place<'_>,
22422249
mut kind: ty::UpvarCapture,
@@ -2561,6 +2568,7 @@ fn determine_place_ancestry_relation<'tcx>(
25612568
/// // it is constrained to `'a`
25622569
/// }
25632570
/// ```
2571+
#[instrument(ret, level = "debug")]
25642572
fn truncate_capture_for_optimization(
25652573
mut place: Place<'_>,
25662574
mut curr_mode: ty::UpvarCapture,

0 commit comments

Comments
 (0)