File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed
tests/run-make/diagnostics-traits-from-duplicate-crates Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ pub trait Resource { }
2+ pub struct Ray2d ;
Original file line number Diff line number Diff line change 1+ pub type Ray = minibevy:: Ray2d ;
Original file line number Diff line number Diff line change 1+ extern crate minibevy;
2+ extern crate minirapier;
3+
4+ use minibevy:: Resource ;
5+ use minirapier:: Ray ;
6+
7+ fn insert_resource < R : Resource > ( _resource : R ) { }
8+
9+ struct Res ;
10+ impl Resource for Res { }
11+
12+ fn main ( ) {
13+ insert_resource ( Res . into ( ) ) ;
14+ }
Original file line number Diff line number Diff line change 1+ // Non-regression test for issue #132920 where multiple versions of the same crate are present in
2+ // the dependency graph, and an unexpected error in a dependent crate caused an ICE in the
3+ // unsatisfied bounds diagnostics for traits present in multiple crate versions.
4+ //
5+ // Setup:
6+ // - two versions of the same crate: minibevy_a and minibevy_b
7+ // - minirapier: depends on minibevy_a
8+ // - repro: depends on minirapier and minibevy_b
9+
10+ use run_make_support:: rustc;
11+
12+ fn main ( ) {
13+ // Prepare dependencies, mimicking a check build with cargo.
14+ rustc ( )
15+ . input ( "minibevy.rs" )
16+ . crate_name ( "minibevy" )
17+ . crate_type ( "lib" )
18+ . emit ( "metadata" )
19+ . metadata ( "a" )
20+ . extra_filename ( "-a" )
21+ . run ( ) ;
22+ rustc ( )
23+ . input ( "minibevy.rs" )
24+ . crate_name ( "minibevy" )
25+ . crate_type ( "lib" )
26+ . emit ( "metadata" )
27+ . metadata ( "b" )
28+ . extra_filename ( "-b" )
29+ . run ( ) ;
30+ rustc ( )
31+ . input ( "minirapier.rs" )
32+ . crate_name ( "minirapier" )
33+ . crate_type ( "lib" )
34+ . emit ( "metadata" )
35+ . extern_ ( "minibevy" , "libminibevy-a.rmeta" )
36+ . run ( ) ;
37+
38+ // Building the main crate used to ICE here when printing the `type annotations needed` error.
39+ rustc ( )
40+ . input ( "repro.rs" )
41+ . extern_ ( "minibevy" , "libminibevy-b.rmeta" )
42+ . extern_ ( "minirapier" , "libminirapier.rmeta" )
43+ . run_fail ( )
44+ . assert_stderr_not_contains ( "error: the compiler unexpectedly panicked. this is a bug" ) ;
45+ }
You can’t perform that action at this time.
0 commit comments