Skip to content

Commit 12e8359

Browse files
Remove outdated AllocId decoding function.
1 parent 22f6163 commit 12e8359

File tree

1 file changed

+1
-42
lines changed
  • src/librustc/mir/interpret

1 file changed

+1
-42
lines changed

src/librustc/mir/interpret/mod.rs

+1-42
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::io;
2323
use std::ops::{Deref, DerefMut};
2424
use std::hash::Hash;
2525
use syntax::ast::Mutability;
26-
use rustc_serialize::{Encoder, Decoder, Decodable, Encodable};
26+
use rustc_serialize::{Encoder, Decodable, Encodable};
2727
use rustc_data_structures::sorted_map::SortedMap;
2828
use rustc_data_structures::fx::FxHashMap;
2929
use rustc_data_structures::sync::{Lock as Mutex, HashMapExt};
@@ -209,47 +209,6 @@ pub fn specialized_encode_alloc_id<
209209
Ok(())
210210
}
211211

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-
253212
// Used to avoid infinite recursion when decoding cyclic allocations.
254213
type DecodingSessionId = NonZeroU32;
255214

0 commit comments

Comments
 (0)