Uh oh!
There was an error while loading. Please reload this page.
More align_offset things - #44537
Conversation
rust-highfive
commented
Sep 13, 2017
(rust_highfive has picked a reviewer for you, use r? to override) |
3f8abb7 to
18ab95fCompare| let mut offset; | ||
| if align > 0 { | ||
| offset = cmp::min(usize_bytes - align, len); | ||
| let mut offset = unsafe { align_offset(ptr as *const _, usize_bytes) }; |
There was a problem hiding this comment.
Should this be using the inherent methods added in this PR?
There was a problem hiding this comment.
The compiler complained that it doesn't know the unstable feature (on stage0). This would become a mess of cfgs, so I opted to not do this here.
There was a problem hiding this comment.
Sounds like a stage0 inherent method on pointers which does the old method via casts and not(stage0) uses the intrinsic?
| /// remove me after the next release | ||
| pub fn align_offset(self, align: usize) -> usize { | ||
| unsafe { | ||
| intrinsics::align_offset(self as *const _, align) |
There was a problem hiding this comment.
This looks the same as the above function? I think the #[cfg] in the intrinsics module should be enough?
There was a problem hiding this comment.
It differs in the stability. I couldn't use the function within core without giving core the corresponding feature, which then complained about an unknown feature.
There was a problem hiding this comment.
I'm not sure I understand this? Can't the stage0 shim in the intrinsics module be just as unstable as the real intrinsic in non-stage0?
There was a problem hiding this comment.
I must have misread the error messages I got. It works now without duplicating the inherent methods. The intrinsics are still duplicated.
alexcrichton
commented
Sep 14, 2017
@bors: r+ |
bors
commented
Sep 14, 2017
📌 Commit 1462cab has been approved by |
alexcrichton
commented
Sep 16, 2017
@bors: rollup |
More `align_offset` things cc rust-lang#44488
bors
commented
Sep 16, 2017
☔ The latest upstream changes (presumably #43964) made this pull request unmergeable. Please resolve the merge conflicts. |
oli-obk
commented
Sep 17, 2017
Rebased |
alexcrichton
commented
Sep 17, 2017
@bors: r+ |
bors
commented
Sep 17, 2017
📌 Commit 2787a28 has been approved by |
More `align_offset` things cc rust-lang#44488
More `align_offset` things cc rust-lang#44488
make memrchr use align_offset I hope I did not screw that up... Cc @oli-obk who authored the original rust-lang#44537
cc #44488