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 upTwo different versions of a crate interacting leads to unhelpful error messages #22750
Comments
huonw
added
the
A-diagnostics
label
Feb 24, 2015
This comment has been minimized.
This comment has been minimized.
|
This bit me today with |
This comment has been minimized.
This comment has been minimized.
|
Related, its also annoying if only crate local paths get emitted, like in backtraces. We need a way for crates to identify themself uniquely, and not just by an identifier. Maybe a scheme like |
ghost
referenced this issue
Mar 10, 2015
Closed
Confusing "type mismatch" error report: the types might differ while pretty-printer prints them in exactly the same way #23252
This comment has been minimized.
This comment has been minimized.
|
I was bitten by this too. Kimundi: Agreed for the need to unique identification. But then again, in some cases the local path tells more directly where the problem is. I wonder if there are cases where path is better and cases where a hash is better. Or maybe some kind of hybrid: If version information from cargo is available, use that. If not, if version control information is available, use commit SSH, and if no other information exists, use a path...? |
sfackler
referenced this issue
Jun 12, 2015
Closed
Error about "different enum" could be more helpful #26236
alexcrichton
referenced this issue
Aug 4, 2015
Closed
[wish list] Confusing error message E0308 when using two diff versions of a library #27420
huonw
added
T-tools
T-compiler
I-nominated
labels
Sep 8, 2015
This comment has been minimized.
This comment has been minimized.
|
Nominating for high priority. I think this is one of the main pain points people have when using cargo, and one of the major reasons for people complaining about cargo allowing multiple versions of a crate. It's usually easy to identify once you've seen it a few times, but it is a horribly confusing and annoying experience. (Tagged with both compiler and tools since cargo presumably plays into this, but this is probably most relevant to the compiler subteam.) @golddranks: the question of connecting semantically relevant info to crates is discussed a little in the issue. I think the best plan would external tools to pass in arbitrary strings connected to each crate, defaulting to the path, meaning rustc doesn't have to actually understand anything, just print strings (the compiler already has an |
This comment has been minimized.
This comment has been minimized.
|
I've also seen an increasing number of IRC questions about this.
|
Manishearth
self-assigned this
Sep 8, 2015
This comment has been minimized.
This comment has been minimized.
|
I'll take a crack at this |
This comment has been minimized.
This comment has been minimized.
|
I think at the very least, for mismatched type and unimplemented trait errors, if we detect a crate mismatch, we should mention it. Any other such errors? |
This comment has been minimized.
This comment has been minimized.
|
Mismatched type is the big one. Being able to understand this would also help Rustdoc a lot, I think there are bugs open. (That way, we could know if something is a re-export or not) |
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Sep 8, 2015
Manishearth
referenced this issue
Sep 8, 2015
Merged
Add note for possible crate mismatches in type errors #28300
bors
added a commit
that referenced
this issue
Sep 9, 2015
bors
closed this
in
#28300
Sep 9, 2015
This comment has been minimized.
This comment has been minimized.
|
No no no github, I said "partial fix" |
Manishearth
reopened this
Sep 9, 2015
This comment has been minimized.
This comment has been minimized.
|
Anyway, #28300 fixes the error when there's a type mismatch. "Can't find trait" will be a tad trickier |
This comment has been minimized.
This comment has been minimized.
hexsel
commented
Sep 9, 2015
|
I had a corner-case posted on Reddit that was even more confusing:
I was using Hyper with the latest cookie crate. I did it because even though 'hyper' depends on 'cookie=0.1.21' or somesuch, I couldn't use 'cookie' on my program. I'll suggest a change on cargo if it doesn't yet exist. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, this should be fixed but the just-landed PR. |
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium -- we think that the most important cases here have been covered. If this issue continues to arise frequently on IRC, we could bump up the priority to high. |
rust-highfive
added
P-medium
and removed
I-nominated
labels
Sep 17, 2015
Kimundi
referenced this issue
Sep 21, 2015
Open
Improve the remaining rough corners of the module system #1289
alexcrichton
removed
the
T-compiler
label
Jan 27, 2016
This comment has been minimized.
This comment has been minimized.
|
Sometimes this can suggest private paths, which makes this even more confusing. This snippet is taken from an IRC conversation with a (rightly) confused user:
Ref: #21934 |
This comment has been minimized.
This comment has been minimized.
|
I suggest we at least temporarily mitigate this by applying @huonw's third suggestion from the list, which shouldn't require interfacing with anything external.
|
This comment has been minimized.
This comment has been minimized.
|
Some of the issues here (around misleading module paths being reported) may be related to #34769 |
This comment has been minimized.
This comment has been minimized.
|
This has started popping up more frequently again on Stack Overflow due to a slow shift towards Serde 1.0 as some crates depend on Serde 0.8, 0.9, or 1.0, all of which are incompatible. |
This was referenced Jun 19, 2017
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
Jun 28, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Jun 29, 2017
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
Jul 12, 2017
Mark-Simulacrum
marked this as
a duplicate of
#43138
Jul 19, 2017
Mark-Simulacrum
referenced this issue
Jul 19, 2017
Closed
Confusing errors when deriving traits with multiple library versions #43138
Mark-Simulacrum
added
the
C-enhancement
label
Jul 22, 2017
This comment has been minimized.
This comment has been minimized.
|
@Manishearth I'm unassigning you since I don't think you are actively working on this and probably don't have it in a todo list or anything like that? |
Mark-Simulacrum
unassigned
Manishearth
Jul 22, 2017
ucarion
referenced this issue
Sep 6, 2017
Closed
Document how to convert geojson objects into geo ones #80
This comment has been minimized.
This comment has been minimized.
|
Experienced this again ("doesn't implement trait", due to disagreement about which type we were talking about). Asked about status on IRC and got "Lints are not really a priority", which I think would be too bad. |
This comment has been minimized.
This comment has been minimized.
|
This isn't a lint. |
This comment has been minimized.
This comment has been minimized.
|
I'm not sure what we are talking about, but what I meant by "this" is the missed opportunity to explain an error to the user. I agree that this is in no sense a lint, and in the future I'll explain this to people on IRC who try and speak for the project? |
This comment has been minimized.
This comment has been minimized.
|
What @Manishearth is trying to communicate is that there is a policy level of pushing most lints to Clippy or other tools rather than integrating them into the compiler. This seems more like an area where the type errors could be improved. |
This comment has been minimized.
This comment has been minimized.
|
New lints need an RFC, but this isn't a lint; it's an error message that should be improved. They're different things. |
This comment has been minimized.
This comment has been minimized.
|
Let me try again. I experienced a form of the issue described, though the version where a trait is implemented for one version of a type and not another (which may not be what was partially fixed). When asking about this issue on IRC, it was stated (by a regular, possibly not in a formal capacity) that "Lints are not really a priority". This is only meant to be another "ping" about how Rust's usually quite good error messages still have some limitations, and wasn't meant to be about who thinks it was a lint, or whether its standing as a lint makes it less interesting, or anything like that. Obviously, feel free to hash that out amongst yourselves, but not on my account. :) |
This comment has been minimized.
This comment has been minimized.
I'm meant that this is not a lint, this is diagnostics, so "lints are not a priority" doesn't apply here and whoever gave you that status was wrong about it. Though it's possible that diagnostics are no longer a priority here either (I'd be surprised, given the ergonomics initiative and prior focus on diagnostics by the docs team). |
dtolnay
referenced this issue
Sep 15, 2017
Closed
The trait `serde::de::Deserialize` is not implemented for `...` #35
This comment has been minimized.
This comment has been minimized.
|
So it appears there should be a note for this, but I don't see it in the case when you try to call a trait method and the trait is implemented for the wrong version of the struct.
Here my crate was accidentally depending on winit 0.11 whereas the trait was defined on version 0.7. |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
May 1, 2018
|
My friend just ran into this and one thing I'd like to see in error messages is explanation where those crates came from. E.g. the crate depends on I'd like to see error message like this:
I'd like to see both dependency chains in full to be able to investigate. |
huonw commentedFeb 24, 2015
https://github.com/huonw/bad-error-messages-a contains a crate
a. https://github.com/huonw/bad-error-messages-bc contains two crates,bandc.acontains a traitFooand a functiontestthat requires that trait.bdepends on a specific revision (8b532f5, not the HEAD) ofaand contains a typeBarthat implementsa::Foo.cdepends ona's HEAD (happens to be 84cfe230) andb, and tries to useb::Barwitha::test.cfails to compile despiteBar"clearly" implementingFoo... it's even displayed in the docs!Cloning https://github.com/huonw/bad-error-messages-bc and running
cargo buildin the root (which isc) givesThere's no indication of the fundamental problem from either
rustdocorrustc: that there's two different versions ofabeing used, meaninga#84cfe230::Fooanda#8b532f5::Fooare different.Baronly implements the latter, but inc, the namearefers toa#84cfe230soa::test(...)requires the former. (Usingname#revto represent the crate with that version.)There is an indication of the difference in the example above, since
ais compiled twice, but that comes fromcargo, notrustc. This issue is focusing on the fact thatrustcitself does not give helpful errors and/or allow tools like cargo to control those errors.It would be nice if rustc:
foo#0.2.3instead of the filepath/name"note: there's multiple versions of crate...in use": along with a listing of the possibilities.(NB. I've used
cargoto construct this example because it is the easiest way I can get two different versions of a crate. This appears in rust-lang/rust's makefiles too, where thestdtest runner is called "std" internally, but links against another crate called "std", i.e. the conventional standard library.)