-
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
Move FulfillmentContext into InferCtxt and remove Typer + ClosureTyper #26677
Conversation
Update all uses of FulfillmentContext to be ones obtained via an InferCtxt. This is another step of flattening the type checking context into a single piece of state.
This commit finalizes the work of the past commits by fully moving the fulfillment context into the InferCtxt, cleaning up related context interfaces, removing the Typer and ClosureTyper traits and cleaning up related intefaces
|
||
pub fn type_moves_by_default(&self, ty: Ty<'tcx>, span: Span) -> bool { | ||
let ty = self.resolve_type_vars_if_possible(&ty); | ||
!traits::type_known_to_meet_builtin_bound(self, ty, ty::BoundCopy, span) |
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 doesn't this use the caching Ty::moves_by_default
method?
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.
@eddyb there isn't a good reason, most likely this code was moved from one of the implementations for Typer
. I will update it to use that instead.
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.
So making this change causes the compiler to crash because of the assertion here: https://github.com/rust-lang/rust/blob/master/src/librustc/middle/ty.rs#L4421.
LGTM modulo nits. |
fn project_adjustments<'a, 'tcx>(tables: &'a ty::Tables<'tcx>) | ||
-> &'a NodeMap<ty::AutoAdjustment<'tcx>> { | ||
&tables.adjustments | ||
} |
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 would just use a closure rather than a named function 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.
@nrc this was related to a weird bug that I found wrt to higher ranked closure type inference. It appears fixed in the nightly but not in our current snapshot. I had a comment about this in the code at another place I had to do this. I'll add back a comment.
r+ with nits addressed and passing make tidy |
3b582a0
to
ce089e5
Compare
@bors: r+ |
📌 Commit ce089e5 has been approved by |
⌛ Testing commit ce089e5 with merge ed06840... |
💔 Test failed - auto-mac-64-nopt-t |
@bors r=nrc |
📌 Commit c64bda3 has been approved by |
This patch implements the next chunk of flattening out the type checking context. In a series of patches I moved around the necessary state and logic in order to delete the `Typer` and `ClosureTyper` traits. My next goal is to clean the interfaces and start to move the normalization code behind them. r? @nrc I hope my PR is coherent, doing this too late at night ;)
This patch implements the next chunk of flattening out the type checking context. In a series of patches I moved around the necessary state and logic in order to delete the
Typer
andClosureTyper
traits. My next goal is to clean the interfaces and start to move the normalization code behind them.r? @nrc I hope my PR is coherent, doing this too late at night ;)