Skip to content

Commit a1e83a9

Browse files
committed
s/AllocKind/AllocDiscriminant/
1 parent 3d278e9 commit a1e83a9

File tree

1 file changed

+11
-11
lines changed
  • src/librustc/mir/interpret

1 file changed

+11
-11
lines changed

src/librustc/mir/interpret/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl ::rustc_serialize::UseSpecializedEncodable for AllocId {}
8989
impl ::rustc_serialize::UseSpecializedDecodable for AllocId {}
9090

9191
#[derive(RustcDecodable, RustcEncodable)]
92-
enum AllocKind {
92+
enum AllocDiscriminant {
9393
Alloc,
9494
Fn,
9595
Static,
@@ -108,18 +108,18 @@ pub fn specialized_encode_alloc_id<
108108
match alloc_type {
109109
AllocType::Memory(alloc) => {
110110
trace!("encoding {:?} with {:#?}", alloc_id, alloc);
111-
AllocKind::Alloc.encode(encoder)?;
111+
AllocDiscriminant::Alloc.encode(encoder)?;
112112
alloc.encode(encoder)?;
113113
}
114114
AllocType::Function(fn_instance) => {
115115
trace!("encoding {:?} with {:#?}", alloc_id, fn_instance);
116-
AllocKind::Fn.encode(encoder)?;
116+
AllocDiscriminant::Fn.encode(encoder)?;
117117
fn_instance.encode(encoder)?;
118118
}
119119
AllocType::Static(did) => {
120120
// referring to statics doesn't need to know about their allocations,
121121
// just about its DefId
122-
AllocKind::Static.encode(encoder)?;
122+
AllocDiscriminant::Static.encode(encoder)?;
123123
did.encode(encoder)?;
124124
}
125125
}
@@ -188,10 +188,10 @@ impl<'s> AllocDecodingSession<'s> {
188188
let idx = decoder.read_u32()? as usize;
189189
let pos = self.state.data_offsets[idx] as usize;
190190

191-
// Decode the AllocKind now so that we know if we have to reserve an
191+
// Decode the AllocDiscriminant now so that we know if we have to reserve an
192192
// AllocId.
193193
let (alloc_kind, pos) = decoder.with_position(pos, |decoder| {
194-
let alloc_kind = AllocKind::decode(decoder)?;
194+
let alloc_kind = AllocDiscriminant::decode(decoder)?;
195195
Ok((alloc_kind, decoder.position()))
196196
})?;
197197

@@ -207,7 +207,7 @@ impl<'s> AllocDecodingSession<'s> {
207207
ref mut entry @ State::Empty => {
208208
// We are allowed to decode
209209
match alloc_kind {
210-
AllocKind::Alloc => {
210+
AllocDiscriminant::Alloc => {
211211
// If this is an allocation, we need to reserve an
212212
// AllocId so we can decode cyclic graphs.
213213
let alloc_id = decoder.tcx().alloc_map.lock().reserve();
@@ -216,7 +216,7 @@ impl<'s> AllocDecodingSession<'s> {
216216
alloc_id);
217217
Some(alloc_id)
218218
},
219-
AllocKind::Fn | AllocKind::Static => {
219+
AllocDiscriminant::Fn | AllocDiscriminant::Static => {
220220
// Fns and statics cannot be cyclic and their AllocId
221221
// is determined later by interning
222222
*entry = State::InProgressNonAlloc(
@@ -250,23 +250,23 @@ impl<'s> AllocDecodingSession<'s> {
250250
// Now decode the actual data
251251
let alloc_id = decoder.with_position(pos, |decoder| {
252252
match alloc_kind {
253-
AllocKind::Alloc => {
253+
AllocDiscriminant::Alloc => {
254254
let allocation = <&'tcx Allocation as Decodable>::decode(decoder)?;
255255
// We already have a reserved AllocId.
256256
let alloc_id = alloc_id.unwrap();
257257
trace!("decoded alloc {:?} {:#?}", alloc_id, allocation);
258258
decoder.tcx().alloc_map.lock().set_id_same_memory(alloc_id, allocation);
259259
Ok(alloc_id)
260260
},
261-
AllocKind::Fn => {
261+
AllocDiscriminant::Fn => {
262262
assert!(alloc_id.is_none());
263263
trace!("creating fn alloc id");
264264
let instance = ty::Instance::decode(decoder)?;
265265
trace!("decoded fn alloc instance: {:?}", instance);
266266
let alloc_id = decoder.tcx().alloc_map.lock().create_fn_alloc(instance);
267267
Ok(alloc_id)
268268
},
269-
AllocKind::Static => {
269+
AllocDiscriminant::Static => {
270270
assert!(alloc_id.is_none());
271271
trace!("creating extern static alloc id at");
272272
let did = DefId::decode(decoder)?;

0 commit comments

Comments
 (0)