@@ -43,7 +43,7 @@ use rustc::ty::maps::{queries, Providers};
43
43
use rustc:: ty:: subst:: Substs ;
44
44
use rustc:: traits:: Reveal ;
45
45
use rustc:: util:: common:: ErrorReported ;
46
- use rustc:: util:: nodemap:: { ItemLocalMap , NodeSet } ;
46
+ use rustc:: util:: nodemap:: { ItemLocalSet , NodeSet } ;
47
47
use rustc:: lint:: builtin:: CONST_ERR ;
48
48
use rustc:: hir:: { self , PatKind , RangeEnd } ;
49
49
use std:: rc:: Rc ;
@@ -79,12 +79,12 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
79
79
. expect ( "rvalue_promotable_map invoked with non-local def-id" ) ;
80
80
let body_id = tcx. hir . body_owned_by ( node_id) ;
81
81
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 )
83
83
}
84
84
85
85
fn rvalue_promotable_map < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
86
86
def_id : DefId )
87
- -> Rc < ItemLocalMap < bool > >
87
+ -> Rc < ItemLocalSet >
88
88
{
89
89
let outer_def_id = tcx. closure_base_def_id ( def_id) ;
90
90
if outer_def_id != def_id {
@@ -100,7 +100,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
100
100
mut_rvalue_borrows : NodeSet ( ) ,
101
101
param_env : ty:: ParamEnv :: empty ( Reveal :: UserFacing ) ,
102
102
identity_substs : Substs :: empty ( ) ,
103
- result_map : ItemLocalMap ( ) ,
103
+ result : ItemLocalSet ( ) ,
104
104
} ;
105
105
106
106
// `def_id` should be a `Body` owner
@@ -109,7 +109,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
109
109
let body_id = tcx. hir . body_owned_by ( node_id) ;
110
110
visitor. visit_nested_body ( body_id) ;
111
111
112
- Rc :: new ( visitor. result_map )
112
+ Rc :: new ( visitor. result )
113
113
}
114
114
115
115
struct CheckCrateVisitor < ' a , ' tcx : ' a > {
@@ -121,7 +121,7 @@ struct CheckCrateVisitor<'a, 'tcx: 'a> {
121
121
param_env : ty:: ParamEnv < ' tcx > ,
122
122
identity_substs : & ' tcx Substs < ' tcx > ,
123
123
tables : & ' a ty:: TypeckTables < ' tcx > ,
124
- result_map : ItemLocalMap < bool > ,
124
+ result : ItemLocalSet ,
125
125
}
126
126
127
127
impl < ' a , ' gcx > CheckCrateVisitor < ' a , ' gcx > {
@@ -322,7 +322,9 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckCrateVisitor<'a, 'tcx> {
322
322
}
323
323
}
324
324
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
+ }
326
328
self . promotable &= outer;
327
329
}
328
330
}
0 commit comments