-
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
Add flag to configure noalias
on Box<T>
#99436
Conversation
r? @fee1-dead (rust-highfive has picked a reviewer for you, use r? to override) |
26aaa45
to
09ac838
Compare
This comment has been minimized.
This comment has been minimized.
Wait, (Checking the code) ah, |
How about |
09ac838
to
200f3b8
Compare
noalias
on Box<T>
noalias
on Box<T>
The changes look good to me, but to make sure that it works, can you please add a test? (see this for info) |
200f3b8
to
a8253c4
Compare
I added a test to ensure that noalias doesn't get passed when the flag is set to no. Now that I think about it, I should add another test for the default case. |
To aid making an informed decision about the aliasing rules of box, give users an option to remove `noalias` from box.
So, I hope it works now. |
a8253c4
to
7c900c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me pending CI green.
@fee1-dead and it's green now 🎉 |
@bors r+ |
Rollup of 7 pull requests Successful merges: - rust-lang#98101 (stdlib support for Apple WatchOS) - rust-lang#99345 (Do not allow typeck children items to constrain outer RPITs) - rust-lang#99383 (Formalize defining_use_anchor) - rust-lang#99436 (Add flag to configure `noalias` on `Box<T>`) - rust-lang#99483 (Fix a numerical underflow in tuple wrap suggestion) - rust-lang#99485 (Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations) - rust-lang#99486 (Refactor: remove a string comparison between types in `check_str_addition`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The aliasing rules of
Box<T>
are still not decided, but currently,Box<T>
is unique and getsnoalias
. To aid making an informed decision about the future ofBox<T>
, this PR adds a flag-Zbox-noalias
to configurenoalias
forBox<T>
(for example, for benchmarking). The same flag already exists for&mut T
noalias
, where it was added because it was the problem of various miscompilations in LLVM.For more information, see rust-lang/unsafe-code-guidelines#326