@@ -2,6 +2,7 @@ use crate::schema::*;
22
33use rustc:: hir:: def_id:: { DefId , DefIndex , DefIndexAddressSpace } ;
44use rustc_serialize:: opaque:: Encoder ;
5+ use std:: marker:: PhantomData ;
56use std:: u32;
67use log:: debug;
78
@@ -74,24 +75,26 @@ impl FixedSizeEncoding for u32 {
7475/// `u32::MAX`. Whenever an index is visited, we fill in the
7576/// appropriate spot by calling `record_position`. We should never
7677/// visit the same index twice.
77- pub struct Index {
78- positions : [ Vec < u8 > ; 2 ]
78+ pub struct Index < ' tcx > {
79+ positions : [ Vec < u8 > ; 2 ] ,
80+ _marker : PhantomData < & ' tcx ( ) > ,
7981}
8082
81- impl Index {
82- pub fn new ( ( max_index_lo, max_index_hi) : ( usize , usize ) ) -> Index {
83+ impl Index < ' tcx > {
84+ pub fn new ( ( max_index_lo, max_index_hi) : ( usize , usize ) ) -> Self {
8385 Index {
8486 positions : [ vec ! [ 0xff ; max_index_lo * 4 ] ,
8587 vec ! [ 0xff ; max_index_hi * 4 ] ] ,
88+ _marker : PhantomData ,
8689 }
8790 }
8891
89- pub fn record ( & mut self , def_id : DefId , entry : Lazy < Entry < ' _ > > ) {
92+ pub fn record ( & mut self , def_id : DefId , entry : Lazy < Entry < ' tcx > > ) {
9093 assert ! ( def_id. is_local( ) ) ;
9194 self . record_index ( def_id. index , entry) ;
9295 }
9396
94- pub fn record_index ( & mut self , item : DefIndex , entry : Lazy < Entry < ' _ > > ) {
97+ pub fn record_index ( & mut self , item : DefIndex , entry : Lazy < Entry < ' tcx > > ) {
9598 assert ! ( entry. position < ( u32 :: MAX as usize ) ) ;
9699 let position = entry. position as u32 ;
97100 let space_index = item. address_space ( ) . index ( ) ;
@@ -107,7 +110,7 @@ impl Index {
107110 position. write_to_bytes_at ( positions, array_index)
108111 }
109112
110- pub fn write_index ( & self , buf : & mut Encoder ) -> LazySeq < Index > {
113+ pub fn write_index ( & self , buf : & mut Encoder ) -> LazySeq < Self > {
111114 let pos = buf. position ( ) ;
112115
113116 // First we write the length of the lower range ...
@@ -121,7 +124,7 @@ impl Index {
121124 }
122125}
123126
124- impl < ' tcx > LazySeq < Index > {
127+ impl LazySeq < Index < ' tcx > > {
125128 /// Given the metadata, extract out the offset of a particular
126129 /// DefIndex (if any).
127130 #[ inline( never) ]
0 commit comments