|
1 | 1 | use std::cell::OnceCell;
|
2 | 2 |
|
3 |
| -use crate::{errors, FnCtxt}; |
| 3 | +use crate::{errors, FnCtxt, TypeckRootCtxt}; |
4 | 4 | use rustc_data_structures::{
|
5 | 5 | graph::{self, iterate::DepthFirstSearch, vec_graph::VecGraph},
|
6 | 6 | unord::{UnordBag, UnordMap, UnordSet},
|
7 | 7 | };
|
| 8 | +use rustc_hir as hir; |
| 9 | +use rustc_hir::intravisit::Visitor; |
8 | 10 | use rustc_hir::HirId;
|
9 | 11 | use rustc_infer::infer::{DefineOpaqueTypes, InferOk};
|
10 |
| -use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitable}; |
| 12 | +use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable}; |
11 | 13 | use rustc_session::lint;
|
12 |
| -use rustc_span::Span; |
13 | 14 | use rustc_span::DUMMY_SP;
|
| 15 | +use rustc_span::{def_id::LocalDefId, Span}; |
14 | 16 |
|
15 | 17 | #[derive(Copy, Clone)]
|
16 | 18 | pub enum DivergingFallbackBehavior {
|
@@ -508,23 +510,20 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
|
508 | 510 | ///
|
509 | 511 | /// Will return `{ id(?X) -> (hir_id, span) }`
|
510 | 512 | fn compute_unsafe_infer_vars<'a, 'tcx>(
|
511 |
| - root_ctxt: &'a crate::TypeckRootCtxt<'tcx>, |
512 |
| - body_id: rustc_span::def_id::LocalDefId, |
| 513 | + root_ctxt: &'a TypeckRootCtxt<'tcx>, |
| 514 | + body_id: LocalDefId, |
513 | 515 | ) -> UnordMap<ty::TyVid, (HirId, Span)> {
|
514 |
| - use rustc_hir as hir; |
515 |
| - |
516 | 516 | let tcx = root_ctxt.infcx.tcx;
|
517 |
| - let body_id = tcx.hir().maybe_body_owned_by(body_id).unwrap(); |
| 517 | + let body_id = tcx.hir().maybe_body_owned_by(body_id).expect("body id must have an owner"); |
518 | 518 | let body = tcx.hir().body(body_id);
|
519 |
| - let mut res = <_>::default(); |
| 519 | + let mut res = UnordMap::default(); |
520 | 520 |
|
521 | 521 | struct UnsafeInferVarsVisitor<'a, 'tcx, 'r> {
|
522 |
| - root_ctxt: &'a crate::TypeckRootCtxt<'tcx>, |
| 522 | + root_ctxt: &'a TypeckRootCtxt<'tcx>, |
523 | 523 | res: &'r mut UnordMap<ty::TyVid, (HirId, Span)>,
|
524 | 524 | }
|
525 | 525 |
|
526 |
| - use hir::intravisit::Visitor; |
527 |
| - impl hir::intravisit::Visitor<'_> for UnsafeInferVarsVisitor<'_, '_, '_> { |
| 526 | + impl Visitor<'_> for UnsafeInferVarsVisitor<'_, '_, '_> { |
528 | 527 | fn visit_expr(&mut self, ex: &'_ hir::Expr<'_>) {
|
529 | 528 | // FIXME: method calls
|
530 | 529 | if let hir::ExprKind::Call(func, ..) = ex.kind {
|
@@ -566,7 +565,6 @@ fn compute_unsafe_infer_vars<'a, 'tcx>(
|
566 | 565 | if let Some(vid) = t.ty_vid() {
|
567 | 566 | self.res.insert(vid, (self.hir_id, self.call_span));
|
568 | 567 | } else {
|
569 |
| - use ty::TypeSuperVisitable as _; |
570 | 568 | t.super_visit_with(self)
|
571 | 569 | }
|
572 | 570 | }
|
|
0 commit comments