-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Refactor upvar mode inference #20432
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
Merged
Merged
Conversation
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
}).ty | ||
base_ty.map(|t| { | ||
ty::deref(t, false).unwrap_or_else(|| { | ||
panic!("encountered BindByRef with non &-type"); |
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.
Why is this panic! still here?
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.
Good point! Just an ICE waiting to happen.
3ed77b3
to
beb649d
Compare
expr-use-visitor) early. Turns out I was wrong to remove this; it causes a lot of pain trying to run EUV etc during typeck without ICEing on erroneous programs.
… overflow, which should always result in an error. NB. Some of the hunks in this commit rely on a later commit which adds `tcx` into `param_env` and modifies `ParameterEnvironment` to implement `Typer`.
`UnboxedClosureTyper`. This requires adding a `tcx` field to `ParameterEnvironment` but generally simplifies everything since we only need to pass along an `UnboxedClosureTyper` or `Typer`.
and which uses EUV. For now, upvar inference is not any smarter than it ever was, but regionck is simpler because it doesn't have to do as many things at once.
beb649d
to
cbeff8b
Compare
bors
added a commit
that referenced
this pull request
Jan 3, 2015
Previously, the borrow mode of each upvar was inferred as part of regionck. This PR moves it into its own separate step. It also employs the `ExprUseVisitor`, further simplifying the code. The eventual goal is to support better inference of `Fn` vs `FnMut` vs `FnOnce` that is not based on the expected type, as well as supporting individual by-move upvars. r? @eddyb
edwardw
added a commit
to edwardw/rust
that referenced
this pull request
Jan 23, 2015
As part of rust-lang#20432, upvar checking is now moved out of regionck to its own pass and before regionck. But regionck has some type resolution of it own. Without them, now separated upvar checking may be tripped over by residue `ty_infer`. Closes rust-lang#21306
edwardw
added a commit
to edwardw/rust
that referenced
this pull request
Jan 23, 2015
As part of rust-lang#20432, upvar checking is now moved out of regionck to its own pass and before regionck. But regionck has some type resolution of its own. Without them, now separated upvar checking may be tripped over by residue `ty_infer`. Closes rust-lang#21306
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.
Previously, the borrow mode of each upvar was inferred as part of regionck. This PR moves it into its own separate step. It also employs the
ExprUseVisitor
, further simplifying the code. The eventual goal is to support better inference ofFn
vsFnMut
vsFnOnce
that is not based on the expected type, as well as supporting individual by-move upvars.r? @eddyb