rust
rust copied to clipboard
cleanup code w/ pointers in std a little
Use pointer methods (byte_add
, null_mut
, etc) to make code in std a little nicer.
Hey! It looks like you've submitted a new PR for the library teams!
If this PR contains changes to any rust-lang/rust
public library APIs then please comment with @rustbot label +T-libs-api -T-libs
to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.
Examples of T-libs-api
changes:
- Stabilizing library features
- Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
- Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
- Changing public documentation in ways that create new stability guarantees
- Changing observable runtime behavior of library APIs
r? @scottmcm
(rust-highfive has picked a reviewer for you, use r? to override)
@rustbot ready
Thanks!
@bors r+
:pushpin: Commit 6d6979b74b14b3dead628b5014030265e5c80d09 has been approved by scottmcm
It is now in the queue for this repository.
@bors r- failed in a rollup: https://github.com/rust-lang/rust/pull/100108#issuecomment-1204401889
It was an interesting problem:
- let is_aligned = |p| -> bool { 0 == p as usize & (Self::align_of() - 1) };
+ let is_aligned = |p| -> bool { 0 == p.addr() & (Self::align_of() - 1) };
Method resolution doesn't work with unknown types and type information doesn't really flow backwards into a closure, so a type for p
can't be inferred anymore whereas it could be before. I've added an explicit type, so it should be fine now.
@rustbot ready
Thanks! This looks good.
@bors r+
:pushpin: Commit d52ed8234e8a9b8f3b988b63dae44e82827fcbda has been approved by scottmcm
It is now in the queue for this repository.