Skip to content

Commit 2b16835

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 2d6503c commit 2b16835

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>,
@@ -2180,6 +2183,7 @@ fn restrict_precision_for_unsafe(
21802183
/// - No unsafe block is required to capture `place`.
21812184
///
21822185
/// Returns the truncated place and updated capture mode.
2186+
#[instrument(ret, level = "debug")]
21832187
fn restrict_capture_precision(
21842188
place: Place<'_>,
21852189
curr_mode: ty::UpvarCapture,
@@ -2209,6 +2213,7 @@ fn restrict_capture_precision(
22092213
}
22102214

22112215
/// Truncate deref of any reference.
2216+
#[instrument(ret, level = "debug")]
22122217
fn adjust_for_move_closure(
22132218
mut place: Place<'_>,
22142219
mut kind: ty::UpvarCapture,
@@ -2223,6 +2228,7 @@ fn adjust_for_move_closure(
22232228
}
22242229

22252230
/// Truncate deref of any reference.
2231+
#[instrument(ret, level = "debug")]
22262232
fn adjust_for_use_closure(
22272233
mut place: Place<'_>,
22282234
mut kind: ty::UpvarCapture,
@@ -2238,6 +2244,7 @@ fn adjust_for_use_closure(
22382244

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

0 commit comments

Comments
 (0)