-
-
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
25
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,025
−58
Open
Add field representing types #146307
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
f4deee8
parse field representing types
BennoLossin 3964064
lower field representing types to HIR
BennoLossin fa01a5a
lower field representing types to MIR
BennoLossin 91fc32f
add field representing types to rustc_public
BennoLossin 16518ea
add `Field` trait, lang items and `field_offset` intrinsic
BennoLossin 8165885
add builtin impl of `Field` for field representing types
BennoLossin 6e5ece2
add feature gate test
BennoLossin a316f48
add run-pass tests
BennoLossin 77552df
test incoherent impls
BennoLossin 08b3eb5
deny accessing FRTs of private fields
BennoLossin 9f21c44
deny manual impls of the `Field` trait
BennoLossin 5eb5d85
deny auto trait and drop impls for FRTs
BennoLossin ade5e54
do not impl `Field` for FRTs of `repr(packed)` types
BennoLossin c9f5cf7
tests: fix ui output
BennoLossin a47a569
tests: check auto traits and `Copy` for FRTs
BennoLossin b6a61d1
consolidate tests
BennoLossin e884a76
tests: more nonexistent
BennoLossin 0b61443
tests: add invalid syntax
BennoLossin d8e6a58
tests: fix symbol generation
BennoLossin 5cbacb0
tests: add nonexistent tuple fields
BennoLossin e91a133
tests: expect(incomplete_features) instead of allow
BennoLossin 9c53c90
tests: add offset function
BennoLossin 0b9d029
tests: bad normalization case for next-solver
BennoLossin 9847fc6
tests: fix debuginfo
BennoLossin 74e8f2c
replace `#[rustc_do_not_implement_via_object]` with `#[rustc_dyn_inco…
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.