Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upType inference regression in recent nightly #39984
Comments
This comment has been minimized.
This comment has been minimized.
|
Seems similar to #39808, in the sense that there is some unreachable code that apparently was used to help inference before? |
This comment has been minimized.
This comment has been minimized.
|
Diff between the I expect this was caused by #39485 (and thus is expected breakage?). |
This comment has been minimized.
This comment has been minimized.
|
Seems like it. |
This comment has been minimized.
This comment has been minimized.
|
Is it written somewhere what inference breaking was within range of "expected" and what is not? It started to bother me: the problem doesn't seem to be that some type info isn't available because it would be inferred from dead code. After all, the function signature here is not dead code, and everything's inferrable from there. The problem seems to be that the type of the dead expression isn't fully inferred from the non-dead code. But should the type of E matter since the code path is dead? And if it does, shouldn't it be fully inferrable from the function signature? |
This comment has been minimized.
This comment has been minimized.
|
Exactly. BTW, it's not convenient if dead code doesn't typecheck. It happens to me a lot when I'm writing new code, along with unused variables for example. |
This comment has been minimized.
This comment has been minimized.
|
As @nikomatsakis points out, existing code could be broken by doing proper type-checking in dead code. Ironic that disabling type checking of dead-code is actually causing type errors (this issue). I stand by my reasoning that dead code should be type checked (even if it breaks some existing code), however it would also make sense if the dead code warning was reported before errors in the dead code. |
This comment has been minimized.
This comment has been minimized.
|
So let me check: the recent changes disabled type-checking of dead code? And nevertheless it complains that the type of |
This comment has been minimized.
This comment has been minimized.
|
I'm not very familiar with how the compiler works, but I suspect the I'd rather someone who actually understands the compiler answer that question though... |
golddranks
referenced this issue
Feb 27, 2017
Merged
Ignore expected type in diverging blocks #39485
This comment has been minimized.
This comment has been minimized.
nikomatsakis
added
the
I-nominated
label
Mar 2, 2017
This comment has been minimized.
This comment has been minimized.
|
triage: P-high |
rust-highfive
added
P-high
and removed
I-nominated
labels
Mar 2, 2017
nikomatsakis
self-assigned this
Mar 2, 2017
nikomatsakis
referenced this issue
Mar 2, 2017
Closed
mac-0.1.0 fails test suite due to type inference regression in Rust 1.15 #39808
This comment has been minimized.
This comment has been minimized.
|
One of my crates is also experiencing this, with generated code similar to this (example heavily reduced):
Previously, this resulted in a dead code warning,
but now, it errors out:
This is although the type for |
This comment has been minimized.
This comment has been minimized.
|
I think this might be the same issue as #39808, although that one is tagged |
This comment has been minimized.
This comment has been minimized.
|
1.17 is now beta. |
arielb1
added
regression-from-stable-to-beta
and removed
regression-from-stable-to-nightly
labels
Mar 16, 2017
This comment has been minimized.
This comment has been minimized.
|
So, is this issue considered a regression or a wontfix? |
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
Mar 17, 2017
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
Mar 17, 2017
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
Mar 18, 2017
nikomatsakis
referenced this issue
Mar 18, 2017
Merged
Revert #39485, fixing type-inference regressions #40636
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
Mar 18, 2017
sinkuu
referenced this issue
Mar 20, 2017
Closed
Type Inference Fails on Beta and Nightly but not on Stable #40662
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
Mar 21, 2017
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
Mar 22, 2017
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
Mar 22, 2017
This comment has been minimized.
This comment has been minimized.
|
Fix is enqueued. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@sunjay done |
Yamakaky commentedFeb 20, 2017
•
edited by pnkfelix
https://play.rust-lang.org/?gist=188e52dc2ba423a8f78c6e381f278cf1&version=nightly&backtrace=1
source (copied by @pnkfelix from gist linked above):
Maybe it's because
Ok(())is unreachable?See rust-lang-nursery/error-chain#132 for the original report.