-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update rust reference info about closures #1
base: master
Are you sure you want to change the base?
Conversation
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.
@arora-aman I think there are a few things we want to change. Mainly wording
src/types/closure.md
Outdated
|
||
Regardless of if the data will be read by the closure, i.e. in case of wild card patterns, if a variable defined outside the closure is mentioned within the closure the variable will be captured in its entirety. | ||
|
||
## Other traits difference |
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.
I think we can actually delete this section. This is because the modified rules stated "the captured values" and we already clarified in the earlier Edition2018 subsection that the values captured are variables that are captured in its entirety
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.
I'm fine removing it
src/types/closure.md
Outdated
} | ||
### Capturing references in move contexts | ||
|
||
Rust doesn't allow moving fields out references as a result in the case of move closures, when the closure takes ownership of a path, it will only take ownership of a prefix of path that runs up until the first dereference (this may be the entire path if there are no dereferences in the path). |
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.
moving fields out of
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.
Instead of truncate ... we reborrow the data being accessed throw the reference
src/types/closure.md
Outdated
|
||
Regardless of if the data will be read by the closure, i.e. in case of wild card patterns, if a variable defined outside the closure is mentioned within the closure the variable will be captured in its entirety. | ||
|
||
## Other traits difference |
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.
I'm fine removing it
37ce76c
to
bc0e50c
Compare
880405c
to
0a9323a
Compare
This should be the other form of its.
Remove incorrect apostrophe
Expand on Unicode identifiers.
The phrase 'may not' could mean 'might not' or 'is not allowed to'.
The original sentence could mean that "its destructor is run" and "it is dropped" are two separate possibilities, rather than two names for the same action.
It is not clear if the original intended to mean these as two separate concepts, or synonyms for the same thing.
Fix typos + grammar
array-expr.md: fix typo; 'polish' sentence
example for bindings after at
…rcion Mention "function item type to `fn pointer`" coercion
92336ed
to
6b88e48
Compare
Co-authored-by: Eric Huss <[email protected]>
Allow users to change status labels
expressions.md: Attempt fixing broken grammar in Mutability paragraph
Document RangeFrom patterns
Fixed link typo in Generics.md
There are definitions of subtrait and supertrait, so use the official terminology.
…rtrait-subtrait Use subtrait/supertrait, not sub-trait, super-trait.
6b88e48
to
702a71f
Compare
Co-authored-by: Josh Triplett <[email protected]>
cc @arora-aman