File tree 2 files changed +46
-13
lines changed
tests/run-make/crate-loading-crate-depends-on-itself
2 files changed +46
-13
lines changed Original file line number Diff line number Diff line change
1
+ error[E0277]: the trait bound `foo::Struct: Trait` is not satisfied
2
+ --> foo-current.rs:13:19
3
+ |
4
+ 13 | check_trait::<foo::Struct>();
5
+ | ^^^^^^^^^^^ the trait `Trait` is not implemented for `foo::Struct`
6
+ |
7
+ note: there are multiple different versions of crate `foo` in the dependency graph
8
+ --> foo-current.rs:7:1
9
+ |
10
+ 4 | extern crate foo;
11
+ | ----------------- one version of crate `foo` is used here, as a direct dependency of the current crate
12
+ 5 |
13
+ 6 | pub struct Struct;
14
+ | ----------------- this type implements the required trait
15
+ 7 | pub trait Trait {}
16
+ | ^^^^^^^^^^^^^^^ this is the required trait
17
+ |
18
+ ::: foo-prev.rs:X:Y
19
+ |
20
+ 4 | pub struct Struct;
21
+ | ----------------- this type doesn't implement the required trait
22
+ 5 | pub trait Trait {}
23
+ | --------------- this is the found trait
24
+ = note: two types coming from two different versions of the same crate are different types even if they look the same
25
+ = help: you can use `cargo tree` to explore your dependency tree
26
+ note: required by a bound in `check_trait`
27
+ --> foo-current.rs:10:19
28
+ |
29
+ 10 | fn check_trait<T: Trait>() {}
30
+ | ^^^^^ required by this bound in `check_trait`
31
+
32
+ error: aborting due to 1 previous error
33
+
34
+ For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change 7
7
// and traits of the different versions are mixed, we produce diagnostic output and not an ICE.
8
8
// #133563
9
9
10
- use run_make_support:: { rust_lib_name, rustc} ;
10
+ use run_make_support:: { diff , rust_lib_name, rustc} ;
11
11
12
12
fn main ( ) {
13
13
rustc ( ) . input ( "foo-prev.rs" ) . run ( ) ;
14
14
15
- rustc ( )
15
+ let out = rustc ( )
16
16
. extra_filename ( "current" )
17
17
. metadata ( "current" )
18
18
. input ( "foo-current.rs" )
19
19
. extern_ ( "foo" , rust_lib_name ( "foo" ) )
20
20
. run_fail ( )
21
- . assert_stderr_contains ( r#"
22
- note: there are multiple different versions of crate `foo` in the dependency graph
23
- --> foo-current.rs:7:1
24
- |
25
- 4 | extern crate foo;
26
- | ----------------- one version of crate `foo` is used here, as a direct dependency of the current crate
27
- 5 |
28
- 6 | pub struct Struct;
29
- | ----------------- this type implements the required trait
30
- 7 | pub trait Trait {}
31
- | ^^^^^^^^^^^^^^^ this is the required trait"# ) ;
21
+ . stderr_utf8 ( ) ;
22
+
23
+ // We don't remap the path of the `foo-prev` crate, so we remap it here.
24
+ let mut lines: Vec < _ > = out. lines ( ) . collect ( ) ;
25
+ for line in & mut lines {
26
+ if line. starts_with ( " ::: " ) {
27
+ * line = " ::: foo-prev.rs:X:Y" ;
28
+ }
29
+ }
30
+ diff ( ) . expected_file ( "foo.stderr" ) . actual_text ( "(rustc)" , & lines. join ( "\n " ) ) . run ( ) ;
32
31
}
You can’t perform that action at this time.
0 commit comments