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 upCoherence error messages can be inscrutable #23980
Comments
nikomatsakis
added
the
A-diagnostics
label
Apr 2, 2015
This comment has been minimized.
This comment has been minimized.
|
triage: P-high (1.0) |
rust-highfive
added
the
P-medium
label
Apr 2, 2015
rust-highfive
added this to the 1.0 milestone
Apr 2, 2015
nikomatsakis
self-assigned this
Apr 2, 2015
This comment has been minimized.
This comment has been minimized.
|
@flaper87 is going to look into this as well. As a concrete first step, we want to print out the overlapping types, and not just cite impls. For example: // crate A
trait Foo { }
impl<T> Foo for &T { }
// crate B
struct MyType;
impl Foo for &MyType { } // XThis would ideally print something like:
However, the last part is a bit tricky since the impl must be reconstructed from metadata, but we can start with even just printing |
flaper87
assigned
flaper87
and unassigned
nikomatsakis
Apr 3, 2015
steveklabnik
removed this from the 1.0 milestone
May 21, 2015
This comment has been minimized.
This comment has been minimized.
|
I'm encouraging @aturon to take this on :) |
aturon
added a commit
to aturon/rust
that referenced
this issue
Nov 20, 2015
aturon
referenced this issue
Nov 20, 2015
Merged
Provide overlapping types for coherence errors #29962
aturon
added a commit
to aturon/rust
that referenced
this issue
Nov 20, 2015
aturon
added a commit
to aturon/rust
that referenced
this issue
Dec 4, 2015
aturon
added a commit
to aturon/rust
that referenced
this issue
Dec 4, 2015
aturon
added a commit
to aturon/rust
that referenced
this issue
Dec 4, 2015
aturon
added a commit
to aturon/rust
that referenced
this issue
Dec 4, 2015
bors
added a commit
that referenced
this issue
Dec 16, 2015
aturon
added a commit
to aturon/rust
that referenced
this issue
Dec 16, 2015
bors
added a commit
that referenced
this issue
Dec 16, 2015
bors
closed this
in
#29962
Dec 16, 2015
ubsan
added a commit
to ubsan/rust
that referenced
this issue
Dec 22, 2015
nikomatsakis
reopened this
Dec 22, 2015
This comment has been minimized.
This comment has been minimized.
|
I still consider the error messages fairly inscrutable, even with @aturon's commit. |
nikomatsakis
unassigned
flaper87
Dec 22, 2015
This comment has been minimized.
This comment has been minimized.
|
In particular, I think we should tell you where we failed to use negative reasoning because of orphan rules. |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis Whoops, sorry for the premature closure. I'd be interested in continuing to work in this space, but we should talk about the end goal. |
fhahn
added a commit
to fhahn/rust
that referenced
this issue
Dec 28, 2015
This comment has been minimized.
This comment has been minimized.
|
@aturon basically I think we should report each piece of negative reasoning that we were not able to use because of orphan rules. Bonus points if we limit it to negative reasoning that would have helped. I think the "motivating example" form this thread is interesting -- the thread opens with an explanation of the error, it seems like coherence could probably have produced something much like that. Right now the example gives you a counter-example like:
which is definitely a good start. But I think it'd be great if it could add:
|
This comment has been minimized.
This comment has been minimized.
|
http://stackoverflow.com/q/37347311/1256624 is a "real world" example where confusion was caused by being overly definite in the error message rather than explaining that it was a possibility/what the actual risk is. |
nikomatsakis commentedApr 2, 2015
In particular, when the overlap check fails, it doesn't give much clarity, particularly when the overlap is between impls in different crates. It should tell you:
#2 might be a bit tricky to do, not sure, but we can certainly improve on current state of affairs.