Make use of [wrapping_]byte_{add,sub}#100819
Conversation
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
There was a problem hiding this comment.
This change is fine, but I definitely look at it and wonder if it can be
| $self.end = $self.end.wrapping_byte_offset(-$n); | |
| $self.end = $self.end.wrapping_byte_sub($n); |
since it's explicitly shrink.
There was a problem hiding this comment.
I haven't done this originally because ($n): isize, but I've just checked and it seems that this is only called with literals and smt as isize so this change makes sense.
|
@bors r+ rollup |
|
📌 Commit b2326ae96398eb936351a7364dc9526730f4814a has been approved by It is now in the queue for this repository. |
|
☔ The latest upstream changes (presumably #100881) made this pull request unmergeable. Please resolve the merge conflicts. |
...replacing `.cast().wrapping_offset().cast()` & similar code.
b2326ae to
53565b2
Compare
|
rebased to make merge conflicts go away |
|
@bors r+ |
… r=scottmcm
Make use of `[wrapping_]byte_{add,sub}`
These new methods trivially replace old `.cast().wrapping_offset().cast()` & similar code.
Note that [`arith_offset`](https://doc.rust-lang.org/std/intrinsics/fn.arith_offset.html) and `wrapping_offset` are the same thing.
r? `@scottmcm`
_split off from #100746_
… r=scottmcm
Make use of `[wrapping_]byte_{add,sub}`
These new methods trivially replace old `.cast().wrapping_offset().cast()` & similar code.
Note that [`arith_offset`](https://doc.rust-lang.org/std/intrinsics/fn.arith_offset.html) and `wrapping_offset` are the same thing.
r? ``@scottmcm``
_split off from #100746_
… r=scottmcm
Make use of `[wrapping_]byte_{add,sub}`
These new methods trivially replace old `.cast().wrapping_offset().cast()` & similar code.
Note that [`arith_offset`](https://doc.rust-lang.org/std/intrinsics/fn.arith_offset.html) and `wrapping_offset` are the same thing.
r? ```@scottmcm```
_split off from #100746_
|
@bors rollup=iffy #100947 (comment) |
|
Can this PR be un- |
|
@bors rollup=maybe |
… r=scottmcm
Make use of `[wrapping_]byte_{add,sub}`
These new methods trivially replace old `.cast().wrapping_offset().cast()` & similar code.
Note that [`arith_offset`](https://doc.rust-lang.org/std/intrinsics/fn.arith_offset.html) and `wrapping_offset` are the same thing.
r? `@scottmcm`
_split off from #100746_
Rollup of 8 pull requests Successful merges: - rust-lang#98304 (Add MaybeUninit memset test) - rust-lang#98801 (Add a `File::create_new` constructor) - rust-lang#99821 (Remove separate indexing of early-bound regions) - rust-lang#100239 (remove an ineffective check in const_prop) - rust-lang#100337 (Stabilize `std::io::read_to_string`) - rust-lang#100819 (Make use of `[wrapping_]byte_{add,sub}`) - rust-lang#100934 (Remove a panicking branch from `fmt::builders::PadAdapter`) - rust-lang#101000 (Separate CountIsStar from CountIsParam in rustc_parse_format.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
| self.end = unsafe { arith_offset(self.end as *const i8, -1) as *mut T }; | ||
| self.end = self.ptr.wrapping_byte_sub(1); |
There was a problem hiding this comment.
Is this right? It's using self.ptr instead of self.end
|
I think there's a bug in this PR -- see #101235. |
fix into_iter on ZST Fixes rust-lang#101235 Thanks to `@ChrisDenton` for [spotting the problem](rust-lang#100819 (review)).
…leftovers, r=scottmcm Some more cleanup in `core` - remove some integer casts from slice iter (proposed in rust-lang#100819 (comment)) - replace `as usize` casts with `usize::from` in slice sort (proposed in rust-lang#100822 (comment)) r? `@scottmcm`
fix into_iter on ZST Fixes rust-lang/rust#101235 Thanks to `@ChrisDenton` for [spotting the problem](rust-lang/rust#100819 (review)).
…, r=scottmcm Some more cleanup in `core` - remove some integer casts from slice iter (proposed in rust-lang/rust#100819 (comment)) - replace `as usize` casts with `usize::from` in slice sort (proposed in rust-lang/rust#100822 (comment)) r? `@scottmcm`
These new methods trivially replace old
.cast().wrapping_offset().cast()& similar code.Note that
arith_offsetandwrapping_offsetare the same thing.r? @scottmcm
split off from #100746