about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-08-06 02:14:08 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-08-06 17:58:12 +0000
commit5e26c8d3c925f3b923328f452b6d8a8bdd0675fc (patch)
tree1596067e9c0584854472443e55ea4849b752a9fd
parentf4bad4fa39902cade8e6e4c4db9c148831faf9e0 (diff)
downloadrust-5e26c8d3c925f3b923328f452b6d8a8bdd0675fc.tar.gz
rust-5e26c8d3c925f3b923328f452b6d8a8bdd0675fc.zip
Move test to be make instead of ui
-rw-r--r--tests/run-make/crate-loading/multiple-dep-versions-1.rs6
-rw-r--r--tests/run-make/crate-loading/multiple-dep-versions-2.rs (renamed from tests/ui/crate-loading/auxiliary/multiple-dep-versions-2.rs)5
-rw-r--r--tests/run-make/crate-loading/multiple-dep-versions.rs8
-rw-r--r--tests/run-make/crate-loading/rmake.rs31
-rw-r--r--tests/ui/crate-loading/auxiliary/dep-2-reexport.rs4
-rw-r--r--tests/ui/crate-loading/auxiliary/multiple-dep-versions-1.rs7
-rw-r--r--tests/ui/crate-loading/multiple-dep-versions.rs15
-rw-r--r--tests/ui/crate-loading/multiple-dep-versions.svg103
8 files changed, 47 insertions, 132 deletions
diff --git a/tests/run-make/crate-loading/multiple-dep-versions-1.rs b/tests/run-make/crate-loading/multiple-dep-versions-1.rs
new file mode 100644
index 00000000000..2d351633829
--- /dev/null
+++ b/tests/run-make/crate-loading/multiple-dep-versions-1.rs
@@ -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) {}
diff --git a/tests/ui/crate-loading/auxiliary/multiple-dep-versions-2.rs b/tests/run-make/crate-loading/multiple-dep-versions-2.rs
index c79157fa463..a5df3dc61ed 100644
--- a/tests/ui/crate-loading/auxiliary/multiple-dep-versions-2.rs
+++ b/tests/run-make/crate-loading/multiple-dep-versions-2.rs
@@ -1,6 +1,5 @@
-#![crate_name="dependency"]
-//@ edition:2021
-//@ compile-flags: -C metadata=2 -C extra-filename=-2
+#![crate_name = "dependency"]
+#![crate_type = "rlib"]
 pub struct Type(pub i32);
 pub trait Trait {}
 impl Trait for Type {}
diff --git a/tests/run-make/crate-loading/multiple-dep-versions.rs b/tests/run-make/crate-loading/multiple-dep-versions.rs
new file mode 100644
index 00000000000..5a6cb03aaa4
--- /dev/null
+++ b/tests/run-make/crate-loading/multiple-dep-versions.rs
@@ -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);
+}
diff --git a/tests/run-make/crate-loading/rmake.rs b/tests/run-make/crate-loading/rmake.rs
new file mode 100644
index 00000000000..2aa396fd2d9
--- /dev/null
+++ b/tests/run-make/crate-loading/rmake.rs
@@ -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");
+}
diff --git a/tests/ui/crate-loading/auxiliary/dep-2-reexport.rs b/tests/ui/crate-loading/auxiliary/dep-2-reexport.rs
deleted file mode 100644
index 3a793bbbb10..00000000000
--- a/tests/ui/crate-loading/auxiliary/dep-2-reexport.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-//@ edition:2021
-//@ aux-build:multiple-dep-versions-2.rs
-extern crate dependency;
-pub use dependency::do_something;
diff --git a/tests/ui/crate-loading/auxiliary/multiple-dep-versions-1.rs b/tests/ui/crate-loading/auxiliary/multiple-dep-versions-1.rs
deleted file mode 100644
index b96bb6d9e64..00000000000
--- a/tests/ui/crate-loading/auxiliary/multiple-dep-versions-1.rs
+++ /dev/null
@@ -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) { }
diff --git a/tests/ui/crate-loading/multiple-dep-versions.rs b/tests/ui/crate-loading/multiple-dep-versions.rs
deleted file mode 100644
index ceb9b57717d..00000000000
--- a/tests/ui/crate-loading/multiple-dep-versions.rs
+++ /dev/null
@@ -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);
-}
diff --git a/tests/ui/crate-loading/multiple-dep-versions.svg b/tests/ui/crate-loading/multiple-dep-versions.svg
deleted file mode 100644
index 1cfcfab562f..00000000000
--- a/tests/ui/crate-loading/multiple-dep-versions.svg
+++ /dev/null
@@ -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>