Uh oh!
There was an error while loading. Please reload this page.
typeck: use NoExpectation to check return type of diverging fn - #35883
Conversation
rust-highfive
commented
Aug 21, 2016
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
I'd put this in a variable or call a different version of check_block in the TyNever case.
eddyb
commented
Aug 22, 2016
r=me with nit fixed. |
durka
commented
Aug 22, 2016
Nit fixed. This also needs to be |
eddyb
commented
Aug 22, 2016
@bors r+ |
bors
commented
Aug 22, 2016
📌 Commit 9d53faf has been approved by |
canndrew
commented
Aug 22, 2016
This won't allow something like |
eddyb
commented
Aug 22, 2016
@canndrew It's the same logic as before, I believe liveness is what prevents control-flow from exiting the function if the function is supposed to be divergent (in a more sound manner). |
typeck: use NoExpectation to check return type of diverging fn Fixesrust-lang#35849. Thanks @eddyb.
durka
commented
Aug 22, 2016
@canndrew@eddyb yep we got a problem here: |
eddyb
commented
Aug 22, 2016
Whoa how did that happen?! That's bad, because the code erroring before wasn't in typeck AFAIK. @bors r- |
durka
commented
Aug 22, 2016
IRC investigation reveals that #35162 removed an important check from the liveness pass, which I will reinstate whenever LLVM finishes building. Now I'm wondering if that PR removed anything else important. |
canndrew
commented
Aug 22, 2016
Are you talking about the check in |
eddyb
commented
Aug 22, 2016
@canndrew Maybe that can work, but we'll always need a sanity check - if typeck ends up being able to handle divergence correctly, we'd just have a proper CFG-based check ICE instead of erroring. |
Maybe just add a "redundant" return type check always, like MIR does? |
canndrew
commented
Aug 22, 2016
I'm generally uncomfortable making special cases for |
eddyb
commented
Aug 22, 2016
@canndrew The special cases need to be there until there's a RFC that says |
durka
commented
Aug 22, 2016
cf #35499 |
canndrew
commented
Aug 22, 2016
I don't think that liveness should have special cases for
Why? This can get typechecked correctly: fnfoo() -> ! {[panic!()];}So there's some logic that can see the |
eddyb
commented
Aug 22, 2016
@canndrew No, that doesn't get type-checked either. The error you get when the function is declared to return |
durka
commented
Aug 22, 2016
Amended to restore the special case in |
durka
commented
Aug 22, 2016
Nits knitted. |
There was a problem hiding this comment.
These should not be combined, i.e. the else below should be to fn_ret.is_never() alone, to match the old semantics.
durka
commented
Aug 22, 2016
Knit nitted. |
eddyb
commented
Aug 22, 2016
@bors r+ |
bors
commented
Aug 22, 2016
📌 Commit ddebea0 has been approved by |
This fixesrust-lang#35849, a regression introduced by the typeck refactoring around TyNever/!.
Fixed the travis failure and added some FIXME comments. We unfortunately needed to ignore a test added for |
eddyb
commented
Aug 23, 2016
@bors r+ |
bors
commented
Aug 23, 2016
📌 Commit 702ea71 has been approved by |
typeck: use NoExpectation to check return type of diverging fn Fixesrust-lang#35849. Thanks @eddyb.
typeck: use NoExpectation to check return type of diverging fn Fixesrust-lang#35849. Thanks @eddyb.
bors
commented
Aug 24, 2016
⌛ Testing commit 702ea71 with merge 5f31fda... |
alexcrichton
commented
Aug 24, 2016
@bors: retry force clean
|
Fixes#35849.
Thanks @eddyb.