This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 75dc99b
authored
Rollup merge of rust-lang#122461 - the8472:fix-step-forward-unchecked, r=Amanieu
fix unsoundness in Step::forward_unchecked for signed integers
Fixes rust-lang#122420
```rust
pub fn foo(a: i8, b: u8) -> i8 {
unsafe { a.checked_add_unsigned(b).unwrap_unchecked() }
}
```
still compiles down to a single arithmetic instruction ([godbolt](https://rust.godbolt.org/z/qsd3xYWfE)).
But we may be losing some loop optimizations if llvm can no longer easily derive that it's a finite counted loop from the no-wrapping flags.File tree
3 files changed
+34
-3
lines changed- library/core
- src/iter
- tests/iter
- src/tools/miri/tests/pass/shims
3 files changed
+34
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
188 | 205 | | |
189 | 206 | | |
190 | 207 | | |
| |||
197 | 214 | | |
198 | 215 | | |
199 | 216 | | |
| 217 | + | |
| 218 | + | |
200 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
201 | 223 | | |
202 | 224 | | |
203 | 225 | | |
| |||
238 | 260 | | |
239 | 261 | | |
240 | 262 | | |
| 263 | + | |
241 | 264 | | |
242 | 265 | | |
243 | 266 | | |
| |||
270 | 293 | | |
271 | 294 | | |
272 | 295 | | |
| 296 | + | |
273 | 297 | | |
274 | 298 | | |
275 | 299 | | |
| |||
334 | 358 | | |
335 | 359 | | |
336 | 360 | | |
| 361 | + | |
337 | 362 | | |
338 | 363 | | |
339 | 364 | | |
| |||
359 | 384 | | |
360 | 385 | | |
361 | 386 | | |
| 387 | + | |
362 | 388 | | |
363 | 389 | | |
364 | 390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
328 | 333 | | |
329 | 334 | | |
330 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
0 commit comments