-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Add field representing types #146307
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
Open
BennoLossin
wants to merge
27
commits into
rust-lang:main
Choose a base branch
from
BennoLossin:field-projections
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,017
−53
Open
Add field representing types #146307
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
66051e0
parse field representing types
BennoLossin f4df71a
lower field representing types to HIR
BennoLossin 00e75af
lower field representing types to MIR
BennoLossin 9b2f000
add field representing types to rustc_public
BennoLossin dde145a
add `Field` trait, lang items and `field_offset` intrinsic
BennoLossin 66cc751
add builtin impl of `Field` for field representing types
BennoLossin 6054dad
add feature gate test
BennoLossin 29bf51f
add run-pass tests
BennoLossin 8a68e63
test incoherent impls
BennoLossin 51242ce
deny accessing FRTs of private fields
BennoLossin 84f2d28
deny manual impls of the `Field` trait
BennoLossin 9dbc512
deny auto trait and drop impls for FRTs
BennoLossin 4a6b88b
do not impl `Field` for FRTs of `repr(packed)` types
BennoLossin 93757a9
fixup! lower field representing types to HIR
BennoLossin 6ab22f9
fixup! lower field representing types to MIR
BennoLossin 5d0b02d
tests: fix ui output
BennoLossin 6512db1
tests: check auto traits and `Copy` for FRTs
BennoLossin a520352
consolidate tests
BennoLossin 37be83f
fixup! lower field representing types to MIR
BennoLossin 1faa03d
tests: more nonexistent
BennoLossin 31a061c
tests: add invalid syntax
BennoLossin f8c84a3
tests: fix symbol generation
BennoLossin 306b84e
tests: add nonexistent tuple fields
BennoLossin 945cfb4
tests: expect(incomplete_features) instead of allow
BennoLossin 72022ee
tests: add offset function
BennoLossin 66149ce
tests: bad normalization case for next-solver
BennoLossin bf27d90
tests: fix debuginfo
BennoLossin 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 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
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
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
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 |
|---|---|---|
|
|
@@ -261,6 +261,17 @@ pub(super) fn check_item<'tcx>( | |
| .with_span_label(sp, "auto trait") | ||
| .emit()); | ||
| } | ||
| if is_auto && let rustc_hir::TyKind::FieldOf(..) = impl_.self_ty.kind { | ||
| res = res.and(Err(tcx | ||
| .dcx() | ||
| .struct_span_err( | ||
| item.span, | ||
| "impls of auto traits for field representing types not supported", | ||
| ) | ||
| .with_span_label(impl_.self_ty.span, "field representing type") | ||
| .with_span_label(of_trait.trait_ref.path.span, "auto trait") | ||
| .emit())); | ||
| } | ||
|
Comment on lines
+264
to
+274
Contributor
Author
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 feels pretty hacky, but I copied this from the previous version. |
||
| match header.polarity { | ||
| ty::ImplPolarity::Positive => { | ||
| res = res.and(check_impl(tcx, item, impl_)); | ||
|
|
||
Oops, something went wrong.
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.
Not sure if this is okay, but I need this in order for
FieldId(which containsFieldIdxandVariantIdx) to implementserde::Serialize. This is becauseFieldIdis needed inRigidTy, which derivesserde::Serialize.