@@ -59,7 +59,7 @@ pub use self::Note::*;
5959use self :: Aliasability :: * ;
6060
6161use crate :: middle:: region;
62- use crate :: hir:: def_id:: DefId ;
62+ use crate :: hir:: def_id:: { DefId , LocalDefId } ;
6363use crate :: hir:: Node ;
6464use crate :: infer:: InferCtxt ;
6565use crate :: hir:: def:: { CtorOf , Res , DefKind , CtorKind } ;
@@ -214,7 +214,7 @@ impl HirNode for hir::Pat {
214214pub struct MemCategorizationContext < ' a , ' tcx > {
215215 pub tcx : TyCtxt < ' tcx > ,
216216 param_env : ty:: ParamEnv < ' tcx > ,
217- pub body_owner : DefId ,
217+ pub body_owner : LocalDefId ,
218218 pub upvars : Option < & ' tcx FxIndexMap < hir:: HirId , hir:: Upvar > > ,
219219 pub region_scope_tree : & ' a region:: ScopeTree ,
220220 pub tables : & ' a ty:: TypeckTables < ' tcx > ,
@@ -330,14 +330,14 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
330330 pub fn new (
331331 tcx : TyCtxt < ' tcx > ,
332332 param_env : ty:: ParamEnv < ' tcx > ,
333- body_owner : DefId ,
333+ body_owner : LocalDefId ,
334334 region_scope_tree : & ' a region:: ScopeTree ,
335335 tables : & ' a ty:: TypeckTables < ' tcx > ,
336336 ) -> MemCategorizationContext < ' a , ' tcx > {
337337 MemCategorizationContext {
338338 tcx,
339339 body_owner,
340- upvars : tcx. upvars ( body_owner) ,
340+ upvars : tcx. upvars ( body_owner. to_def_id ( ) ) ,
341341 region_scope_tree,
342342 tables,
343343 infcx : None ,
@@ -359,7 +359,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
359359 pub fn with_infer (
360360 infcx : & ' a InferCtxt < ' a , ' tcx > ,
361361 param_env : ty:: ParamEnv < ' tcx > ,
362- body_owner : DefId ,
362+ body_owner : LocalDefId ,
363363 region_scope_tree : & ' a region:: ScopeTree ,
364364 tables : & ' a ty:: TypeckTables < ' tcx > ,
365365 ) -> MemCategorizationContext < ' a , ' tcx > {
@@ -368,7 +368,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
368368 MemCategorizationContext {
369369 tcx,
370370 body_owner,
371- upvars : tcx. upvars ( body_owner) ,
371+ upvars : tcx. upvars ( body_owner. to_def_id ( ) ) ,
372372 region_scope_tree,
373373 tables,
374374 infcx : Some ( infcx) ,
@@ -722,9 +722,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
722722 // FnOnce | copied | upvar -> &'up bk
723723
724724 let closure_expr_def_id = self . body_owner ;
725- let fn_hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id (
726- closure_expr_def_id. assert_local ( ) ,
727- ) ;
725+ let fn_hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( closure_expr_def_id) ;
728726 let ty = self . node_ty ( fn_hir_id) ?;
729727 let kind = match ty. kind {
730728 ty:: Generator ( ..) => ty:: ClosureKind :: FnOnce ,
@@ -747,7 +745,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
747745
748746 let upvar_id = ty:: UpvarId {
749747 var_path : ty:: UpvarPath { hir_id : var_id } ,
750- closure_expr_id : closure_expr_def_id. assert_local ( ) ,
748+ closure_expr_id : closure_expr_def_id,
751749 } ;
752750
753751 let var_ty = self . node_ty ( var_id) ?;
0 commit comments