Uh oh!
There was an error while loading. Please reload this page.
Ignore expected type in diverging blocks - #39485
Conversation
rust-highfive
commented
Feb 3, 2017
(rust_highfive has picked a reviewer for you, use r? to override) |
eddyb
commented
Feb 3, 2017
Also, please use a more descriptive title (e.g. "Allow diverging blocks to have a type different than that of their trailing expression." but that's maybe too long). |
nikomatsakis
commented
Feb 3, 2017
@canndrew instead of removing the affected tests, can you move at least one of them into a |
nikomatsakis
commented
Feb 3, 2017
cc @eddyb |
nikomatsakis
commented
Feb 3, 2017
Oh, I see he already commented =) |
nikomatsakis
commented
Feb 3, 2017
It occurs to me that we perhaps ought to crater this too. That is, I guess that this can lead to types becoming constrained that were not otherwise (as we saw in #39009). |
Is there a way to skip debuginfo tests when testing rustc? They always fail for me and it throws me off because sometimes I think the other tests have succeeded when I've gotten that far. As for the failing run-pass tests. This now fails (unable to infer enough type information for fnfoo() -> Result<Foo,isize>{returnOk(Foo{x:Bar{x:22},a:returnErr(32)});}Which is unfortunate. Shouldn't inference be able to infer that the Also, this now fails (unable to infer enough type information for pubfnindex_colors<Pix>(image:&ImageBuffer<Pix,Vec<u8>>)
-> ImageBuffer<Luma<u8>,Vec<u8>>wherePix:Pixel<Subpixel=u8> + 'static,{letmut indices:ImageBuffer<_,Vec<_>> = loop{};for(pixel, idx)in image.pixels().zip(indices.pixels_mut()){// failured occurred here ^^ because we were requiring that we// could project Pixel or Subpixel from `T_indices` (type of// `indices`), but the type is insufficiently constrained// until we reach the return below.}
indices
}Which makes sense, but is also unfortunate. (Because the function body is diverging, the type of |
nikomatsakis
commented
Feb 5, 2017
Well, the whole change here is basically that it doesn't have to. (Since it is dead-code.) cc @eddyb -- it makes sense that this would be causing some back-compat issues, but it's a drag. Definitely have to do a crater run I guess. |
nikomatsakis
commented
Feb 7, 2017
Started a crater run. |
Root regressions
|
canndrew
commented
Feb 9, 2017
So, according to that crater run there's 4 directly-broken packages: libimagestore and tera have already been fixed upstream, they just need to publish new versions or get people using those new versions. lion has been yanked from crates.io and twig can be fixed easily enough. Of course if we did default to What's everyone's take on all this?
Sure, I was just surprised that it didn't still force that particular bit of unification to happen. |
d35e5b1 to
18be42cComparecanndrew
commented
Feb 9, 2017
I've fixed the two failing tests. |
nikomatsakis
commented
Feb 13, 2017
@canndrew ok, well, seems like we might as well go through with this. I feel like the current behavior is pretty inconsistent.
I'm not sure I understand what you mean here by "default to |
canndrew
commented
Feb 16, 2017
Sounds good to me.
I just meant set the type variable which can't be inferred to |
nikomatsakis
commented
Feb 16, 2017
@canndrew I see. Well, I'm not a big fan of that idea, for a couple of reasons. For one thing, it would re-create the problem we are trying to fix here. Consider e.g. something like this: letmut v = vec![];if condition {return;
v.push(vec![]);// this type variable is created in dead code}Now the type of In general, the rule of "dead code halts information flow up the tree (i.e., from expression to where expression is used)" but not "side-to-side" seems pretty good to me. Among other things, since the code is dead, there is (indeed) no data or information flow up the tree, and we can't know if you intended to add conversion and so forth. |
nikomatsakis
commented
Feb 16, 2017
cc @Nercury -- twig-rs may be affected by this change. The testing of the PR got this error: This PR affects information flow around dead-code. The problem seems to be that the type of this variable |
nikomatsakis
commented
Feb 16, 2017
I'm marking this for relnotes, since it does affect code. The relnotes could read: "Fixed bugs around how type inference interacts with dead-code. The existing code generally ignores the type of dead-code unless a type-hint is provided; this can cause surprising inference interactions particularly around defaulting. The new code uniformly ignores the result type of dead-code." |
nikomatsakis
commented
Feb 16, 2017
@bors r+ |
bors
commented
Feb 16, 2017
📌 Commit 18be42c has been approved by |
bors
commented
Feb 16, 2017
⌛ Testing commit 18be42c with merge 8725c90... |
bors
commented
Feb 16, 2017
💔 Test failed - status-appveyor |
alexcrichton
commented
Feb 16, 2017
via email
@bors: retry
* appveyor timeout …On Thu, Feb 16, 2017 at 1:47 PM, bors ***@***.***> wrote:
💔 Test failed - status-appveyor
<https://ci.appveyor.com/project/rust-lang/rust/build/1.0.1981>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#39485 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95OQ-avTCsRkLda_veYnN4AtQf28Aks5rdKftgaJpZM4L2UC7>
.
|
bors
commented
Feb 17, 2017
⌛ Testing commit 18be42c with merge 82756e4... |
bors
commented
Feb 17, 2017
💔 Test failed - status-travis |
alexcrichton
commented
Feb 17, 2017
via email
@bors: retry
* network failure …On Thu, Feb 16, 2017 at 9:26 PM, bors ***@***.***> wrote:
💔 Test failed - status-travis
<https://travis-ci.org/rust-lang/rust/builds/202486669>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#39485 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95C-9golHpDkFDDG6f4ZHN6ed11vWks5rdRNQgaJpZM4L2UC7>
.
|
Nercury
commented
Feb 17, 2017
@nikomatsakis twig was my early Rust project that is not finished and is paused now, so the breakage won't cause any issues |
bors
commented
Feb 17, 2017
Ignore expected type in diverging blocks As per comment: #39297 (comment)
bors
commented
Feb 17, 2017
☀️ Test successful - status-appveyor, status-travis |
There was some concerns about what is expected breakage and what is not in #39984 but I suspect they are more likely to be answered here. There is this code that returns an So, is it expected breakage that the dead branch of code is 1) required to have fully known types but 2) is not type-inferred, unlike live branches, so these dead branches must have additional type annotations, which they wouldn't need if they were live branches? |
Revert rust-lang#39485, fixing type-inference regressions This reverts PR rust-lang#39485, which should fix the immediate regressions. Eventually I'd like to land rust-lang#40224 -- or some variant of it -- which revisits the question fo dead-code and inference. r? @eddyb cc @canndrew
Revert rust-lang#39485, fixing type-inference regressions This reverts PR rust-lang#39485, which should fix the immediate regressions. Eventually I'd like to land rust-lang#40224 -- or some variant of it -- which revisits the question fo dead-code and inference. r? @eddyb cc @canndrew
As per comment: #39297 (comment)