Declare body_owner as LocalDefId in MemCategorizationContext

This commit is contained in:
marmeladema 2020-04-18 16:06:06 +01:00
parent 3c6e6ca729
commit 91d5ab3fb1
4 changed files with 9 additions and 9 deletions

View File

@ -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(),
))
}

View File

@ -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,

View File

@ -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 {

View File

@ -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<hir::HirId, hir::Upvar>>,
}
@ -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)?;