@@ -38,7 +38,7 @@ use log::debug;
38
38
pub struct DecodeContext < ' a , ' tcx > {
39
39
opaque : opaque:: Decoder < ' a > ,
40
40
cdata : Option < & ' a CrateMetadata > ,
41
- sess : Option < & ' a Session > ,
41
+ sess : Option < & ' tcx Session > ,
42
42
tcx : Option < TyCtxt < ' tcx > > ,
43
43
44
44
// Cache the last used source_file for translating spans as an optimization.
@@ -54,10 +54,8 @@ pub struct DecodeContext<'a, 'tcx> {
54
54
pub trait Metadata < ' a , ' tcx > : Copy {
55
55
fn raw_bytes ( self ) -> & ' a [ u8 ] ;
56
56
fn cdata ( self ) -> Option < & ' a CrateMetadata > { None }
57
- fn sess ( self ) -> Option < & ' a Session > { None }
58
- fn tcx ( self ) -> Option < TyCtxt < ' tcx > > {
59
- None
60
- }
57
+ fn sess ( self ) -> Option < & ' tcx Session > { None }
58
+ fn tcx ( self ) -> Option < TyCtxt < ' tcx > > { None }
61
59
62
60
fn decoder ( self , pos : usize ) -> DecodeContext < ' a , ' tcx > {
63
61
let tcx = self . tcx ( ) ;
@@ -82,13 +80,13 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for &'a MetadataBlob {
82
80
}
83
81
84
82
85
- impl < ' a , ' tcx > Metadata < ' a , ' tcx > for ( & ' a MetadataBlob , & ' a Session ) {
83
+ impl < ' a , ' tcx > Metadata < ' a , ' tcx > for ( & ' a MetadataBlob , & ' tcx Session ) {
86
84
fn raw_bytes ( self ) -> & ' a [ u8 ] {
87
85
let ( blob, _) = self ;
88
86
& blob. 0
89
87
}
90
88
91
- fn sess ( self ) -> Option < & ' a Session > {
89
+ fn sess ( self ) -> Option < & ' tcx Session > {
92
90
let ( _, sess) = self ;
93
91
Some ( sess)
94
92
}
@@ -104,14 +102,14 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for &'a CrateMetadata {
104
102
}
105
103
}
106
104
107
- impl < ' a , ' tcx > Metadata < ' a , ' tcx > for ( & ' a CrateMetadata , & ' a Session ) {
105
+ impl < ' a , ' tcx > Metadata < ' a , ' tcx > for ( & ' a CrateMetadata , & ' tcx Session ) {
108
106
fn raw_bytes ( self ) -> & ' a [ u8 ] {
109
107
self . 0 . raw_bytes ( )
110
108
}
111
109
fn cdata ( self ) -> Option < & ' a CrateMetadata > {
112
110
Some ( self . 0 )
113
111
}
114
- fn sess ( self ) -> Option < & ' a Session > {
112
+ fn sess ( self ) -> Option < & ' tcx Session > {
115
113
Some ( & self . 1 )
116
114
}
117
115
}
@@ -136,11 +134,11 @@ impl<'a, 'tcx, T: Decodable> Lazy<T> {
136
134
}
137
135
}
138
136
139
- impl < ' a , ' tcx , T : Decodable > LazySeq < T > {
137
+ impl < ' a : ' x , ' tcx : ' x , ' x , T : Decodable > LazySeq < T > {
140
138
pub fn decode < M : Metadata < ' a , ' tcx > > (
141
139
self ,
142
140
meta : M ,
143
- ) -> impl Iterator < Item = T > + Captures < ' tcx > + ' a {
141
+ ) -> impl Iterator < Item = T > + Captures < ' a > + Captures < ' tcx > + ' x {
144
142
let mut dcx = meta. decoder ( self . position ) ;
145
143
dcx. lazy_state = LazyState :: NodeStart ( self . position ) ;
146
144
( 0 ..self . len ) . map ( move |_| T :: decode ( & mut dcx) . unwrap ( ) )
0 commit comments