@@ -41,8 +41,6 @@ use rustc::hir::svh::Svh;
41
41
use rustc_back:: target:: Target ;
42
42
use rustc:: hir;
43
43
44
- use std:: collections:: BTreeMap ;
45
-
46
44
macro_rules! provide {
47
45
( <$lt: tt> $tcx: ident, $def_id: ident, $cdata: ident $( $name: ident => $compute: block) * ) => {
48
46
pub fn provide<$lt>( providers: & mut Providers <$lt>) {
@@ -113,21 +111,23 @@ provide! { <'tcx> tcx, def_id, cdata
113
111
def_span => { cdata. get_span( def_id. index, & tcx. sess) }
114
112
stability => { cdata. get_stability( def_id. index) }
115
113
deprecation => { cdata. get_deprecation( def_id. index) }
116
- item_body_nested_bodies => {
117
- let map: BTreeMap <_, _> = cdata. entry( def_id. index) . ast. into_iter( ) . flat_map( |ast| {
118
- ast. decode( cdata) . nested_bodies. decode( cdata) . map( |body| ( body. id( ) , body) )
119
- } ) . collect( ) ;
120
-
121
- Rc :: new( map)
122
- }
114
+ item_attrs => { cdata. get_item_attrs( def_id. index, & tcx. dep_graph) }
115
+ // FIXME(#38501) We've skipped a `read` on the `HirBody` of
116
+ // a `fn` when encoding, so the dep-tracking wouldn't work.
117
+ // This is only used by rustdoc anyway, which shouldn't have
118
+ // incremental recompilation ever enabled.
119
+ fn_arg_names => { cdata. get_fn_arg_names( def_id. index) }
120
+ impl_parent => { cdata. get_parent_impl( def_id. index) }
121
+ trait_of_item => { cdata. get_trait_of_item( def_id. index) }
122
+ is_exported_symbol => {
123
+ let dep_node = cdata. metadata_dep_node( GlobalMetaDataKind :: ExportedSymbols ) ;
124
+ cdata. exported_symbols. get( & tcx. dep_graph, dep_node) . contains( & def_id. index)
125
+ }
126
+ item_body_nested_bodies => { Rc :: new( cdata. item_body_nested_bodies( def_id. index) ) }
123
127
const_is_rvalue_promotable_to_static => {
124
- cdata. entry( def_id. index) . ast. expect( "const item missing `ast`" )
125
- . decode( cdata) . rvalue_promotable_to_static
126
- }
127
- is_mir_available => {
128
- !cdata. is_proc_macro( def_id. index) &&
129
- cdata. maybe_entry( def_id. index) . and_then( |item| item. decode( cdata) . mir) . is_some( )
128
+ cdata. const_is_rvalue_promotable_to_static( def_id. index)
130
129
}
130
+ is_mir_available => { cdata. is_item_mir_available( def_id. index) }
131
131
}
132
132
133
133
impl CrateStore for cstore:: CStore {
@@ -145,22 +145,6 @@ impl CrateStore for cstore::CStore {
145
145
self . get_crate_data ( def. krate ) . get_generics ( def. index )
146
146
}
147
147
148
- fn item_attrs ( & self , def_id : DefId ) -> Rc < [ ast:: Attribute ] >
149
- {
150
- self . get_crate_data ( def_id. krate )
151
- . get_item_attrs ( def_id. index , & self . dep_graph )
152
- }
153
-
154
- fn fn_arg_names ( & self , did : DefId ) -> Vec < ast:: Name >
155
- {
156
- // FIXME(#38501) We've skipped a `read` on the `HirBody` of
157
- // a `fn` when encoding, so the dep-tracking wouldn't work.
158
- // This is only used by rustdoc anyway, which shouldn't have
159
- // incremental recompilation ever enabled.
160
- assert ! ( !self . dep_graph. is_fully_enabled( ) ) ;
161
- self . get_crate_data ( did. krate ) . get_fn_arg_names ( did. index )
162
- }
163
-
164
148
fn implementations_of_trait ( & self , filter : Option < DefId > ) -> Vec < DefId >
165
149
{
166
150
if let Some ( def_id) = filter {
@@ -179,16 +163,6 @@ impl CrateStore for cstore::CStore {
179
163
self . get_crate_data ( def. krate ) . get_impl_defaultness ( def. index )
180
164
}
181
165
182
- fn impl_parent ( & self , impl_def : DefId ) -> Option < DefId > {
183
- self . dep_graph . read ( DepNode :: MetaData ( impl_def) ) ;
184
- self . get_crate_data ( impl_def. krate ) . get_parent_impl ( impl_def. index )
185
- }
186
-
187
- fn trait_of_item ( & self , def_id : DefId ) -> Option < DefId > {
188
- self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
189
- self . get_crate_data ( def_id. krate ) . get_trait_of_item ( def_id. index )
190
- }
191
-
192
166
fn associated_item_cloned ( & self , def : DefId ) -> ty:: AssociatedItem
193
167
{
194
168
self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
@@ -206,23 +180,11 @@ impl CrateStore for cstore::CStore {
206
180
self . get_crate_data ( impl_did. krate ) . is_default_impl ( impl_did. index )
207
181
}
208
182
209
- fn is_foreign_item ( & self , did : DefId ) -> bool {
210
- self . get_crate_data ( did. krate ) . is_foreign_item ( did. index )
211
- }
212
-
213
183
fn is_statically_included_foreign_item ( & self , def_id : DefId ) -> bool
214
184
{
215
185
self . do_is_statically_included_foreign_item ( def_id)
216
186
}
217
187
218
- fn is_exported_symbol ( & self , def_id : DefId ) -> bool {
219
- let data = self . get_crate_data ( def_id. krate ) ;
220
- let dep_node = data. metadata_dep_node ( GlobalMetaDataKind :: ExportedSymbols ) ;
221
- data. exported_symbols
222
- . get ( & self . dep_graph , dep_node)
223
- . contains ( & def_id. index )
224
- }
225
-
226
188
fn is_dllimport_foreign_item ( & self , def_id : DefId ) -> bool {
227
189
if def_id. krate == LOCAL_CRATE {
228
190
self . dllimport_foreign_items . borrow ( ) . contains ( & def_id. index )
0 commit comments