@@ -23,7 +23,7 @@ use std::io;
23
23
use std:: ops:: { Deref , DerefMut } ;
24
24
use std:: hash:: Hash ;
25
25
use syntax:: ast:: Mutability ;
26
- use rustc_serialize:: { Encoder , Decoder , Decodable , Encodable } ;
26
+ use rustc_serialize:: { Encoder , Decodable , Encodable } ;
27
27
use rustc_data_structures:: sorted_map:: SortedMap ;
28
28
use rustc_data_structures:: fx:: FxHashMap ;
29
29
use rustc_data_structures:: sync:: { Lock as Mutex , HashMapExt } ;
@@ -209,47 +209,6 @@ pub fn specialized_encode_alloc_id<
209
209
Ok ( ( ) )
210
210
}
211
211
212
- pub fn specialized_decode_alloc_id <
213
- ' a , ' tcx ,
214
- D : Decoder ,
215
- CACHE : FnOnce ( & mut D , AllocId ) ,
216
- > (
217
- decoder : & mut D ,
218
- tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
219
- cache : CACHE ,
220
- ) -> Result < AllocId , D :: Error > {
221
- match AllocKind :: decode ( decoder) ? {
222
- AllocKind :: Alloc => {
223
- let alloc_id = tcx. alloc_map . lock ( ) . reserve ( ) ;
224
- trace ! ( "creating alloc id {:?}" , alloc_id) ;
225
- // insert early to allow recursive allocs
226
- cache ( decoder, alloc_id) ;
227
-
228
- let allocation = <& ' tcx Allocation as Decodable >:: decode ( decoder) ?;
229
- trace ! ( "decoded alloc {:?} {:#?}" , alloc_id, allocation) ;
230
- tcx. alloc_map . lock ( ) . set_id_memory ( alloc_id, allocation) ;
231
-
232
- Ok ( alloc_id)
233
- } ,
234
- AllocKind :: Fn => {
235
- trace ! ( "creating fn alloc id" ) ;
236
- let instance = ty:: Instance :: decode ( decoder) ?;
237
- trace ! ( "decoded fn alloc instance: {:?}" , instance) ;
238
- let id = tcx. alloc_map . lock ( ) . create_fn_alloc ( instance) ;
239
- trace ! ( "created fn alloc id: {:?}" , id) ;
240
- cache ( decoder, id) ;
241
- Ok ( id)
242
- } ,
243
- AllocKind :: Static => {
244
- trace ! ( "creating extern static alloc id at" ) ;
245
- let did = DefId :: decode ( decoder) ?;
246
- let alloc_id = tcx. alloc_map . lock ( ) . intern_static ( did) ;
247
- cache ( decoder, alloc_id) ;
248
- Ok ( alloc_id)
249
- } ,
250
- }
251
- }
252
-
253
212
// Used to avoid infinite recursion when decoding cyclic allocations.
254
213
type DecodingSessionId = NonZeroU32 ;
255
214
0 commit comments