@@ -89,7 +89,7 @@ impl ::rustc_serialize::UseSpecializedEncodable for AllocId {}
89
89
impl :: rustc_serialize:: UseSpecializedDecodable for AllocId { }
90
90
91
91
#[ derive( RustcDecodable , RustcEncodable ) ]
92
- enum AllocKind {
92
+ enum AllocDiscriminant {
93
93
Alloc ,
94
94
Fn ,
95
95
Static ,
@@ -108,18 +108,18 @@ pub fn specialized_encode_alloc_id<
108
108
match alloc_type {
109
109
AllocType :: Memory ( alloc) => {
110
110
trace ! ( "encoding {:?} with {:#?}" , alloc_id, alloc) ;
111
- AllocKind :: Alloc . encode ( encoder) ?;
111
+ AllocDiscriminant :: Alloc . encode ( encoder) ?;
112
112
alloc. encode ( encoder) ?;
113
113
}
114
114
AllocType :: Function ( fn_instance) => {
115
115
trace ! ( "encoding {:?} with {:#?}" , alloc_id, fn_instance) ;
116
- AllocKind :: Fn . encode ( encoder) ?;
116
+ AllocDiscriminant :: Fn . encode ( encoder) ?;
117
117
fn_instance. encode ( encoder) ?;
118
118
}
119
119
AllocType :: Static ( did) => {
120
120
// referring to statics doesn't need to know about their allocations,
121
121
// just about its DefId
122
- AllocKind :: Static . encode ( encoder) ?;
122
+ AllocDiscriminant :: Static . encode ( encoder) ?;
123
123
did. encode ( encoder) ?;
124
124
}
125
125
}
@@ -188,10 +188,10 @@ impl<'s> AllocDecodingSession<'s> {
188
188
let idx = decoder. read_u32 ( ) ? as usize ;
189
189
let pos = self . state . data_offsets [ idx] as usize ;
190
190
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
192
192
// AllocId.
193
193
let ( alloc_kind, pos) = decoder. with_position ( pos, |decoder| {
194
- let alloc_kind = AllocKind :: decode ( decoder) ?;
194
+ let alloc_kind = AllocDiscriminant :: decode ( decoder) ?;
195
195
Ok ( ( alloc_kind, decoder. position ( ) ) )
196
196
} ) ?;
197
197
@@ -207,7 +207,7 @@ impl<'s> AllocDecodingSession<'s> {
207
207
ref mut entry @ State :: Empty => {
208
208
// We are allowed to decode
209
209
match alloc_kind {
210
- AllocKind :: Alloc => {
210
+ AllocDiscriminant :: Alloc => {
211
211
// If this is an allocation, we need to reserve an
212
212
// AllocId so we can decode cyclic graphs.
213
213
let alloc_id = decoder. tcx ( ) . alloc_map . lock ( ) . reserve ( ) ;
@@ -216,7 +216,7 @@ impl<'s> AllocDecodingSession<'s> {
216
216
alloc_id) ;
217
217
Some ( alloc_id)
218
218
} ,
219
- AllocKind :: Fn | AllocKind :: Static => {
219
+ AllocDiscriminant :: Fn | AllocDiscriminant :: Static => {
220
220
// Fns and statics cannot be cyclic and their AllocId
221
221
// is determined later by interning
222
222
* entry = State :: InProgressNonAlloc (
@@ -250,23 +250,23 @@ impl<'s> AllocDecodingSession<'s> {
250
250
// Now decode the actual data
251
251
let alloc_id = decoder. with_position ( pos, |decoder| {
252
252
match alloc_kind {
253
- AllocKind :: Alloc => {
253
+ AllocDiscriminant :: Alloc => {
254
254
let allocation = <& ' tcx Allocation as Decodable >:: decode ( decoder) ?;
255
255
// We already have a reserved AllocId.
256
256
let alloc_id = alloc_id. unwrap ( ) ;
257
257
trace ! ( "decoded alloc {:?} {:#?}" , alloc_id, allocation) ;
258
258
decoder. tcx ( ) . alloc_map . lock ( ) . set_id_same_memory ( alloc_id, allocation) ;
259
259
Ok ( alloc_id)
260
260
} ,
261
- AllocKind :: Fn => {
261
+ AllocDiscriminant :: Fn => {
262
262
assert ! ( alloc_id. is_none( ) ) ;
263
263
trace ! ( "creating fn alloc id" ) ;
264
264
let instance = ty:: Instance :: decode ( decoder) ?;
265
265
trace ! ( "decoded fn alloc instance: {:?}" , instance) ;
266
266
let alloc_id = decoder. tcx ( ) . alloc_map . lock ( ) . create_fn_alloc ( instance) ;
267
267
Ok ( alloc_id)
268
268
} ,
269
- AllocKind :: Static => {
269
+ AllocDiscriminant :: Static => {
270
270
assert ! ( alloc_id. is_none( ) ) ;
271
271
trace ! ( "creating extern static alloc id at" ) ;
272
272
let did = DefId :: decode ( decoder) ?;
0 commit comments