@@ -77,7 +77,7 @@ use crate::check::FnCtxt;
7777use crate :: mem_categorization as mc;
7878use crate :: middle:: region;
7979use rustc_hir as hir;
80- use rustc_hir:: def_id:: DefId ;
80+ use rustc_hir:: def_id:: { DefId , LocalDefId } ;
8181use rustc_hir:: intravisit:: { self , NestedVisitorMap , Visitor } ;
8282use rustc_hir:: PatKind ;
8383use rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ;
@@ -109,7 +109,7 @@ macro_rules! ignore_err {
109109
110110impl < ' 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 > ,
@@ -200,7 +200,7 @@ impl<'a, 'tcx> Deref for RegionCtxt<'a, 'tcx> {
200200}
201201
202202pub struct RepeatingScope ( hir:: HirId ) ;
203- pub struct Subject ( DefId ) ;
203+ pub struct Subject ( LocalDefId ) ;
204204
205205impl < ' a , ' tcx > RegionCtxt < ' a , ' tcx > {
206206 pub fn new (
@@ -219,7 +219,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
219219 body_id : initial_body_id,
220220 body_owner : subject,
221221 call_site_scope : None ,
222- subject_def_id : subject,
222+ subject_def_id : subject. to_def_id ( ) ,
223223 outlives_environment,
224224 }
225225 }
@@ -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 } ;
@@ -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