make raw_eq precondition more restrictive#99511
Conversation
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
14 days without review, let's re-roll the dice... |
Co-authored-by: Nicholas Nethercote <n.nethercote@gmail.com>
wesleywiser
left a comment
There was a problem hiding this comment.
Is there anything we should do to advertise that the safety invariant (at least, as documented) on this intrinsic has been updated?
|
@bors r+ rollup |
I don't think so. It's an intrinsic, and a relatively obscure one. |
…iaskrgr Rollup of 13 pull requests Successful merges: - rust-lang#93896 (rustdoc: make item-infos dimmer on dark theme) - rust-lang#99337 (rustdoc: simplify highlight.rs) - rust-lang#99421 (add crt-static for android) - rust-lang#99500 (Fix flags when using clang as linker for Fuchsia) - rust-lang#99511 (make raw_eq precondition more restrictive) - rust-lang#99992 (Add `x.sh` and `x.ps1` shell scripts) - rust-lang#100112 (Fix test: chunks_mut_are_send_and_sync) - rust-lang#100203 (provide correct size hint for unsupported platform `CommandArgs`) - rust-lang#100307 (Fix rust-lang#96847) - rust-lang#100350 (Stringify non-shorthand visibility correctly) - rust-lang#100374 (Improve crate selection on rustdoc search results page) - rust-lang#100392 (Simplify visitors) - rust-lang#100418 (Add stability attributes to BacktraceStatus variants) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Specifically, don't allow comparing pointers that way. Comparing pointers is subtle because you have to talk about what happens to the provenance.
This matches what Miri already implements, and all existing users are fine with this.
If raw_eq on pointers is ever desired, we can adjust the intrinsic spec and Miri implementation as needed, but for now that seems just unnecessary. Also, this is a const intrinsic, and in const, comparing pointers this way is not possible -- so if we allow the intrinsic to compare pointers in general, we need to impose an extra restrictions saying that in const-context, pointers are not okay.