-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
References refer to allocated objects #116677
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a208662
References refer to allocated objects
joshlf 4f0192a
Update primitive_docs.rs
joshlf 39660c4
Update library/core/src/primitive_docs.rs
joshlf 55487e2
Update primitive_docs.rs
joshlf 1a0309a
Update primitive_docs.rs
joshlf c2c6e33
Update primitive_docs.rs
joshlf b867c7c
Update primitive_docs.rs
joshlf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think I like all the text here, but one thing concerns me is that "did not author themselves" sounds to me like it could easily be interpreted as "it's ok to do this in your own code", and I'm not sure if that's the case. Have we made a decision on the validity rules for fat pointers?
@WaffleLapkin mentioned in triage that there might be static alignment rules ever for
T: ?Sized
(maybe even with future traits like rust-lang/rfcs#3319 ), so I think we want to make sure that&[Align8]
can have a validity invariant of align-8 for the address part, at least?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.
Hmm, that the same thing probably comes up for size niches too. Would it ever be possible for there to be a statically-known min size for a DST, allowing a validity invariant on the range of the address as well? (Like how we could have a validity invariant that
&i32
cannot beusize::MAX
.)I'll link to https://github.com/rust-lang/rfcs/pull/3204/files#diff-6c49cfff6f910d914acb2e9bfa78ad35155e6800b9114ef91e6e47c7db914b7cR97 here that wants to use a bunch of this kind of thing.
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 only meant to put a lower bound of the safety invariant, but not fix the validity invariant at all. So this only says what you can assume about data coming on over an ABI boundary, but does not say anything about what you may do internally in your own code.
I'm open for suggestions for how to word this more clearly.