-
-
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
33
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.
Open
Add field representing types #146307
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
0f25806
parse field representing types
BennoLossin 2eadcf3
lower field representing types to HIR
BennoLossin f23a7e4
lower field representing types to MIR
BennoLossin 6f61de1
add field representing types to rustc_public
BennoLossin d006af8
add `Field` trait, lang items and `field_offset` intrinsic
BennoLossin 47a9976
add builtin impl of `Field` for field representing types
BennoLossin 2a5e3a9
add feature gate test
BennoLossin e57556a
add run-pass tests
BennoLossin b072258
test incoherent impls
BennoLossin 9519728
deny accessing FRTs of private fields
BennoLossin a90feec
deny manual impls of the `Field` trait
BennoLossin 15e679c
deny auto trait and drop impls for FRTs
BennoLossin 239c168
do not impl `Field` for FRTs of `repr(packed)` types
BennoLossin e9c9d0d
tests: fix ui output
BennoLossin d329a10
tests: check auto traits and `Copy` for FRTs
BennoLossin 3f54f94
consolidate tests
BennoLossin 267f9b0
tests: more nonexistent
BennoLossin 75ef23a
tests: add invalid syntax
BennoLossin 41d1c17
tests: fix symbol generation
BennoLossin a1047bb
tests: add nonexistent tuple fields
BennoLossin e335d2b
tests: expect(incomplete_features) instead of allow
BennoLossin 162c3fb
tests: add offset function
BennoLossin fea9b95
tests: bad normalization case for next-solver
BennoLossin b7d6a10
tests: fix debuginfo
BennoLossin ba07bb0
replace `#[rustc_do_not_implement_via_object]` with `#[rustc_dyn_inco…
BennoLossin 5d720bb
remove unresolved FieldId & fail on projections early
BennoLossin 2484c00
prevent FRTs of enums and unions from implementing the `Field` trait
BennoLossin fba9554
add test for projections
BennoLossin c79d5ae
test that FRTs of unions and enums don't implement `Field`
BennoLossin f8d1caf
document ui tests
BennoLossin 877e900
remove resolved FIXMEs
BennoLossin d95cb89
fix auto-trait handling
BennoLossin d9dab43
move `lower_field_of` to rustc_hir_analysis and improve diagnostics
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1377,6 +1377,25 @@ impl<'a> State<'a> { | |
| self.word(" is "); | ||
| self.print_ty_pat(pat); | ||
| } | ||
| ast::TyKind::FieldOf(ty, fields) => { | ||
| self.word("builtin # field_of"); | ||
|
Contributor
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. Maybe we can print this as |
||
| self.popen(); | ||
| let ib = self.ibox(0); | ||
| self.print_type(ty); | ||
| self.word(","); | ||
| self.space(); | ||
|
|
||
| if let Some((&first, rest)) = fields.split_first() { | ||
| self.print_ident(first); | ||
|
|
||
| for &field in rest { | ||
| self.word("."); | ||
| self.print_ident(field); | ||
| } | ||
| } | ||
| self.end(ib); | ||
| self.pclose(); | ||
| } | ||
| } | ||
| self.end(ib); | ||
| } | ||
|
|
||
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
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.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.
@oli-obk how do you feel about this addition?