about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2020-04-18 16:12:51 +0100
committermarmeladema <xademax@gmail.com>2020-04-27 23:57:55 +0100
commit3877f540006ddb690c687947e299a07c19e98aed (patch)
tree5bb7fa5b267a095712f00b0f85248fa8f91a4e46 /src
parent91d5ab3fb1824f02acbfe40b1b33d8cdc64115db (diff)
downloadrust-3877f540006ddb690c687947e299a07c19e98aed.tar.gz
rust-3877f540006ddb690c687947e299a07c19e98aed.zip
Declare `body_owner` and `subject_def_id` as `LocalDefId` in `RegionCtxt`
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/check/regionck.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs
index 7ca2b221f78..53d6ec96bd2 100644
--- a/src/librustc_typeck/check/regionck.rs
+++ b/src/librustc_typeck/check/regionck.rs
@@ -77,7 +77,7 @@ use crate::check::FnCtxt;
 use crate::mem_categorization as mc;
 use crate::middle::region;
 use rustc_hir as hir;
-use rustc_hir::def_id::DefId;
+use rustc_hir::def_id::LocalDefId;
 use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
 use rustc_hir::PatKind;
 use rustc_infer::infer::outlives::env::OutlivesEnvironment;
@@ -109,7 +109,7 @@ macro_rules! ignore_err {
 
 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     pub fn regionck_expr(&self, body: &'tcx hir::Body<'tcx>) {
-        let subject = self.tcx.hir().body_owner_def_id(body.id()).to_def_id();
+        let subject = self.tcx.hir().body_owner_def_id(body.id());
         let id = body.value.hir_id;
         let mut rcx =
             RegionCtxt::new(self, RepeatingScope(id), id, Subject(subject), self.param_env);
@@ -135,7 +135,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             self,
             RepeatingScope(item_id),
             item_id,
-            Subject(subject.to_def_id()),
+            Subject(subject),
             self.param_env,
         );
         rcx.outlives_environment.add_implied_bounds(self, wf_tys, item_id, span);
@@ -154,7 +154,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// constraints to add.
     pub fn regionck_fn(&self, fn_id: hir::HirId, body: &'tcx hir::Body<'tcx>) {
         debug!("regionck_fn(id={})", fn_id);
-        let subject = self.tcx.hir().body_owner_def_id(body.id()).to_def_id();
+        let subject = self.tcx.hir().body_owner_def_id(body.id());
         let hir_id = body.value.hir_id;
         let mut rcx =
             RegionCtxt::new(self, RepeatingScope(hir_id), hir_id, Subject(subject), self.param_env);
@@ -180,7 +180,7 @@ pub struct RegionCtxt<'a, 'tcx> {
 
     // id of innermost fn body id
     body_id: hir::HirId,
-    body_owner: DefId,
+    body_owner: LocalDefId,
 
     // call_site scope of innermost fn
     call_site_scope: Option<region::Scope>,
@@ -189,7 +189,7 @@ pub struct RegionCtxt<'a, 'tcx> {
     repeating_scope: hir::HirId,
 
     // id of AST node being analyzed (the subject of the analysis).
-    subject_def_id: DefId,
+    subject_def_id: LocalDefId,
 }
 
 impl<'a, 'tcx> Deref for RegionCtxt<'a, 'tcx> {
@@ -200,7 +200,7 @@ impl<'a, 'tcx> Deref for RegionCtxt<'a, 'tcx> {
 }
 
 pub struct RepeatingScope(hir::HirId);
-pub struct Subject(DefId);
+pub struct Subject(LocalDefId);
 
 impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
     pub fn new(
@@ -290,7 +290,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
 
         let body_id = body.id();
         self.body_id = body_id.hir_id;
-        self.body_owner = self.tcx.hir().body_owner_def_id(body_id).to_def_id();
+        self.body_owner = self.tcx.hir().body_owner_def_id(body_id);
 
         let call_site =
             region::Scope { id: body.value.hir_id.local_id, data: region::ScopeData::CallSite };
@@ -353,7 +353,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
         );
 
         self.fcx.resolve_regions_and_report_errors(
-            self.subject_def_id,
+            self.subject_def_id.to_def_id(),
             &self.region_scope_tree,
             &self.outlives_environment,
             mode,
@@ -774,7 +774,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
         f(mc::MemCategorizationContext::new(
             &self.infcx,
             self.outlives_environment.param_env,
-            self.body_owner.expect_local(),
+            self.body_owner,
             &self.tables.borrow(),
         ))
     }