about summary refs log tree commit diff
path: root/tests/run-make/diagnostics-traits-from-duplicate-crates/rmake.rs
blob: 5bc0a0c9519fda15ee0f450da419f36079796367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//@ needs-target-std
//
// Non-regression test for issue #132920 where multiple versions of the same crate are present in
// the dependency graph, and an unexpected error in a dependent crate caused an ICE in the
// unsatisfied bounds diagnostics for traits present in multiple crate versions.
//
// Setup:
// - two versions of the same crate: minibevy_a and minibevy_b
// - minirapier: depends on minibevy_a
// - repro: depends on minirapier and minibevy_b

use run_make_support::rustc;

fn main() {
    // Prepare dependencies, mimicking a check build with cargo.
    rustc()
        .input("minibevy.rs")
        .crate_name("minibevy")
        .crate_type("lib")
        .emit("metadata")
        .metadata("a")
        .extra_filename("-a")
        .run();
    rustc()
        .input("minibevy.rs")
        .crate_name("minibevy")
        .crate_type("lib")
        .emit("metadata")
        .metadata("b")
        .extra_filename("-b")
        .run();
    rustc()
        .input("minirapier.rs")
        .crate_name("minirapier")
        .crate_type("lib")
        .emit("metadata")
        .extern_("minibevy", "libminibevy-a.rmeta")
        .run();

    // Building the main crate used to ICE here when printing the `type annotations needed` error.
    rustc()
        .input("repro.rs")
        .extern_("minibevy", "libminibevy-b.rmeta")
        .extern_("minirapier", "libminirapier.rmeta")
        .run_fail()
        .assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug");
}