|
3 | 3 | //! is calculated in `rustc_const_eval::transform::generator` and may be a subset of the
|
4 | 4 | //! types computed here.
|
5 | 5 |
|
6 |
| -use self::drop_ranges::{DropRangeVisitor, DropRanges, ExprUseDelegate}; |
| 6 | +use self::drop_ranges::DropRanges; |
7 | 7 | use super::FnCtxt;
|
8 |
| -use crate::expr_use_visitor::ExprUseVisitor; |
9 | 8 | use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
|
10 | 9 | use rustc_errors::pluralize;
|
11 | 10 | use rustc_hir as hir;
|
@@ -187,42 +186,17 @@ pub fn resolve_interior<'a, 'tcx>(
|
187 | 186 | kind: hir::GeneratorKind,
|
188 | 187 | ) {
|
189 | 188 | let body = fcx.tcx.hir().body(body_id);
|
190 |
| - |
191 |
| - let mut visitor = { |
192 |
| - let mut expr_use_visitor = ExprUseDelegate::new(fcx.tcx.hir()); |
193 |
| - |
194 |
| - // Run ExprUseVisitor to find where values are consumed. |
195 |
| - ExprUseVisitor::new( |
196 |
| - &mut expr_use_visitor, |
197 |
| - &fcx.infcx, |
198 |
| - def_id.expect_local(), |
199 |
| - fcx.param_env, |
200 |
| - &fcx.typeck_results.borrow(), |
201 |
| - ) |
202 |
| - .consume_body(body); |
203 |
| - |
204 |
| - let region_scope_tree = fcx.tcx.region_scope_tree(def_id); |
205 |
| - let mut drop_range_visitor = DropRangeVisitor::from_uses( |
206 |
| - expr_use_visitor, |
207 |
| - region_scope_tree.body_expr_count(body.id()).unwrap_or(0), |
208 |
| - ); |
209 |
| - intravisit::walk_body(&mut drop_range_visitor, body); |
210 |
| - |
211 |
| - let mut drop_ranges = drop_range_visitor.into_drop_ranges(); |
212 |
| - drop_ranges.propagate_to_fixpoint(); |
213 |
| - |
214 |
| - InteriorVisitor { |
215 |
| - fcx, |
216 |
| - types: FxIndexSet::default(), |
217 |
| - region_scope_tree, |
218 |
| - expr_count: 0, |
219 |
| - kind, |
220 |
| - prev_unresolved_span: None, |
221 |
| - guard_bindings: <_>::default(), |
222 |
| - guard_bindings_set: <_>::default(), |
223 |
| - linted_values: <_>::default(), |
224 |
| - drop_ranges: drop_ranges, |
225 |
| - } |
| 189 | + let mut visitor = InteriorVisitor { |
| 190 | + fcx, |
| 191 | + types: FxIndexSet::default(), |
| 192 | + region_scope_tree: fcx.tcx.region_scope_tree(def_id), |
| 193 | + expr_count: 0, |
| 194 | + kind, |
| 195 | + prev_unresolved_span: None, |
| 196 | + guard_bindings: <_>::default(), |
| 197 | + guard_bindings_set: <_>::default(), |
| 198 | + linted_values: <_>::default(), |
| 199 | + drop_ranges: drop_ranges::compute_drop_ranges(fcx, def_id, body), |
226 | 200 | };
|
227 | 201 | intravisit::walk_body(&mut visitor, body);
|
228 | 202 |
|
|
0 commit comments