1 // aux-build:crate_a1.rs
2 // aux-build:crate_a2.rs
4 // This tests the extra note reported when a type error deals with
5 // seemingly identical types.
6 // The main use case of this error is when there are two crates
7 // (generally different versions of the same crate) with the same name
8 // causing a type mismatch. Here, we simulate that error using block-scoped
9 // aliased `extern crate` declarations.
12 let foo2 = {extern crate crate_a2 as a; a::Foo};
13 let bar2 = {extern crate crate_a2 as a; a::bar()};
15 extern crate crate_a1 as a;
17 //~^ ERROR mismatched types
18 //~| perhaps two different versions of crate `crate_a1`
19 //~| expected struct `main::a::Foo`
21 //~^ ERROR mismatched types
22 //~| perhaps two different versions of crate `crate_a1`
23 //~| expected trait `main::a::Bar`
24 //~| expected struct `Box<(dyn main::a::Bar + 'static)>`
25 //~| found struct `Box<dyn main::a::Bar>`