Skip to content
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

Merged
merged 10 commits into from
Jul 2, 2015

Conversation

jroesch
Copy link
Member

@jroesch jroesch commented Jun 30, 2015

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 ;)

jroesch added 8 commits June 30, 2015 02:40
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)
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

@eddyb
Copy link
Member

eddyb commented Jun 30, 2015

LGTM modulo nits.

fn project_adjustments<'a, 'tcx>(tables: &'a ty::Tables<'tcx>)
-> &'a NodeMap<ty::AutoAdjustment<'tcx>> {
&tables.adjustments
}
Copy link
Member

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

Copy link
Member Author

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.

@nrc
Copy link
Member

nrc commented Jul 1, 2015

r+ with nits addressed and passing make tidy

@jroesch jroesch force-pushed the fulfillment-context-refactor branch from 3b582a0 to ce089e5 Compare July 1, 2015 20:08
@nrc
Copy link
Member

nrc commented Jul 1, 2015

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 1, 2015

📌 Commit ce089e5 has been approved by nrc

@bors
Copy link
Contributor

bors commented Jul 2, 2015

⌛ Testing commit ce089e5 with merge ed06840...

@bors
Copy link
Contributor

bors commented Jul 2, 2015

💔 Test failed - auto-mac-64-nopt-t

@eddyb
Copy link
Member

eddyb commented Jul 2, 2015

@bors r=nrc

@bors
Copy link
Contributor

bors commented Jul 2, 2015

📌 Commit c64bda3 has been approved by nrc

bors added a commit that referenced this pull request Jul 2, 2015
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 ;)
@bors
Copy link
Contributor

bors commented Jul 2, 2015

⌛ Testing commit c64bda3 with merge 560b1da...

@bors bors merged commit c64bda3 into rust-lang:master Jul 2, 2015
Ms2ger added a commit to servo/rust-tenacious that referenced this pull request Jul 3, 2015
Manishearth pushed a commit to Manishearth/rust-tenacious that referenced this pull request Jul 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants