Skip to content

Commit d826fb0

Browse files
committed
Declare body_owner as LocalDefId in MemCategorizationContext
1 parent 2286364 commit d826fb0

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/librustc_typeck/check/regionck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
774774
f(mc::MemCategorizationContext::new(
775775
&self.infcx,
776776
self.outlives_environment.param_env,
777-
self.body_owner,
777+
self.body_owner.expect_local(),
778778
&self.tables.borrow(),
779779
))
780780
}

src/librustc_typeck/check/upvar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
146146
}
147147
}
148148

149-
let body_owner_def_id = self.tcx.hir().body_owner_def_id(body.id()).to_def_id();
150-
assert_eq!(body_owner_def_id, closure_def_id);
149+
let body_owner_def_id = self.tcx.hir().body_owner_def_id(body.id());
150+
assert_eq!(body_owner_def_id.to_def_id(), closure_def_id);
151151
let mut delegate = InferBorrowKind {
152152
fcx: self,
153153
closure_def_id,

src/librustc_typeck/expr_use_visitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub use mc::{Place, PlaceBase, Projection};
99

1010
use rustc_hir as hir;
1111
use rustc_hir::def::Res;
12-
use rustc_hir::def_id::DefId;
12+
use rustc_hir::def_id::LocalDefId;
1313
use rustc_hir::PatKind;
1414
use rustc_infer::infer::InferCtxt;
1515
use rustc_middle::ty::{self, adjustment, TyCtxt};
@@ -84,7 +84,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
8484
pub fn new(
8585
delegate: &'a mut (dyn Delegate<'tcx> + 'a),
8686
infcx: &'a InferCtxt<'a, 'tcx>,
87-
body_owner: DefId,
87+
body_owner: LocalDefId,
8888
param_env: ty::ParamEnv<'tcx>,
8989
tables: &'a ty::TypeckTables<'tcx>,
9090
) -> Self {

src/librustc_typeck/mem_categorization.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
5555
use rustc_data_structures::fx::FxIndexMap;
5656
use rustc_hir as hir;
5757
use rustc_hir::def::{DefKind, Res};
58-
use rustc_hir::def_id::DefId;
58+
use rustc_hir::def_id::LocalDefId;
5959
use rustc_hir::PatKind;
6060
use rustc_infer::infer::InferCtxt;
6161
use rustc_span::Span;
@@ -140,7 +140,7 @@ crate struct MemCategorizationContext<'a, 'tcx> {
140140
crate tables: &'a ty::TypeckTables<'tcx>,
141141
infcx: &'a InferCtxt<'a, 'tcx>,
142142
param_env: ty::ParamEnv<'tcx>,
143-
body_owner: DefId,
143+
body_owner: LocalDefId,
144144
upvars: Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>>,
145145
}
146146

@@ -151,7 +151,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
151151
crate fn new(
152152
infcx: &'a InferCtxt<'a, 'tcx>,
153153
param_env: ty::ParamEnv<'tcx>,
154-
body_owner: DefId,
154+
body_owner: LocalDefId,
155155
tables: &'a ty::TypeckTables<'tcx>,
156156
) -> MemCategorizationContext<'a, 'tcx> {
157157
MemCategorizationContext {
@@ -473,7 +473,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
473473

474474
let upvar_id = ty::UpvarId {
475475
var_path: ty::UpvarPath { hir_id: var_id },
476-
closure_expr_id: closure_expr_def_id.expect_local(),
476+
closure_expr_id: closure_expr_def_id,
477477
};
478478
let var_ty = self.node_ty(var_id)?;
479479

0 commit comments

Comments
 (0)