-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Introduce CoercePointeeValidated for coherence checks at typeck stage #136107
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
Merged
bors
merged 6 commits into
rust-lang:master
from
dingxiangfei2009:coerce-pointee-wellformed
Feb 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
de405dc
introduce CoercePointeeWellformed for coherence checks at typeck stage
dingxiangfei2009 c067324
rename the trait to validity and place a feature gate afront
dingxiangfei2009 b943505
move repr(transparent) checks to coherence
dingxiangfei2009 1848343
block coerce_pointee_validated for stabilization
dingxiangfei2009 aea5595
fix the error code document
dingxiangfei2009 17026e2
Reword doc comment on `CoercePointeeValidated`
compiler-errors 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
rename the trait to validity and place a feature gate afront
- Loading branch information
commit c0673246371b1a5ecac940f1ea6418857f932d7c
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1284,14 +1284,23 @@ pub trait FnPtr: Copy + Clone { | |
/// } | ||
/// ``` | ||
#[rustc_builtin_macro(CoercePointee, attributes(pointee))] | ||
#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize)] | ||
#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize, coerce_pointee_validated)] | ||
#[unstable(feature = "derive_coerce_pointee", issue = "123430")] | ||
pub macro CoercePointee($item:item) { | ||
/* compiler built-in */ | ||
} | ||
|
||
/// A validation trait that is implemented on data with `derive(CoercePointee)` | ||
/// so that the compiler can enforce a set of rules that the target data must | ||
/// conform to in order for the derived behaviours are safe and useful for | ||
/// the purpose of the said macro. | ||
/// | ||
/// This trait will not ever be exposed for use as public part of the library | ||
/// and shall not ever be stabilised. | ||
#[cfg(not(bootstrap))] | ||
#[lang = "coerce_pointee_wellformed"] | ||
#[unstable(feature = "derive_coerce_pointee", issue = "123430")] | ||
#[lang = "coerce_pointee_validated"] | ||
#[unstable(feature = "coerce_pointee_validated", issue = "123430")] | ||
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. This doesn't need a tracking issue since it's never going to be stabilized. Just put |
||
#[doc(hidden)] | ||
pub trait CoercePointeeWellformed {} | ||
pub trait CoercePointeeValidated { | ||
/* compiler built-in */ | ||
} |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.