@@ -37,8 +37,9 @@ impl ProvenanceMap {
37
37
/// indeed that is how codegen treats them).
38
38
///
39
39
/// Only exposed with `AllocId` provenance, since it panics if there is bytewise provenance.
40
+ #[ inline]
40
41
pub fn ptrs ( & self ) -> & SortedMap < Size , AllocId > {
41
- assert ! ( self . bytes. is_empty( ) ) ;
42
+ debug_assert ! ( self . bytes. is_empty( ) ) ;
42
43
& self . ptrs
43
44
}
44
45
}
@@ -106,7 +107,11 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
106
107
let start = range. start ;
107
108
let end = range. end ( ) ;
108
109
// Clear the bytewise part -- this is easy.
109
- self . bytes . remove_range ( start..end) ;
110
+ if Prov :: OFFSET_IS_ADDR {
111
+ self . bytes . remove_range ( start..end) ;
112
+ } else {
113
+ debug_assert ! ( self . bytes. is_empty( ) ) ;
114
+ }
110
115
111
116
// For the ptr-sized part, find the first (inclusive) and last (exclusive) byte of
112
117
// provenance that overlaps with the given range.
@@ -167,7 +172,6 @@ pub struct ProvenanceCopy<Prov> {
167
172
}
168
173
169
174
impl < Prov : Provenance > ProvenanceMap < Prov > {
170
- #[ instrument( skip( self , cx) , level = "debug" ) ]
171
175
pub fn prepare_copy (
172
176
& self ,
173
177
src : AllocRange ,
@@ -225,7 +229,11 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
225
229
trace ! ( "no start overlapping entry" ) ;
226
230
}
227
231
// Then the main part, bytewise provenance from `self.bytes`.
228
- bytes. extend ( self . bytes . range ( src. start ..src. end ( ) ) ) ;
232
+ if Prov :: OFFSET_IS_ADDR {
233
+ bytes. extend ( self . bytes . range ( src. start ..src. end ( ) ) ) ;
234
+ } else {
235
+ debug_assert ! ( self . bytes. is_empty( ) ) ;
236
+ }
229
237
// And finally possibly parts of a pointer at the end.
230
238
if let Some ( entry) = self . range_get_ptrs ( alloc_range ( src. end ( ) , Size :: ZERO ) , cx) . first ( ) {
231
239
if !Prov :: OFFSET_IS_ADDR {
@@ -266,6 +274,10 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
266
274
/// to be clear of provenance.
267
275
pub fn apply_copy ( & mut self , copy : ProvenanceCopy < Prov > ) {
268
276
self . ptrs . insert_presorted ( copy. dest_ptrs ) ;
269
- self . bytes . insert_presorted ( copy. dest_bytes ) ;
277
+ if Prov :: OFFSET_IS_ADDR {
278
+ self . bytes . insert_presorted ( copy. dest_bytes ) ;
279
+ } else {
280
+ debug_assert ! ( copy. dest_bytes. is_empty( ) ) ;
281
+ }
270
282
}
271
283
}
0 commit comments