@@ -103,7 +103,8 @@ macro_rules! iterator { |
|
|
103 |
103 |
// so this new pointer is inside `self` and thus guaranteed to be non-null. |
104 |
104 |
unsafe { |
105 |
105 |
if_zst!(mut self, |
106 |
|
- len => *len = len.unchecked_sub(offset), |
|
106 |
+// Using the intrinsic directly avoids emitting a UbCheck |
|
107 |
+ len => *len = crate::intrinsics::unchecked_sub(*len, offset), |
107 |
108 |
_end => self.ptr = self.ptr.add(offset), |
108 |
109 |
); |
109 |
110 |
} |
@@ -119,7 +120,8 @@ macro_rules! iterator { |
|
|
119 |
120 |
// SAFETY: By our precondition, `offset` can be at most the |
120 |
121 |
// current length, so the subtraction can never overflow. |
121 |
122 |
len => unsafe { |
122 |
|
-*len = len.unchecked_sub(offset); |
|
123 |
+// Using the intrinsic directly avoids emitting a UbCheck |
|
124 |
+*len = crate::intrinsics::unchecked_sub(*len, offset); |
123 |
125 |
self.ptr |
124 |
126 |
}, |
125 |
127 |
// SAFETY: the caller guarantees that `offset` doesn't exceed `self.len()`, |