Skip to content

Commit 2918584

Browse files
tmiaskoeholk
authored andcommitted
Add a flag enabling drop range tracking in generators
1 parent f52c318 commit 2918584

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

compiler/rustc_interface/src/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ fn test_debugging_options_tracking_hash() {
730730
tracked!(debug_info_for_profiling, true);
731731
tracked!(debug_macros, true);
732732
tracked!(dep_info_omit_d_target, true);
733+
tracked!(drop_tracking, true);
733734
tracked!(dual_proc_macros, true);
734735
tracked!(fewer_names, Some(true));
735736
tracked!(force_unstable_if_unmarked, true);

compiler/rustc_session/src/options.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,8 @@ options! {
11731173
dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED],
11741174
"emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) \
11751175
(default: no)"),
1176+
drop_tracking: bool = (false, parse_bool, [TRACKED],
1177+
"enables drop tracking in generators (default: no)"),
11761178
dual_proc_macros: bool = (false, parse_bool, [TRACKED],
11771179
"load proc macros for both target and host, but only link to the target (default: no)"),
11781180
dump_dep_graph: bool = (false, parse_bool, [UNTRACKED],

compiler/rustc_typeck/src/check/generator_interior.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ use tracing::debug;
2222

2323
mod drop_ranges;
2424

25-
// FIXME(eholk): This flag is here to give a quick way to disable drop tracking in case we find
26-
// unexpected breakages while it's still new. It should be removed before too long. For example,
27-
// see #93161.
28-
const ENABLE_DROP_TRACKING: bool = false;
29-
3025
struct InteriorVisitor<'a, 'tcx> {
3126
fcx: &'a FnCtxt<'a, 'tcx>,
3227
types: FxIndexSet<ty::GeneratorInteriorTypeCause<'tcx>>,
@@ -82,7 +77,7 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
8277
yield_data.expr_and_pat_count, self.expr_count, source_span
8378
);
8479

85-
if ENABLE_DROP_TRACKING
80+
if self.fcx.sess().opts.debugging_opts.drop_tracking
8681
&& self
8782
.drop_ranges
8883
.is_dropped_at(hir_id, yield_data.expr_and_pat_count)

compiler/rustc_typeck/src/check/generator_interior/drop_ranges.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn compute_drop_ranges<'a, 'tcx>(
3737
def_id: DefId,
3838
body: &'tcx Body<'tcx>,
3939
) -> DropRanges {
40-
if super::ENABLE_DROP_TRACKING {
40+
if fcx.sess().opts.debugging_opts.drop_tracking {
4141
let consumed_borrowed_places = find_consumed_and_borrowed(fcx, def_id, body);
4242

4343
let num_exprs = fcx.tcx.region_scope_tree(def_id).body_expr_count(body.id()).unwrap_or(0);

0 commit comments

Comments
 (0)