forked from rust-lang/rust
-
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
RFC 2229: Capture Precise Places #31
Closed
Closed
Conversation
This file contains 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
- When `capture_disjoint_fields` is not set, we would init the first pass capture information map with upvars that are mentioned within the closure. This would ensure that variables are captured in entirety and also handle the case of `let _ = x` when the feature gate is disabled. - However, the place generated before ExprUseVisitor contains uninferred types, that can result in same place being recorded twice in min capture map. Eg: ```rust let x = 10i32; || x += 10; ``` If we initialize before ExprUseVisitor we get two Places in the min captured map `Place(x, base_ty: Infer)` and `Place(x, base_ty: i32)` Co-authored-by: Jennifer Wills <wills.jenniferg@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
Co-authored-by: Jennifer Wills <wills.jenniferg@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
8f759c9
to
2621497
Compare
- This allows us to handle upvars when all projections to form a capture have been applied to the builder Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2621497
to
d07ac32
Compare
- final_upvar_tys now reads types from places instead of using `node_ty` Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
- Use closure_min_capture maps to capture precise paths - PlaceBuilder now searches for ancestors in min_capture list - Add API to `Ty` to allow access to the n-th element in a tuple in O(1) time. Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
- Closures now use closure_min_captures to figure out captured paths - Build upvar_mutbls using closure_min_captures - Change logic in limit_capture_mutability to differ on nested closure based on PlaceBase. Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
- Use closure_min_captures to generate the Upvar structure that stores information for diagnostics and information about mutability of captures.
Wildcards in patterns currently don't work when `capture_disjoint_fields` is enabled, disabling some run-pass tests until the issue is resolved.
d07ac32
to
ee466ae
Compare
roxelo
pushed a commit
that referenced
this pull request
Jul 4, 2021
New lint: `disallowed_script_idents` This PR implements a new lint to restrict locales that can be used in the code, as proposed in rust-lang#7376. Current concerns / unresolved questions: - ~~Mixed usage of `script` (as a Unicode term) and `locale` (as something that is easier to understand for the broad audience). I'm not sure whether these terms are fully interchangeable and whether in the current form it is more confusing than helpful.~~ `script` is now used everywhere. - ~~Having to mostly copy-paste `AllowedScript`. Probably it's not a big problem, as the list of scripts is standardized and is unlikely to change, and even if we'd stick to the `unicode_script::Script`, we'll still have to implement custom deserialization, and I don't think that it will be shorter in terms of the amount of LoC.~~ `unicode::Script` is used together with a filtering deserialize function. - Should we stick to the list of "recommended scripts" from [UAX #31](http://www.unicode.org/reports/tr31/#Table_Recommended_Scripts) in the configuration? *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: ``[`disallowed_script_idents`]`` r? `@Manishearth`
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.
Following test cases fail and have been disabled.
Test log: http://csclub.uwaterloo.ca/~a52arora/rust-builds/log_53cd79f4-12fa-4392-a0c9-ff6bfa301347
Work that remains:
This change is