Repository navigation
&{mut} T may (briefly) write garbage
#161452
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1665,10 +1665,10 @@ const _: () = (); | |
| /// not violate these invariants. The full requirements are stronger, as the reference generally | ||
| /// must point to data that is safe to use as type `T`. | ||
| /// | ||
| /// It is not decided yet whether unsafe code may violate these invariants temporarily on internal | ||
| /// data. As a consequence, unsafe code which violates these invariants temporarily on internal data | ||
| /// may be unsound or become unsound in future versions of Rust depending on how this question is | ||
| /// decided. | ||
| /// Unsafe code is allowed to temporarily violate type validity invariants on internal data that | ||
| /// cannot be otherwise observed; that is, arbitrary data can be written into the pointed-to bytes | ||
| /// of a `&mut T` even if it would constitute an invalid value of `T` or set the discriminant of a | ||
| /// wrapping enum to an invalid value, so long as everything is restored before the code returns. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume unwinding with a value in this state is also forbidden? That is part of the FCP at least: rust-lang/unsafe-code-guidelines#621 (comment) It is not clear to me if unwinding is always considered a form of "returning", so something like Ralf's reword would be useful here for more reasons than just breaking up the sentence. |
||
| /// | ||
| /// [allocation]: ptr#allocation | ||
| #[stable(feature = "rust1", since = "1.0.0")] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
This is a monster sentence.
Also can you make "pointed-to bytes" link to this?
View changes since the review