Skip to content

Commit fe9c5e6

Browse files
committed
Reorganize uses
1 parent b63cb6f commit fe9c5e6

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

Diff for: compiler/rustc_hir_typeck/src/fallback.rs

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
use std::cell::OnceCell;
22

3-
use crate::{errors, FnCtxt};
3+
use crate::{errors, FnCtxt, TypeckRootCtxt};
44
use rustc_data_structures::{
55
graph::{self, iterate::DepthFirstSearch, vec_graph::VecGraph},
66
unord::{UnordBag, UnordMap, UnordSet},
77
};
8+
use rustc_hir as hir;
9+
use rustc_hir::intravisit::Visitor;
810
use rustc_hir::HirId;
911
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};
1113
use rustc_session::lint;
12-
use rustc_span::Span;
1314
use rustc_span::DUMMY_SP;
15+
use rustc_span::{def_id::LocalDefId, Span};
1416

1517
#[derive(Copy, Clone)]
1618
pub enum DivergingFallbackBehavior {
@@ -508,23 +510,20 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
508510
///
509511
/// Will return `{ id(?X) -> (hir_id, span) }`
510512
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,
513515
) -> UnordMap<ty::TyVid, (HirId, Span)> {
514-
use rustc_hir as hir;
515-
516516
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");
518518
let body = tcx.hir().body(body_id);
519-
let mut res = <_>::default();
519+
let mut res = UnordMap::default();
520520

521521
struct UnsafeInferVarsVisitor<'a, 'tcx, 'r> {
522-
root_ctxt: &'a crate::TypeckRootCtxt<'tcx>,
522+
root_ctxt: &'a TypeckRootCtxt<'tcx>,
523523
res: &'r mut UnordMap<ty::TyVid, (HirId, Span)>,
524524
}
525525

526-
use hir::intravisit::Visitor;
527-
impl hir::intravisit::Visitor<'_> for UnsafeInferVarsVisitor<'_, '_, '_> {
526+
impl Visitor<'_> for UnsafeInferVarsVisitor<'_, '_, '_> {
528527
fn visit_expr(&mut self, ex: &'_ hir::Expr<'_>) {
529528
// FIXME: method calls
530529
if let hir::ExprKind::Call(func, ..) = ex.kind {
@@ -566,7 +565,6 @@ fn compute_unsafe_infer_vars<'a, 'tcx>(
566565
if let Some(vid) = t.ty_vid() {
567566
self.res.insert(vid, (self.hir_id, self.call_span));
568567
} else {
569-
use ty::TypeSuperVisitable as _;
570568
t.super_visit_with(self)
571569
}
572570
}

0 commit comments

Comments
 (0)