@@ -23,7 +23,7 @@ use rustc_data_structures::profiling::SelfProfilerRef;
23
23
use rustc_data_structures:: sync:: Lock ;
24
24
use rustc_index:: vec:: IndexVec ;
25
25
use rustc_serialize:: opaque:: { FileEncodeResult , FileEncoder , IntEncodedWithFixedSize , MemDecoder } ;
26
- use rustc_serialize:: { Decodable , Encodable } ;
26
+ use rustc_serialize:: { Decodable , Decoder , Encodable } ;
27
27
use smallvec:: SmallVec ;
28
28
use std:: convert:: TryInto ;
29
29
use std:: hash:: { Hash , Hasher } ;
@@ -128,14 +128,20 @@ impl<K: DepKind> SerializedDepGraph<K> {
128
128
}
129
129
130
130
#[ inline]
131
- pub fn edge_targets_from ( & self , source : SerializedDepNodeIndex ) -> Vec < SerializedDepNodeIndex > {
131
+ pub fn edge_targets_from (
132
+ & self ,
133
+ source : SerializedDepNodeIndex ,
134
+ ) -> impl Iterator < Item = SerializedDepNodeIndex > + ' _ {
132
135
// The encoder has checked that there is no padding there.
133
- if let Some ( ref mut decoder) = self . decoder_at ( source) {
136
+ if let Some ( mut decoder) = self . decoder_at ( source) {
134
137
decoder. set_position ( std:: mem:: size_of :: < Fingerprint > ( ) ) ;
135
- Decodable :: decode ( decoder)
138
+ let len = decoder. read_usize ( ) ;
139
+ Some ( ( 0 ..len) . map ( move |_| SerializedDepNodeIndex :: decode ( & mut decoder) ) )
136
140
} else {
137
- Vec :: new ( )
141
+ None
138
142
}
143
+ . into_iter ( )
144
+ . flatten ( )
139
145
}
140
146
141
147
pub fn node_count ( & self ) -> usize {
0 commit comments