Skip to content

Commit f4d7d09

Browse files
committed
Disable drop range analysis
The previous PR, rust-lang#93165, still performed the drop range analysis despite ignoring the results. Unfortunately, there were ICEs in the analysis as well, so some packages failed to build (see the issue rust-lang#93197 for an example). This change further disables the analysis and just provides dummy results in that case.
1 parent 51126be commit f4d7d09

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

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

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,27 @@ pub fn compute_drop_ranges<'a, 'tcx>(
3737
def_id: DefId,
3838
body: &'tcx Body<'tcx>,
3939
) -> DropRanges {
40-
let consumed_borrowed_places = find_consumed_and_borrowed(fcx, def_id, body);
40+
if super::ENABLE_DROP_TRACKING {
41+
let consumed_borrowed_places = find_consumed_and_borrowed(fcx, def_id, body);
4142

42-
let num_exprs = fcx.tcx.region_scope_tree(def_id).body_expr_count(body.id()).unwrap_or(0);
43-
let mut drop_ranges = build_control_flow_graph(
44-
fcx.tcx.hir(),
45-
fcx.tcx,
46-
&fcx.typeck_results.borrow(),
47-
consumed_borrowed_places,
48-
body,
49-
num_exprs,
50-
);
43+
let num_exprs = fcx.tcx.region_scope_tree(def_id).body_expr_count(body.id()).unwrap_or(0);
44+
let mut drop_ranges = build_control_flow_graph(
45+
fcx.tcx.hir(),
46+
fcx.tcx,
47+
&fcx.typeck_results.borrow(),
48+
consumed_borrowed_places,
49+
body,
50+
num_exprs,
51+
);
5152

52-
drop_ranges.propagate_to_fixpoint();
53+
drop_ranges.propagate_to_fixpoint();
5354

54-
DropRanges { tracked_value_map: drop_ranges.tracked_value_map, nodes: drop_ranges.nodes }
55+
DropRanges { tracked_value_map: drop_ranges.tracked_value_map, nodes: drop_ranges.nodes }
56+
} else {
57+
// If drop range tracking is not enabled, skip all the analysis and produce an
58+
// empty set of DropRanges.
59+
DropRanges { tracked_value_map: FxHashMap::default(), nodes: IndexVec::new() }
60+
}
5561
}
5662

5763
/// Applies `f` to consumable node in the HIR subtree pointed to by `place`.

0 commit comments

Comments
 (0)