You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
```
error[E0277]: the trait bound `dep_2_reexport::Type: Trait` is not satisfied because the trait comes from a different crate version
--> multiple-dep-versions.rs:7:18
|
7 | do_something(Type);
| ^^^^ the trait `Trait` is not implemented for `dep_2_reexport::Type`
|
note: there are multiple different versions of crate `dependency` in the dependency graph
--> /home/gh-estebank/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-1.rs:4:1
|
3 | pub struct Type(pub i32);
| --------------- this type implements the required trait
4 | pub trait Trait {
| ^^^^^^^^^^^^^^^ this is the required trait
|
::: multiple-dep-versions.rs:1:1
|
1 | extern crate dep_2_reexport;
| ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo`
2 | extern crate dependency;
| ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate
|
::: /home/gh-estebank/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-2.rs:3:1
|
3 | pub struct Type;
| --------------- this type doesn't implement the required trait
4 | pub trait Trait {
| --------------- this is the found trait
= note: two types coming from two different versions of the same crate are different types even if they look the same
= help: you can use `cargo tree` to explore your dependency tree
```
The approach to accomplish this is a HACK, and we'd want a better way to do this. I believe that moving E0277 to be a structured diagnostic would help in that regard.
.assert_stderr_contains(r#"error[E0277]: the trait bound `dep_2_reexport::Type: Trait` is not satisfied
22
-
--> multiple-dep-versions.rs:7:18
23
-
|
24
-
7 | do_something(Type);
25
-
| ------------ ^^^^ the trait `Trait` is not implemented for `dep_2_reexport::Type`
26
-
| |
27
-
| required by a bound introduced by this call
28
-
|
21
+
.assert_stderr_contains(r#"error[E0277]: the trait bound `dep_2_reexport::Type: Trait` is not satisfied because the trait comes from a different crate version
22
+
--> multiple-dep-versions.rs:7:18
23
+
|
24
+
7 | do_something(Type);
25
+
| ^^^^ the trait `Trait` is not implemented for `dep_2_reexport::Type`
26
+
|
29
27
note: there are multiple different versions of crate `dependency` in the dependency graph"#)
30
28
.assert_stderr_contains(r#"
31
-
3 | pub struct Type(pub i32);
32
-
| --------------- this type implements the required trait
33
-
4 | pub trait Trait {
34
-
| ^^^^^^^^^^^^^^^ this is the required trait
29
+
3 | pub struct Type(pub i32);
30
+
| --------------- this type implements the required trait
31
+
4 | pub trait Trait {
32
+
| ^^^^^^^^^^^^^^^ this is the required trait
35
33
"#)
36
34
.assert_stderr_contains(r#"
37
-
1 | extern crate dep_2_reexport;
38
-
| ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo`
39
-
2 | extern crate dependency;
40
-
| ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate"#)
35
+
1 | extern crate dep_2_reexport;
36
+
| ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo`
37
+
2 | extern crate dependency;
38
+
| ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate"#)
41
39
.assert_stderr_contains(r#"
42
-
3 | pub struct Type;
43
-
| --------------- this type doesn't implement the required trait
44
-
4 | pub trait Trait {
45
-
| --------------- this is the found trait
46
-
= note: two types coming from two different versions of the same crate are different types even if they look the same
47
-
= help: you can use `cargo tree` to explore your dependency tree"#)
48
-
.assert_stderr_contains(r#"note: required by a bound in `do_something`"#)
49
-
.assert_stderr_contains(r#"
50
-
12 | pub fn do_something<X: Trait>(_: X) {}
51
-
| ^^^^^ required by this bound in `do_something`"#)
40
+
3 | pub struct Type;
41
+
| --------------- this type doesn't implement the required trait
42
+
4 | pub trait Trait {
43
+
| --------------- this is the found trait
44
+
= note: two types coming from two different versions of the same crate are different types even if they look the same
45
+
= help: you can use `cargo tree` to explore your dependency tree"#)
52
46
.assert_stderr_contains(r#"error[E0599]: no method named `foo` found for struct `dep_2_reexport::Type` in the current scope
0 commit comments