-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make pointer related code in std
and compiler nicer
#100746
Conversation
...replacing `.cast().wrapping_offset().cast()` & similar code.
This comment was marked as resolved.
This comment was marked as resolved.
796e0a0
to
91969cf
Compare
This comment has been minimized.
This comment has been minimized.
91969cf
to
e055e60
Compare
☔ The latest upstream changes (presumably #100793) made this pull request unmergeable. Please resolve the merge conflicts. |
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 |
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_sub
andbyte_add
(replacing explicit casts)is_aligned
andis_aligned_to
(replacing hand-written alignment checks)pointer::offset
withadd
andsub
(generally making code cleaner)r? @scottmcm