File tree 3 files changed +29
-20
lines changed
tests/run-make/type-mismatch-same-crate-name
3 files changed +29
-20
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,5 @@ run-make/test-benches/Makefile
142
142
run-make/thumb-none-cortex-m/Makefile
143
143
run-make/thumb-none-qemu/Makefile
144
144
run-make/translation/Makefile
145
- run-make/type-mismatch-same-crate-name/Makefile
146
145
run-make/unstable-flag-required/Makefile
147
146
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // When a compilation failure deals with seemingly identical types, some helpful
2
+ // errors should be printed.
3
+ // The main use case of this error is when there are two crates
4
+ // (generally different versions of the same crate) with the same name
5
+ // causing a type mismatch. In this test, one of the crates
6
+ // is only introduced as an indirect dependency and the type is accessed via a reexport.
7
+ // See https://github.com/rust-lang/rust/pull/42826
8
+
9
+ use run_make_support:: { rust_lib_name, rustc} ;
10
+
11
+ fn main ( ) {
12
+ rustc ( ) . crate_type ( "rlib" ) . input ( "crateA.rs" ) . metadata ( "-1" ) . extra_filename ( "-1" ) . run ( ) ;
13
+ rustc ( ) . crate_type ( "rlib" ) . input ( "crateA.rs" ) . metadata ( "-2" ) . extra_filename ( "-2" ) . run ( ) ;
14
+ rustc ( )
15
+ . crate_type ( "rlib" )
16
+ . input ( "crateB.rs" )
17
+ . extern_ ( "crateA" , rust_lib_name ( "crateA-1" ) )
18
+ . run ( ) ;
19
+ rustc ( )
20
+ . input ( "crateC.rs" )
21
+ . extern_ ( "crateA" , rust_lib_name ( "crateA-2" ) )
22
+ . run_fail ( )
23
+ . assert_stderr_contains ( "mismatched types" )
24
+ . assert_stderr_contains ( "crateB::try_foo(foo2);" )
25
+ . assert_stderr_contains ( "different versions of crate `crateA`" )
26
+ . assert_stderr_contains ( "crateB::try_bar(bar2);" )
27
+ . assert_stderr_contains ( "expected trait `crateA::bar::Bar`, found trait `Bar`" )
28
+ . assert_stderr_contains ( "different versions of crate `crateA`" ) ;
29
+ }
You can’t perform that action at this time.
0 commit comments