[experiment] first draft of init array syntax#143553
Draft
dingxiangfei2009 wants to merge 2 commits intorust-lang:mainfrom
Draft
[experiment] first draft of init array syntax#143553dingxiangfei2009 wants to merge 2 commits intorust-lang:mainfrom
dingxiangfei2009 wants to merge 2 commits intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
Collaborator
|
☔ The latest upstream changes (presumably #143582) made this pull request unmergeable. Please resolve the merge conflicts. |
8c3dff6 to
04fd5fd
Compare
This comment has been minimized.
This comment has been minimized.
Collaborator
|
☔ The latest upstream changes (presumably #143538) made this pull request unmergeable. Please resolve the merge conflicts. |
04fd5fd to
c6a4400
Compare
This patch allows parsing of the syntax `init [ v1, v2, v3, .. ]` and certain level of type checking on HIR level. Signed-off-by: Xiangfei Ding <dingxiangfei2009@protonmail.ch>
c6a4400 to
2007f50
Compare
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Collaborator
|
☔ The latest upstream changes (presumably #144440) made this pull request unmergeable. Please resolve the merge conflicts. |
Contributor
Author
|
Standby. I have working on the feedbacks on the language design. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This patch allows parsing of the syntax
init [ v1, v2, v3, .. ]and certain level of type checking on HIR level.See Draft RFC, under tracking rust-lang/lang-team#336
Dragons ahead
This is a draft PR that is very experimental and it is posted only for very early feedback and it is not immediately mergeable.
init # ...AST fragment as a start.The reason that this deviates from the original proposal, with the additional
#, is to help with syntax ambiguity betweeninit[0]as indexing into a valueinit, versusinit [ 0 ]as in-place initialisation.However, I would propose to switch to a macro based approach to the syntax to avoid such ambiguity.
Init. It has the same generics structure as aClosureand it is almost type-checked in the same way asClosure, except that its return type expectation also contains the error type, which is to be unified with those from the nested in-place initialisation.This is still not functional, because for instance I still have to fill out some tables such as
late_bound_vars.This patch does not include any THIR or MIR building.
The final state at which I would see this patch can be merged, is to at least we can type check the following smoke test.
Areas to improve
As of July 7th, I see that I need to work these out
InitTailis not necessary, I should just drop itThe HIR nodeI start to appreciate this choice now because the HIR visitor would be a bit harder to write if I would decide to squash it.InitKind::Arraycould be squashed so that it is just a list ofInitTailnodesInitTailsounds terrible and I regret the choice.r? @compiler-errors