diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 58c8d56b558..7ca2b221f78 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -774,7 +774,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> { f(mc::MemCategorizationContext::new( &self.infcx, self.outlives_environment.param_env, - self.body_owner, + self.body_owner.expect_local(), &self.tables.borrow(), )) } diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 3ff79a6b5de..55802c140bc 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -146,8 +146,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - let body_owner_def_id = self.tcx.hir().body_owner_def_id(body.id()).to_def_id(); - assert_eq!(body_owner_def_id, closure_def_id); + let body_owner_def_id = self.tcx.hir().body_owner_def_id(body.id()); + assert_eq!(body_owner_def_id.to_def_id(), closure_def_id); let mut delegate = InferBorrowKind { fcx: self, closure_def_id, diff --git a/src/librustc_typeck/expr_use_visitor.rs b/src/librustc_typeck/expr_use_visitor.rs index 2244a89f129..cdebd63b594 100644 --- a/src/librustc_typeck/expr_use_visitor.rs +++ b/src/librustc_typeck/expr_use_visitor.rs @@ -9,7 +9,7 @@ pub use mc::{Place, PlaceBase, Projection}; use rustc_hir as hir; use rustc_hir::def::Res; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::LocalDefId; use rustc_hir::PatKind; use rustc_infer::infer::InferCtxt; use rustc_middle::ty::{self, adjustment, TyCtxt}; @@ -84,7 +84,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> { pub fn new( delegate: &'a mut (dyn Delegate<'tcx> + 'a), infcx: &'a InferCtxt<'a, 'tcx>, - body_owner: DefId, + body_owner: LocalDefId, param_env: ty::ParamEnv<'tcx>, tables: &'a ty::TypeckTables<'tcx>, ) -> Self { diff --git a/src/librustc_typeck/mem_categorization.rs b/src/librustc_typeck/mem_categorization.rs index cd1aad267ad..f6edb6b7545 100644 --- a/src/librustc_typeck/mem_categorization.rs +++ b/src/librustc_typeck/mem_categorization.rs @@ -55,7 +55,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_data_structures::fx::FxIndexMap; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::LocalDefId; use rustc_hir::PatKind; use rustc_infer::infer::InferCtxt; use rustc_span::Span; @@ -140,7 +140,7 @@ crate struct MemCategorizationContext<'a, 'tcx> { crate tables: &'a ty::TypeckTables<'tcx>, infcx: &'a InferCtxt<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, - body_owner: DefId, + body_owner: LocalDefId, upvars: Option<&'tcx FxIndexMap>, } @@ -151,7 +151,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { crate fn new( infcx: &'a InferCtxt<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, - body_owner: DefId, + body_owner: LocalDefId, tables: &'a ty::TypeckTables<'tcx>, ) -> MemCategorizationContext<'a, 'tcx> { MemCategorizationContext { @@ -473,7 +473,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { let upvar_id = ty::UpvarId { var_path: ty::UpvarPath { hir_id: var_id }, - closure_expr_id: closure_expr_def_id.expect_local(), + closure_expr_id: closure_expr_def_id, }; let var_ty = self.node_ty(var_id)?;