Skip to content

Commit 943c242

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 f4a432e commit 943c242

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

20312032
impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
2033+
#[instrument(skip(self), level = "debug")]
20322034
fn fake_read(
20332035
&mut self,
20342036
place_with_id: &PlaceWithHirId<'tcx>,
@@ -2119,6 +2121,7 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
21192121
}
21202122

21212123
/// Rust doesn't permit moving fields out of a type that implements drop
2124+
#[instrument(skip(fcx), ret, level = "debug")]
21222125
fn restrict_precision_for_drop_types<'a, 'tcx>(
21232126
fcx: &'a FnCtxt<'a, 'tcx>,
21242127
mut place: Place<'tcx>,
@@ -2179,6 +2182,7 @@ fn restrict_precision_for_unsafe(
21792182
/// - No unsafe block is required to capture `place`.
21802183
///
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,
@@ -2559,6 +2566,7 @@ fn determine_place_ancestry_relation<'tcx>(
25592566
/// // it is constrained to `'a`
25602567
/// }
25612568
/// ```
2569+
#[instrument(ret, level = "debug")]
25622570
fn truncate_capture_for_optimization(
25632571
mut place: Place<'_>,
25642572
mut curr_mode: ty::UpvarCapture,

0 commit comments

Comments
 (0)