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

Remove assertion on reachable blocks w/o results #12095

Merged
merged 1 commit into from
Feb 10, 2014

Conversation

flaper87
Copy link
Contributor

@flaper87 flaper87 commented Feb 7, 2014

Closes #11709

@flaper87
Copy link
Contributor Author

flaper87 commented Feb 7, 2014

@huonw r?

@flaper87
Copy link
Contributor Author

flaper87 commented Feb 7, 2014

@alexcrichton r?

@alexcrichton
Copy link
Member

I don't consider myself familiar enough with trans to review this, although I know many others have been running around in trans lately.

There's a whole bunch of test cases in #11709 and they all look pretty small, so perhaps you could expand the test case a bit?

}

if b.expr.is_some() {
bcx = expr::trans_into(bcx, b.expr.unwrap(), dest);
Copy link
Member

Choose a reason for hiding this comment

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

Why turn it into an if with .unwrap when you can just keep it "nice" with a match?

match b.expr {
    Some(e) => {
        bcx = expr::trans_into(bcx, e, dst);
    }
    None => {}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fewer lines of code. Would there be a benefit from using match instead of if here?

Copy link
Member

Choose a reason for hiding this comment

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

When you have a functional language, it's good to make use of it :)

You're checking for Some twice (is_some and unwrap), and while LLVM will do its magic, it's generally a code smell to structure code this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it back then, thanks!

@nikomatsakis
Copy link
Contributor

I'm no fan of dest::Ignore (I'd like to rip it out) -- but I think what is SUPPOSED to happen for a block with a unit result is that we switch over to "Ignore" output mode. I wonder why that's not happening here. Still, I imagine that this change is harmless.

@flaper87
Copy link
Contributor Author

flaper87 commented Feb 7, 2014

I'll investigate this a bit further

@flaper87
Copy link
Contributor Author

flaper87 commented Feb 8, 2014

@nikomatsakis @alexcrichton instead of removing the asserition, I added a check where trans_block is called. The checks I added are the same used for clousures. I believe this could be improved a bit more later. For instance, whether dest should be Ignore or something else could be done in trans_block directly. In order to do that, we'd need to pass other arguments to the method.

@huonw
Copy link
Member

huonw commented Feb 8, 2014

@flaper87 as @alexcrichton said, there are several more test cases on #11709, e.g. adding the line let _r = {}; to the test you already have.

Also, #11865 hits the same assertion; does this fix it?

@flaper87
Copy link
Contributor Author

flaper87 commented Feb 8, 2014

@huonw @alexcrichton ops sorry about that, I didn't mean to ignore that comment. Let me add those tests there.

@flaper87
Copy link
Contributor Author

flaper87 commented Feb 8, 2014

@huonw This fix works for #11865 too.

@nikomatsakis
Copy link
Contributor

@flaper87 what additional information would trans_block need?

@nikomatsakis
Copy link
Contributor

@flaper87 in particular it seems like trans_block could easily check what its own output type is and so on. Might be more robust. (I would like to remove Ignore mode though...feels like it's a complex invariant we're maintaining and I'm not clear on exactly why)

@flaper87
Copy link
Contributor Author

flaper87 commented Feb 8, 2014

@nikomatsakis Agreed, callers would always pass a Dest and trans_block would choose whether to use it or not.

W.r.t removing expr::Ignore, I also agree that we don't actually need it. Dest could be just a Option<ValueRef>. I can make this change part of this PR too if we agree on it.

@nikomatsakis
Copy link
Contributor

I'd leave that for a separate patch -- also, what I had in mind was
just having Dest always be a ValueRef

@nikomatsakis
Copy link
Contributor

(r+ with the assertion I mentioned)

@flaper87
Copy link
Contributor Author

flaper87 commented Feb 9, 2014

@nikomatsakis done, Thanks!

@alexcrichton
Copy link
Member

Feel free to // xfail-pretty the test, we sadly don't have any active maintainer of the pretty printer.

bors added a commit that referenced this pull request Feb 10, 2014
@bors bors closed this Feb 10, 2014
@bors bors merged commit 31576c7 into rust-lang:master Feb 10, 2014
@flaper87 flaper87 deleted the issue-11709 branch February 11, 2014 09:14
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
…icola

Increase defalt chalk overflow depth to match max solver size

TBC:

 - rust-lang#12279: ok above 480
 - ~~rust-lang#12182~~
 - ~~rust-lang#12095~~
 - rust-lang#11902: ok above 350
 - ~~rust-lang#11668~~
 - rust-lang#11370: ok above 450
 - rust-lang#9754: probably ok above 250 (!), and the code in cause and branch are gone

Closes rust-lang#12279
Closes rust-lang#11902
Closes rust-lang#11370
Closes rust-lang#9754
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.

Codegen bug: dest == expr::Ignore || bcx.unreachable.get()
5 participants