Skip to content

Commit 3877f54

Browse files
committed
Declare body_owner and subject_def_id as LocalDefId in RegionCtxt
1 parent 91d5ab3 commit 3877f54

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/librustc_typeck/check/regionck.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use crate::check::FnCtxt;
7777
use crate::mem_categorization as mc;
7878
use crate::middle::region;
7979
use rustc_hir as hir;
80-
use rustc_hir::def_id::DefId;
80+
use rustc_hir::def_id::LocalDefId;
8181
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
8282
use rustc_hir::PatKind;
8383
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
@@ -109,7 +109,7 @@ macro_rules! ignore_err {
109109

110110
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
111111
pub fn regionck_expr(&self, body: &'tcx hir::Body<'tcx>) {
112-
let subject = self.tcx.hir().body_owner_def_id(body.id()).to_def_id();
112+
let subject = self.tcx.hir().body_owner_def_id(body.id());
113113
let id = body.value.hir_id;
114114
let mut rcx =
115115
RegionCtxt::new(self, RepeatingScope(id), id, Subject(subject), self.param_env);
@@ -135,7 +135,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
135135
self,
136136
RepeatingScope(item_id),
137137
item_id,
138-
Subject(subject.to_def_id()),
138+
Subject(subject),
139139
self.param_env,
140140
);
141141
rcx.outlives_environment.add_implied_bounds(self, wf_tys, item_id, span);
@@ -154,7 +154,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
154154
/// constraints to add.
155155
pub fn regionck_fn(&self, fn_id: hir::HirId, body: &'tcx hir::Body<'tcx>) {
156156
debug!("regionck_fn(id={})", fn_id);
157-
let subject = self.tcx.hir().body_owner_def_id(body.id()).to_def_id();
157+
let subject = self.tcx.hir().body_owner_def_id(body.id());
158158
let hir_id = body.value.hir_id;
159159
let mut rcx =
160160
RegionCtxt::new(self, RepeatingScope(hir_id), hir_id, Subject(subject), self.param_env);
@@ -180,7 +180,7 @@ pub struct RegionCtxt<'a, 'tcx> {
180180

181181
// id of innermost fn body id
182182
body_id: hir::HirId,
183-
body_owner: DefId,
183+
body_owner: LocalDefId,
184184

185185
// call_site scope of innermost fn
186186
call_site_scope: Option<region::Scope>,
@@ -189,7 +189,7 @@ pub struct RegionCtxt<'a, 'tcx> {
189189
repeating_scope: hir::HirId,
190190

191191
// id of AST node being analyzed (the subject of the analysis).
192-
subject_def_id: DefId,
192+
subject_def_id: LocalDefId,
193193
}
194194

195195
impl<'a, 'tcx> Deref for RegionCtxt<'a, 'tcx> {
@@ -200,7 +200,7 @@ impl<'a, 'tcx> Deref for RegionCtxt<'a, 'tcx> {
200200
}
201201

202202
pub struct RepeatingScope(hir::HirId);
203-
pub struct Subject(DefId);
203+
pub struct Subject(LocalDefId);
204204

205205
impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
206206
pub fn new(
@@ -290,7 +290,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
290290

291291
let body_id = body.id();
292292
self.body_id = body_id.hir_id;
293-
self.body_owner = self.tcx.hir().body_owner_def_id(body_id).to_def_id();
293+
self.body_owner = self.tcx.hir().body_owner_def_id(body_id);
294294

295295
let call_site =
296296
region::Scope { id: body.value.hir_id.local_id, data: region::ScopeData::CallSite };
@@ -353,7 +353,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
353353
);
354354

355355
self.fcx.resolve_regions_and_report_errors(
356-
self.subject_def_id,
356+
self.subject_def_id.to_def_id(),
357357
&self.region_scope_tree,
358358
&self.outlives_environment,
359359
mode,
@@ -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.expect_local(),
777+
self.body_owner,
778778
&self.tables.borrow(),
779779
))
780780
}

0 commit comments

Comments
 (0)