-
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
Update reference safety requirements #125021
Conversation
Per rust-lang#116677 (comment), the language as written promises too much. This PR relaxes the language to be consistent with current semantics. If and when rust-lang#117945 is implemented, we can revert to the old language.
This is probably good even with #117945, as it avoids having to explain what "dereferenceable for 0 bytes" means. But maybe we should add that the reference is non-null? This is always true, and will remain so. |
Updated the PR. |
Cc @rust-lang/opsem @rust-lang/lang -- I think this just clarifies the existing rules @bors r+ rollup |
Update reference safety requirements Per rust-lang#116677 (comment), the language as written promises too much. This PR relaxes the language to be consistent with current semantics. If and when rust-lang#117945 is implemented, we can revert to the old language. While we're here, we also require that references be non-null. cc `@RalfJung`
…llaumeGomez Rollup of 4 pull requests Successful merges: - rust-lang#124807 (Migrate `run-make/rustdoc-io-error` to `rmake.rs`) - rust-lang#125021 (Update reference safety requirements) - rust-lang#125030 (Fix some minor issues from the ui-test auto-porting) - rust-lang#125036 (solve: all "non-structural" logging to trace) r? `@ghost` `@rustbot` modify labels: rollup
…llaumeGomez Rollup of 4 pull requests Successful merges: - rust-lang#125021 (Update reference safety requirements) - rust-lang#125022 (Migrate rustdoc scrape examples ordering) - rust-lang#125030 (Fix some minor issues from the ui-test auto-porting) - rust-lang#125036 (solve: all "non-structural" logging to trace) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#125021 - joshlf:patch-11, r=RalfJung Update reference safety requirements Per rust-lang#116677 (comment), the language as written promises too much. This PR relaxes the language to be consistent with current semantics. If and when rust-lang#117945 is implemented, we can revert to the old language. While we're here, we also require that references be non-null. cc ``@RalfJung``
Now that [1] is completed, zero-sized accesses no longer require provenance. Per [2], zero-sized references are no longer required to be dereferenceable, and so may not carry provenance. This commit updates `Ptr`'s invariants to not require provenance or a valid allocation when its referent is zero-sized. [1] rust-lang/rust#117945 [2] rust-lang/rust#125021
Now that [1] is completed, zero-sized accesses no longer require provenance. Per [2], zero-sized references are no longer required to be dereferenceable, and so may not carry provenance. This commit updates `Ptr`'s invariants to not require provenance or a valid allocation when its referent is zero-sized. [1] rust-lang/rust#117945 [2] rust-lang/rust#125021 Closes #874
Now that [1] is completed, zero-sized accesses no longer require provenance. Per [2], zero-sized references are no longer required to be dereferenceable, and so may not carry provenance. This commit updates `Ptr`'s invariants to not require provenance or a valid allocation when its referent is zero-sized. [1] rust-lang/rust#117945 [2] rust-lang/rust#125021 Closes #874
Per #116677 (comment), the language as written promises too much. This PR relaxes the language to be consistent with current semantics. If and when #117945 is implemented, we can revert to the old language.
While we're here, we also require that references be non-null.
cc @RalfJung