@@ -43,7 +43,7 @@ use rustc::ty::maps::{queries, Providers};
4343use rustc:: ty:: subst:: Substs ;
4444use rustc:: traits:: Reveal ;
4545use rustc:: util:: common:: ErrorReported ;
46- use rustc:: util:: nodemap:: { ItemLocalMap , NodeSet } ;
46+ use rustc:: util:: nodemap:: { ItemLocalSet , NodeSet } ;
4747use rustc:: lint:: builtin:: CONST_ERR ;
4848use rustc:: hir:: { self , PatKind , RangeEnd } ;
4949use std:: rc:: Rc ;
@@ -79,12 +79,12 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
7979 . expect ( "rvalue_promotable_map invoked with non-local def-id" ) ;
8080 let body_id = tcx. hir . body_owned_by ( node_id) ;
8181 let body_hir_id = tcx. hir . node_to_hir_id ( body_id. node_id ) ;
82- tcx. rvalue_promotable_map ( def_id) . contains_key ( & body_hir_id. local_id )
82+ tcx. rvalue_promotable_map ( def_id) . contains ( & body_hir_id. local_id )
8383}
8484
8585fn rvalue_promotable_map < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
8686 def_id : DefId )
87- -> Rc < ItemLocalMap < bool > >
87+ -> Rc < ItemLocalSet >
8888{
8989 let outer_def_id = tcx. closure_base_def_id ( def_id) ;
9090 if outer_def_id != def_id {
@@ -100,7 +100,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
100100 mut_rvalue_borrows : NodeSet ( ) ,
101101 param_env : ty:: ParamEnv :: empty ( Reveal :: UserFacing ) ,
102102 identity_substs : Substs :: empty ( ) ,
103- result_map : ItemLocalMap ( ) ,
103+ result : ItemLocalSet ( ) ,
104104 } ;
105105
106106 // `def_id` should be a `Body` owner
@@ -109,7 +109,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
109109 let body_id = tcx. hir . body_owned_by ( node_id) ;
110110 visitor. visit_nested_body ( body_id) ;
111111
112- Rc :: new ( visitor. result_map )
112+ Rc :: new ( visitor. result )
113113}
114114
115115struct CheckCrateVisitor < ' a , ' tcx : ' a > {
@@ -121,7 +121,7 @@ struct CheckCrateVisitor<'a, 'tcx: 'a> {
121121 param_env : ty:: ParamEnv < ' tcx > ,
122122 identity_substs : & ' tcx Substs < ' tcx > ,
123123 tables : & ' a ty:: TypeckTables < ' tcx > ,
124- result_map : ItemLocalMap < bool > ,
124+ result : ItemLocalSet ,
125125}
126126
127127impl < ' a , ' gcx > CheckCrateVisitor < ' a , ' gcx > {
@@ -322,7 +322,9 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckCrateVisitor<'a, 'tcx> {
322322 }
323323 }
324324
325- self . result_map . insert ( ex. hir_id . local_id , self . promotable ) ;
325+ if self . promotable {
326+ self . result . insert ( ex. hir_id . local_id ) ;
327+ }
326328 self . promotable &= outer;
327329 }
328330}
0 commit comments