Move test to be make instead of ui

This commit is contained in:
Esteban Küber 2024-08-06 02:14:08 +00:00
parent f4bad4fa39
commit 5e26c8d3c9
8 changed files with 47 additions and 132 deletions

View File

@ -0,0 +1,6 @@
#![crate_name = "dependency"]
#![crate_type = "rlib"]
pub struct Type;
pub trait Trait {}
impl Trait for Type {}
pub fn do_something<X: Trait>(_: X) {}

View File

@ -1,6 +1,5 @@
#![crate_name="dependency"] #![crate_name = "dependency"]
//@ edition:2021 #![crate_type = "rlib"]
//@ compile-flags: -C metadata=2 -C extra-filename=-2
pub struct Type(pub i32); pub struct Type(pub i32);
pub trait Trait {} pub trait Trait {}
impl Trait for Type {} impl Trait for Type {}

View File

@ -0,0 +1,8 @@
extern crate dep_2_reexport;
extern crate dependency;
use dep_2_reexport::do_something;
use dependency::Type;
fn main() {
do_something(Type);
}

View File

@ -0,0 +1,31 @@
//@ only-linux
//@ ignore-wasm32
//@ ignore-wasm64
use run_make_support::rfs::copy;
use run_make_support::{assert_contains, rust_lib_name, rustc};
fn main() {
rustc().input("multiple-dep-versions-1.rs").run();
rustc().input("multiple-dep-versions-2.rs").extra_filename("2").metadata("2").run();
let out = rustc()
.input("multiple-dep-versions.rs")
.extern_("dependency", rust_lib_name("dependency"))
.extern_("dep_2_reexport", rust_lib_name("dependency2"))
.inspect(|cmd| eprintln!("{cmd:?}"))
.run_fail();
let stderr = out.stderr_utf8();
assert_contains(
&stderr,
"you have multiple different versions of crate `dependency` in your dependency graph",
);
assert_contains(
&stderr,
"two types coming from two different versions of the same crate are different types even \
if they look the same",
);
assert_contains(&stderr, "this type doesn't implement the required trait");
assert_contains(&stderr, "this type implements the required trait");
assert_contains(&stderr, "this is the required trait");
}

View File

@ -1,4 +0,0 @@
//@ edition:2021
//@ aux-build:multiple-dep-versions-2.rs
extern crate dependency;
pub use dependency::do_something;

View File

@ -1,7 +0,0 @@
#![crate_name="dependency"]
//@ edition:2021
//@ compile-flags: -C metadata=1 -C extra-filename=-1
pub struct Type;
pub trait Trait {}
impl Trait for Type {}
pub fn do_something<X: Trait>(_: X) { }

View File

@ -1,15 +0,0 @@
//@ aux-build:dep-2-reexport.rs
//@ aux-build:multiple-dep-versions-1.rs
//@ edition:2021
//@ compile-flags: --error-format=human --color=always --crate-type bin --extern dependency={{build-base}}/crate-loading/multiple-dep-versions/auxiliary/libdependency-1.so --extern dep_2_reexport={{build-base}}/crate-loading/multiple-dep-versions/auxiliary/libdep_2_reexport.so
//@ only-linux
//@ ignore-wasm32
extern crate dependency;
extern crate dep_2_reexport;
use dependency::Type;
use dep_2_reexport::do_something;
fn main() {
do_something(Type);
}

View File

@ -1,103 +0,0 @@
<svg width="1054px" height="704px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-012 { fill: #5555FF }
.fg-ansi256-014 { fill: #55FFFF }
.fg-magenta { fill: #AA00AA }
.container {
padding: 0 10px;
line-height: 18px;
}
.bold { font-weight: bold; }
tspan {
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
white-space: pre;
line-height: 18px;
}
</style>
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0277]</tspan><tspan class="bold">: the trait bound `Type: dependency::Trait` is not satisfied</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiple-dep-versions.rs:14:18</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> do_something(Type);</tspan>
</tspan>
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">------------</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">the trait `dependency::Trait` is not implemented for `Type`</tspan>
</tspan>
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">required by a bound introduced by this call</tspan>
</tspan>
<tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="172px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you have </tspan><tspan class="fg-magenta bold">multiple different versions</tspan><tspan> of crate `</tspan><tspan class="fg-magenta bold">dependency</tspan><tspan>` in your dependency graph</tspan>
</tspan>
<tspan x="10px" y="190px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiple-dep-versions.rs:8:1</tspan>
</tspan>
<tspan x="10px" y="208px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="226px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> extern crate dependency;</tspan>
</tspan>
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-014 bold">^^^^^^^^^^^^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-014 bold">one version of crate `dependency` is used here, as a direct dependency of the current crate</tspan>
</tspan>
<tspan x="10px" y="262px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> extern crate dep_2_reexport;</tspan>
</tspan>
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-014 bold">^^^^^^^^^^^^^^^^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-014 bold">one version of crate `dependency` is used here, as a dependency of crate `dep_2_reexport`</tspan>
</tspan>
<tspan x="10px" y="298px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: two types coming from two different versions of the same crate are different types </tspan><tspan class="fg-magenta bold">even if they look the same</tspan>
</tspan>
<tspan x="10px" y="316px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/auxiliary/multiple-dep-versions-1.rs:4:1</tspan>
</tspan>
<tspan x="10px" y="334px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="352px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> pub struct Type;</tspan>
</tspan>
<tspan x="10px" y="370px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">this type doesn't implement the required trait</tspan>
</tspan>
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">::: </tspan><tspan>$DIR/auxiliary/multiple-dep-versions-2.rs:4:1</tspan>
</tspan>
<tspan x="10px" y="424px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="442px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> pub struct Type(pub i32);</tspan>
</tspan>
<tspan x="10px" y="460px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">this type implements the required trait</tspan>
</tspan>
<tspan x="10px" y="478px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> pub trait Trait {}</tspan>
</tspan>
<tspan x="10px" y="496px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">this is the required trait</tspan>
</tspan>
<tspan x="10px" y="514px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: you can use `cargo tree` to explore your dependency tree</tspan>
</tspan>
<tspan x="10px" y="532px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: required by a bound in `dep_2_reexport::do_something`</tspan>
</tspan>
<tspan x="10px" y="550px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/auxiliary/multiple-dep-versions-2.rs:7:24</tspan>
</tspan>
<tspan x="10px" y="568px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="586px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> pub fn do_something&lt;X: Trait&gt;(_: X) {}</tspan>
</tspan>
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">required by this bound in `do_something`</tspan>
</tspan>
<tspan x="10px" y="622px">
</tspan>
<tspan x="10px" y="640px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
</tspan>
<tspan x="10px" y="658px">
</tspan>
<tspan x="10px" y="676px"><tspan class="bold">For more information about this error, try `rustc --explain E0277`.</tspan>
</tspan>
<tspan x="10px" y="694px">
</tspan>
</text>
</svg>

Before

Width:  |  Height:  |  Size: 7.4 KiB