@@ -120,6 +120,17 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
120120 }
121121 }
122122
123+ /// Gets the provenances of all bytes (including from pointers) in a range.
124+ pub fn get_range (
125+ & self ,
126+ cx : & impl HasDataLayout ,
127+ range : AllocRange ,
128+ ) -> impl Iterator < Item = Prov > {
129+ let ptr_provs = self . range_ptrs_get ( range, cx) . iter ( ) . map ( |( _, p) | * p) ;
130+ let byte_provs = self . range_bytes_get ( range) . iter ( ) . map ( |( _, ( p, _) ) | * p) ;
131+ ptr_provs. chain ( byte_provs)
132+ }
133+
123134 /// Attempt to merge per-byte provenance back into ptr chunks, if the right fragments
124135 /// sit next to each other. Return `false` is that is not possible due to partial pointers.
125136 pub fn merge_bytes ( & mut self , cx : & impl HasDataLayout ) -> bool {
@@ -148,17 +159,6 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
148159 true
149160 }
150161
151- /// Gets the provenances of all bytes (including from pointers) in a range.
152- pub fn get_range (
153- & self ,
154- cx : & impl HasDataLayout ,
155- range : AllocRange ,
156- ) -> impl Iterator < Item = ( Size , Prov ) > {
157- let ptr_provs = self . range_ptrs_get ( range, cx) . to_owned ( ) ;
158- let byte_provs = self . range_bytes_get ( range) . into_iter ( ) . map ( |& ( s, ( p, _) ) | ( s, p) ) ;
159- ptr_provs. into_iter ( ) . chain ( byte_provs)
160- }
161-
162162 /// Check if there is ptr-sized provenance at the given index.
163163 /// Does not mean anything for bytewise provenance! But can be useful as an optimization.
164164 pub fn get_ptr ( & self , offset : Size ) -> Option < Prov > {
0 commit comments