@@ -53,7 +53,7 @@ use rustc::hir::intravisit::Visitor;
53
53
use rustc:: hir:: intravisit;
54
54
use rustc:: hir:: map:: DefKey ;
55
55
56
- use super :: index_builder:: { FromId , IndexBuilder , ItemContentBuilder , XRef } ;
56
+ use super :: index_builder:: { FromId , IndexBuilder , ItemContentBuilder , Untracked , XRef } ;
57
57
58
58
pub struct EncodeContext < ' a , ' tcx : ' a > {
59
59
pub diag : & ' a Handler ,
@@ -206,15 +206,20 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
206
206
for ( i, variant) in def. variants . iter ( ) . enumerate ( ) {
207
207
self . record ( variant. did ,
208
208
ItemContentBuilder :: encode_enum_variant_info,
209
- ( enum_did, i ) ) ;
209
+ ( enum_did, Untracked ( i ) ) ) ;
210
210
}
211
211
}
212
212
}
213
213
214
214
impl < ' a , ' tcx , ' encoder > ItemContentBuilder < ' a , ' tcx , ' encoder > {
215
+ /// Encode data for the given variant of the given ADT. The
216
+ /// index of the variant is untracked: this is ok because we
217
+ /// will have to lookup the adt-def by its id, and that gives us
218
+ /// the right to access any information in the adt-def (including,
219
+ /// e.g., the length of the various vectors).
215
220
fn encode_enum_variant_info ( & mut self ,
216
- ( enum_did, index) :
217
- ( DefId , usize ) ) {
221
+ ( enum_did, Untracked ( index) ) :
222
+ ( DefId , Untracked < usize > ) ) {
218
223
let ecx = self . ecx ;
219
224
let def = ecx. tcx . lookup_adt_def ( enum_did) ;
220
225
let variant = & def. variants [ index] ;
@@ -420,16 +425,22 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
420
425
for ( field_index, field) in variant. fields . iter ( ) . enumerate ( ) {
421
426
self . record ( field. did ,
422
427
ItemContentBuilder :: encode_field,
423
- ( adt_def_id, variant_index, field_index) ) ;
428
+ ( adt_def_id, Untracked ( ( variant_index, field_index) ) ) ) ;
424
429
}
425
430
}
426
431
}
427
432
}
428
433
429
434
impl < ' a , ' tcx , ' encoder > ItemContentBuilder < ' a , ' tcx , ' encoder > {
435
+ /// Encode data for the given field of the given variant of the
436
+ /// given ADT. The indices of the variant/field are untracked:
437
+ /// this is ok because we will have to lookup the adt-def by its
438
+ /// id, and that gives us the right to access any information in
439
+ /// the adt-def (including, e.g., the length of the various
440
+ /// vectors).
430
441
fn encode_field ( & mut self ,
431
- ( adt_def_id, variant_index, field_index) :
432
- ( DefId , usize , usize ) ) {
442
+ ( adt_def_id, Untracked ( ( variant_index, field_index) ) ) :
443
+ ( DefId , Untracked < ( usize , usize ) > ) ) {
433
444
let ecx = self . ecx ( ) ;
434
445
let def = ecx. tcx . lookup_adt_def ( adt_def_id) ;
435
446
let variant = & def. variants [ variant_index] ;
0 commit comments