add scope! and extend! temporary scoping operators - #160297
Draft
dianne wants to merge 6 commits into
Draft
Conversation
Co-authored-by: Travis Cross <tc@traviscross.com>
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
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 is my initial take on the
scope!andextend!operators proposed by @traviscross. I've done a bit of interpretation; the exact semantics will need to be discussed. Part of rust-lang/rust-project-goals#648, "Redesigningsuper let".Diagnostics, tests, documentation, comments, self-review, code cleanup, splitting this PR up, the PR descriptions, and probably other things are all very much unfinished. There's
TODOs so tidy will fail. The operators themselves seem to work just fine though, so far. I've included a non-comprehensive demo in the form of a UI test: scope-extend.rs.This is implemented on top of the (non-semantics-changing) refactor of temporary scoping I did as part of #146098. The first three commits are the tests and the refactor from that PR.
Since this experiment is meant to potentially replace
super letstatements, I'm piggy-backing off of thesuper_letfeature gate for now. I figure if this works out and we migrate off ofsuper let, we can rename the feature gate, but I could create a separate gate and merge them later if that'd make more sense.Tracking issue for
super let: #139076.