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

[MIR] A pass to type-check MIR #31474

Merged
merged 13 commits into from
Feb 20, 2016
Merged

[MIR] A pass to type-check MIR #31474

merged 13 commits into from
Feb 20, 2016

Conversation

arielb1
Copy link
Contributor

@arielb1 arielb1 commented Feb 7, 2016

This should stop broken MIR from annoying us when we try to implement things

@rust-highfive
Copy link
Collaborator

r? @jroesch

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive assigned arielb1 and unassigned jroesch Feb 7, 2016
@@ -974,6 +978,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
let parse_only = debugging_opts.parse_only;
let no_trans = debugging_opts.no_trans;
let treat_err_as_bug = debugging_opts.treat_err_as_bug;
let mir_opt_level = debugging_opts.mir_opt_level.unwrap_or(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering a default of 1 + -C opt-level. This way the level of MIR “optimisations” would automatically get attached to the -O and -C opt-level flags as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First make opt-levels greater than 1 do something, then we can talk.

@bors
Copy link
Contributor

bors commented Feb 9, 2016

☔ The latest upstream changes (presumably #31425) made this pull request unmergeable. Please resolve the merge conflicts.

@Aatch
Copy link
Contributor

Aatch commented Feb 10, 2016

How fast do you expect the check to be? It would be nice if we could run the check between each pass, probably based on a -Z flag.

@nikomatsakis
Copy link
Contributor

cc me

@arielb1
Copy link
Contributor Author

arielb1 commented Feb 10, 2016

This pass should not take too much time.

@jroesch
Copy link
Member

jroesch commented Feb 10, 2016

Let me know when you think this is ready for review, reading over it right now.

@arielb1 arielb1 changed the title [WIP] [MIR] A pass to type-check MIR [MIR] A pass to type-check MIR Feb 11, 2016
@arielb1
Copy link
Contributor Author

arielb1 commented Feb 11, 2016

the rvalue-type-checking code can be improved, but I will leave that to a separate PR - this one is growing too big.

r? @nikomatsakis

@arielb1 arielb1 force-pushed the mir-typeck branch 3 times, most recently from 59b1dd5 to d210962 Compare February 11, 2016 16:33
span_mirbug_and_err!(self, parent, "bad type {:?}", ty)
}

fn sanitize_lvalue(&mut self, lvalue: &Lvalue<'tcx>) -> LvalueTy<'tcx> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prefix sanitize strikes me as odd. To me, it suggests something which will mutate the lvalue in place, removing artifacts or normalizing it in some way. But in fact sanitize_lvalue seems to compute the type of an lvalue.

There is also an unfortunate amount of overlap with the lvalue_ty routine -- these basically do the same thing, but just handle the error cases differently. Perhaps we could make lvalue_ty return a Result instead to eliminate the overlap?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, reading a bit further I see that sanitize_projection actually does more consistency checking, so perhaps it is good to keep these two routines as separate. I think I would change sanitize to typeck_ or type_ or just check_.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps verify_ would be the best name, given that this is part of the type verifier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it returns the sanitized lvalue ty, which will be TyErr if there are are late-bound regions etc. in the type.

@bors
Copy link
Contributor

bors commented Feb 18, 2016

☔ The latest upstream changes (presumably #31600) made this pull request unmergeable. Please resolve the merge conflicts.

Ariel Ben-Yehuda and others added 12 commits February 19, 2016 19:13
setting -Z mir-opt-level=0 will disable all MIR optimizations
for easier debugging
this makes the the MIR assignment pass complete successfully
TODO: find a correct borrow region

Fixes rust-lang#31482
also fix translation of "rust-call" functions, although that could use
more optimizations
rather than being implicit quasi-subtyping. Nothing good can come out
of quasi-subtyping.
@arielb1
Copy link
Contributor Author

arielb1 commented Feb 20, 2016

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Feb 20, 2016

📌 Commit 626dc3b has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Feb 20, 2016

⌛ Testing commit 626dc3b with merge e768394...

@bors
Copy link
Contributor

bors commented Feb 20, 2016

💔 Test failed - auto-mac-64-opt

@arielb1
Copy link
Contributor Author

arielb1 commented Feb 20, 2016

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Feb 20, 2016

📌 Commit d84658e has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Feb 20, 2016

⌛ Testing commit d84658e with merge 6c751e0...

bors added a commit that referenced this pull request Feb 20, 2016
This should stop broken MIR from annoying us when we try to implement things
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.

8 participants