Uh oh!
There was an error while loading. Please reload this page.
Make pointer related code in std and compiler nicer - #100746
Make pointer related code in std and compiler nicer#100746WaffleLapkin wants to merge 5 commits into
std and compiler nicer#100746Conversation
...replacing `.cast().wrapping_offset().cast()` & similar code.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
bors
commented
Aug 20, 2022
☔ The latest upstream changes (presumably #100793) made this pull request unmergeable. Please resolve the merge conflicts. |
scottmcm
commented
Aug 20, 2022
You probably did, but this is a very long scroll bar. Would you mind sending it as a couple of different PRs instead? (Especially since there's some conflicts now too, which is particularly likely with a big PR.) For example, a PR that's just "hey, I replaced offset with add/sub in the way that's obviously correct" is something that I could easily scan and agree "yup, definitely" and sign-off on it quickly. But once there's more complicated changes, like types of local variables, I feel like I should be thinking about it more before signing off. For example, in - let d1 = ((n % 100) as isize) << 1;+ let d1 = ((n % 100) << 1) as usize;you probably got it correct, but now that shift is possibly working in a different type, so it's not "obviously correct" -- it needs contextual analysis to be sure. So separating those out into the lots-of-the-same-easy-change review and the fewer-more-careful-changes review would be a big help. @rustbot author |
WaffleLapkin
commented
Aug 20, 2022
Sure, I'll split this up |
Refactor some `std` code that works with pointer offstes This PR replaces `pointer::offset` in standard library with `pointer::add` and `pointer::sub`, [re]moving some casts and using `.addr()` while we are at it. This is a more complicated refactor than all other sibling PRs, so take a closer look when reviewing, please 😃 (though I've checked this multiple times and it looks fine). r? ``@scottmcm`` _split off from rust-lang#100746, continuation of #100822_
Refactor some `std` code that works with pointer offstes This PR replaces `pointer::offset` in standard library with `pointer::add` and `pointer::sub`, [re]moving some casts and using `.addr()` while we are at it. This is a more complicated refactor than all other sibling PRs, so take a closer look when reviewing, please 😃 (though I've checked this multiple times and it looks fine). r? ```@scottmcm``` _split off from rust-lang#100746, continuation of #100822_
Refactor some `std` code that works with pointer offstes This PR replaces `pointer::offset` in standard library with `pointer::add` and `pointer::sub`, [re]moving some casts and using `.addr()` while we are at it. This is a more complicated refactor than all other sibling PRs, so take a closer look when reviewing, please 😃 (though I've checked this multiple times and it looks fine). r? ````@scottmcm```` _split off from rust-lang#100746, continuation of #100822_
This PR makes code that works with pointer a little nicer. Namely it
wrapping_byte_add,wrapping_byte_subandbyte_add(replacing explicit casts)is_alignedandis_aligned_to(replacing hand-written alignment checks)pointer::offsetwithaddandsub(generally making code cleaner)r? @scottmcm