@@ -23,7 +23,7 @@ use rustc_data_structures::profiling::SelfProfilerRef;
2323use rustc_data_structures:: sync:: Lock ;
2424use rustc_index:: vec:: IndexVec ;
2525use rustc_serialize:: opaque:: { FileEncodeResult , FileEncoder , IntEncodedWithFixedSize , MemDecoder } ;
26- use rustc_serialize:: { Decodable , Encodable } ;
26+ use rustc_serialize:: { Decodable , Decoder , Encodable } ;
2727use smallvec:: SmallVec ;
2828use std:: convert:: TryInto ;
2929use std:: hash:: { Hash , Hasher } ;
@@ -128,14 +128,20 @@ impl<K: DepKind> SerializedDepGraph<K> {
128128 }
129129
130130 #[ 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 > + ' _ {
132135 // 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) {
134137 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) ) )
136140 } else {
137- Vec :: new ( )
141+ None
138142 }
143+ . into_iter ( )
144+ . flatten ( )
139145 }
140146
141147 pub fn node_count ( & self ) -> usize {
0 commit comments