@@ -77,7 +77,7 @@ use crate::check::FnCtxt;
77
77
use crate :: mem_categorization as mc;
78
78
use crate :: middle:: region;
79
79
use rustc_hir as hir;
80
- use rustc_hir:: def_id:: DefId ;
80
+ use rustc_hir:: def_id:: LocalDefId ;
81
81
use rustc_hir:: intravisit:: { self , NestedVisitorMap , Visitor } ;
82
82
use rustc_hir:: PatKind ;
83
83
use rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ;
@@ -109,7 +109,7 @@ macro_rules! ignore_err {
109
109
110
110
impl < ' a , ' tcx > FnCtxt < ' a , ' tcx > {
111
111
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 ( ) ) ;
113
113
let id = body. value . hir_id ;
114
114
let mut rcx =
115
115
RegionCtxt :: new ( self , RepeatingScope ( id) , id, Subject ( subject) , self . param_env ) ;
@@ -135,7 +135,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
135
135
self ,
136
136
RepeatingScope ( item_id) ,
137
137
item_id,
138
- Subject ( subject. to_def_id ( ) ) ,
138
+ Subject ( subject) ,
139
139
self . param_env ,
140
140
) ;
141
141
rcx. outlives_environment . add_implied_bounds ( self , wf_tys, item_id, span) ;
@@ -154,7 +154,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
154
154
/// constraints to add.
155
155
pub fn regionck_fn ( & self , fn_id : hir:: HirId , body : & ' tcx hir:: Body < ' tcx > ) {
156
156
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 ( ) ) ;
158
158
let hir_id = body. value . hir_id ;
159
159
let mut rcx =
160
160
RegionCtxt :: new ( self , RepeatingScope ( hir_id) , hir_id, Subject ( subject) , self . param_env ) ;
@@ -180,7 +180,7 @@ pub struct RegionCtxt<'a, 'tcx> {
180
180
181
181
// id of innermost fn body id
182
182
body_id : hir:: HirId ,
183
- body_owner : DefId ,
183
+ body_owner : LocalDefId ,
184
184
185
185
// call_site scope of innermost fn
186
186
call_site_scope : Option < region:: Scope > ,
@@ -189,7 +189,7 @@ pub struct RegionCtxt<'a, 'tcx> {
189
189
repeating_scope : hir:: HirId ,
190
190
191
191
// id of AST node being analyzed (the subject of the analysis).
192
- subject_def_id : DefId ,
192
+ subject_def_id : LocalDefId ,
193
193
}
194
194
195
195
impl < ' a , ' tcx > Deref for RegionCtxt < ' a , ' tcx > {
@@ -200,7 +200,7 @@ impl<'a, 'tcx> Deref for RegionCtxt<'a, 'tcx> {
200
200
}
201
201
202
202
pub struct RepeatingScope ( hir:: HirId ) ;
203
- pub struct Subject ( DefId ) ;
203
+ pub struct Subject ( LocalDefId ) ;
204
204
205
205
impl < ' a , ' tcx > RegionCtxt < ' a , ' tcx > {
206
206
pub fn new (
@@ -290,7 +290,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
290
290
291
291
let body_id = body. id ( ) ;
292
292
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) ;
294
294
295
295
let call_site =
296
296
region:: Scope { id : body. value . hir_id . local_id , data : region:: ScopeData :: CallSite } ;
@@ -353,7 +353,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
353
353
) ;
354
354
355
355
self . fcx . resolve_regions_and_report_errors (
356
- self . subject_def_id ,
356
+ self . subject_def_id . to_def_id ( ) ,
357
357
& self . region_scope_tree ,
358
358
& self . outlives_environment ,
359
359
mode,
@@ -774,7 +774,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
774
774
f ( mc:: MemCategorizationContext :: new (
775
775
& self . infcx ,
776
776
self . outlives_environment . param_env ,
777
- self . body_owner . expect_local ( ) ,
777
+ self . body_owner ,
778
778
& self . tables . borrow ( ) ,
779
779
) )
780
780
}
0 commit comments