-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Ref bindings in irrefut patterns #7262
Closed
nikomatsakis
wants to merge
20
commits into
rust-lang:master
from
nikomatsakis:ref-bindings-in-irrefut-patterns
Closed
Ref bindings in irrefut patterns #7262
nikomatsakis
wants to merge
20
commits into
rust-lang:master
from
nikomatsakis:ref-bindings-in-irrefut-patterns
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
I'm still at the conference but will look at this today. |
@nikomatsakis @thestinger's patch conflicted with this. |
@Aatch I feared it might... will rebase... |
This failed in a rusti test, segfault. Not sure if legitimate or not, and I thought the rusti tests were disabled. |
Maybe I need to rebase again. |
…of irrefutable patterns
In particular, it is not valid to go around passing uninitialized or zero'd memory as arguments. Rust should generally be free to assume that the arguments it gets are valid input values, but the output of intrinsics::uninit() and intrinsics::init() are not (e.g., an @t is just null, leading to an error if we should try to increment the ref count).
in the generated LLVM code.
…(simpler for cases where it's hard to decide what id to use for the lookup); modify irrefutable bindings code to move or copy depending on the type, rather than threading through a flag. Also updates how local variables and arguments are registered. These changes were hard to isolate.
let and function arguments; modify type checker to store type information for all patterns and handles some missing cases.
bors
added a commit
that referenced
this pull request
Jul 9, 2013
…rns, r=catamorphism Correct treatment of irrefutable patterns. The old code was wrong in many, many ways. `ref` bindings didn't work, it sometimes copied when it should have moved, the borrow checker didn't even look at such patterns at all, we weren't consistent about preventing values with destructors from being pulled apart, etc. Fixes #3224. Fixes #3225. Fixes #3255. Fixes #6225. Fixes #6386. r? @catamorphism
This was referenced Jul 9, 2013
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Jun 17, 2021
…rednet,flip1995 fix `while_let_on_iterator` suggestion in a closure fixes: rust-lang#7249 A future improvement would be to check if the closure is being used as `FnOnce`, in which case the original suggestion would be correct. changelog: Suggest `&mut iter` inside a closure for `while_let_on_iterator`
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.
Correct treatment of irrefutable patterns. The old code was wrong in many, many ways.
ref
bindings didn't work, it sometimes copied when it should have moved, the borrow checker didn't even look at such patterns at all, we weren't consistent about preventing values with destructors from being pulled apart, etc.Fixes #3224.
Fixes #3225.
Fixes #3255.
Fixes #6225.
Fixes #6386.
r? @catamorphism