-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Two different versions of a crate interacting leads to unhelpful error messages #22750
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-crate-version-mismatchDiagnostics: Errors or lints caused be the use of two different crate versions.Diagnostics: Errors or lints caused be the use of two different crate versions.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-crate-version-mismatchDiagnostics: Errors or lints caused be the use of two different crate versions.Diagnostics: Errors or lints caused be the use of two different crate versions.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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.)