{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/22750","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/22750/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/22750/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/22750/events","html_url":"https://github.com/rust-lang/rust/issues/22750","id":58698256,"number":22750,"title":"Two different versions of a crate interacting leads to unhelpful error messages","user":{"login":"huonw","id":1203825,"avatar_url":"https://avatars2.githubusercontent.com/u/1203825?v=3","gravatar_id":"","url":"https://api.github.com/users/huonw","html_url":"https://github.com/huonw","followers_url":"https://api.github.com/users/huonw/followers","following_url":"https://api.github.com/users/huonw/following{/other_user}","gists_url":"https://api.github.com/users/huonw/gists{/gist_id}","starred_url":"https://api.github.com/users/huonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huonw/subscriptions","organizations_url":"https://api.github.com/users/huonw/orgs","repos_url":"https://api.github.com/users/huonw/repos","events_url":"https://api.github.com/users/huonw/events{/privacy}","received_events_url":"https://api.github.com/users/huonw/received_events","type":"User","site_admin":false},"labels":[{"id":235791,"url":"https://api.github.com/repos/rust-lang/rust/labels/A-diagnostics","name":"A-diagnostics","color":"d7e102","default":false},{"id":60344715,"url":"https://api.github.com/repos/rust-lang/rust/labels/P-medium","name":"P-medium","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":{"login":"Manishearth","id":1617736,"avatar_url":"https://avatars1.githubusercontent.com/u/1617736?v=3","gravatar_id":"","url":"https://api.github.com/users/Manishearth","html_url":"https://github.com/Manishearth","followers_url":"https://api.github.com/users/Manishearth/followers","following_url":"https://api.github.com/users/Manishearth/following{/other_user}","gists_url":"https://api.github.com/users/Manishearth/gists{/gist_id}","starred_url":"https://api.github.com/users/Manishearth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Manishearth/subscriptions","organizations_url":"https://api.github.com/users/Manishearth/orgs","repos_url":"https://api.github.com/users/Manishearth/repos","events_url":"https://api.github.com/users/Manishearth/events{/privacy}","received_events_url":"https://api.github.com/users/Manishearth/received_events","type":"User","site_admin":false},"assignees":[{"login":"Manishearth","id":1617736,"avatar_url":"https://avatars1.githubusercontent.com/u/1617736?v=3","gravatar_id":"","url":"https://api.github.com/users/Manishearth","html_url":"https://github.com/Manishearth","followers_url":"https://api.github.com/users/Manishearth/followers","following_url":"https://api.github.com/users/Manishearth/following{/other_user}","gists_url":"https://api.github.com/users/Manishearth/gists{/gist_id}","starred_url":"https://api.github.com/users/Manishearth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Manishearth/subscriptions","organizations_url":"https://api.github.com/users/Manishearth/orgs","repos_url":"https://api.github.com/users/Manishearth/repos","events_url":"https://api.github.com/users/Manishearth/events{/privacy}","received_events_url":"https://api.github.com/users/Manishearth/received_events","type":"User","site_admin":false}],"milestone":null,"comments":38,"created_at":"2015-02-24T06:18:29Z","updated_at":"2017-06-09T13:16:30Z","closed_at":null,"body":"https://github.com/huonw/bad-error-messages-a contains a crate `a`. https://github.com/huonw/bad-error-messages-bc contains two crates, `b` and `c`.\n- `a` contains a trait `Foo` and a function `test` that requires that trait.\n- `b` depends on a specific revision (8b532f5, not the HEAD) of `a` and contains a type `Bar` that implements `a::Foo`.\n- `c` depends on `a`'s HEAD (happens to be 84cfe230) and `b`, and tries to use `b::Bar` with `a::test`.\n\n`c` fails to compile despite `Bar` \"clearly\" implementing `Foo`... it's even displayed in the docs!\n\nCloning https://github.com/huonw/bad-error-messages-bc and running `cargo build` in the root (which is `c`) gives\n\n```\n   Compiling a v0.0.1 (https://github.com/huonw/bad-error-messages-a#84cfe230)\n   Compiling a v0.0.1 (https://github.com/huonw/bad-error-messages-a?rev=8b532f5#8b532f51)\n   Compiling b v0.0.1 (file:///home/huon/projects/test-rust/error-messages/c)\n   Compiling c v0.0.1 (file:///home/huon/projects/test-rust/error-messages/c)\nsrc/lib.rs:5:5: 5:12 error: the trait `a::Foo` is not implemented for the type `b::Bar` [E0277]\nsrc/lib.rs:5     a::test(b::Bar);\n                 ^~~~~~~\nerror: aborting due to previous error\n```\n\nThere's no indication of the fundamental problem from either `rustdoc` or `rustc`: that there's two different versions of `a` being used, meaning `a#84cfe230::Foo` and `a#8b532f5::Foo` are different. `Bar` only implements the latter, but in `c`, the name `a` refers to `a#84cfe230` so `a::test(...)` requires the former. (Using `name#rev` to represent the crate with that version.)\n\nThere _is_ an indication of the difference in the example above, since `a` is compiled twice, but that comes from `cargo`, not `rustc`. This issue is focusing on the fact that `rustc` itself does not give helpful errors and/or allow tools like cargo to control those errors.\n\nIt would be nice if rustc:\n- disambiguated ambiguous names, probably by filepath/name by default\n- allowed cargo to specify semantically relevant info for the disambiguation e.g. pass in the version/revision/..., so that rustc can print `foo#0.2.3` instead of the filepath/name\n- detected errors that may be caused by ambiguous names and noted it explicitly, e.g. when there is a error involving an ambiguous crate print (once) some extra lines like `\"note: there's multiple versions of crate `...` in use\"`: along with a listing of the possibilities.\n\n(NB. I've used `cargo` to 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 the `std` test runner is called \"std\" internally, but links against another crate called \"std\", i.e. the conventional standard library.)\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/307385636","html_url":"https://github.com/rust-lang/rust/issues/22750#issuecomment-307385636","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/22750","id":307385636,"user":{"login":"shepmaster","id":174509,"avatar_url":"https://avatars3.githubusercontent.com/u/174509?v=3","gravatar_id":"","url":"https://api.github.com/users/shepmaster","html_url":"https://github.com/shepmaster","followers_url":"https://api.github.com/users/shepmaster/followers","following_url":"https://api.github.com/users/shepmaster/following{/other_user}","gists_url":"https://api.github.com/users/shepmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/shepmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shepmaster/subscriptions","organizations_url":"https://api.github.com/users/shepmaster/orgs","repos_url":"https://api.github.com/users/shepmaster/repos","events_url":"https://api.github.com/users/shepmaster/events{/privacy}","received_events_url":"https://api.github.com/users/shepmaster/received_events","type":"User","site_admin":false},"created_at":"2017-06-09T13:16:29Z","updated_at":"2017-06-09T13:16:29Z","body":"This has started popping up more frequently 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."}}
{"actor":{"display_login":"shepmaster"}}