Skip to content

Commit 80fb4ca

Browse files
committedJul 9, 2024
rewrite type-mismatch-same-crate-name to rmake
1 parent 37599b2 commit 80fb4ca

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed
 

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,5 @@ run-make/test-benches/Makefile
142142
run-make/thumb-none-cortex-m/Makefile
143143
run-make/thumb-none-qemu/Makefile
144144
run-make/translation/Makefile
145-
run-make/type-mismatch-same-crate-name/Makefile
146145
run-make/unstable-flag-required/Makefile
147146
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile

‎tests/run-make/type-mismatch-same-crate-name/Makefile

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// When a compilation failure deals with seemingly identical types, some helpful
2+
// errors should be printed.
3+
// The main use case of this error is when there are two crates
4+
// (generally different versions of the same crate) with the same name
5+
// causing a type mismatch. In this test, one of the crates
6+
// is only introduced as an indirect dependency and the type is accessed via a reexport.
7+
// See https://github.com/rust-lang/rust/pull/42826
8+
9+
use run_make_support::{rust_lib_name, rustc};
10+
11+
fn main() {
12+
rustc().crate_type("rlib").input("crateA.rs").metadata("-1").extra_filename("-1").run();
13+
rustc().crate_type("rlib").input("crateA.rs").metadata("-2").extra_filename("-2").run();
14+
rustc()
15+
.crate_type("rlib")
16+
.input("crateB.rs")
17+
.extern_("crateA", rust_lib_name("crateA-1"))
18+
.run();
19+
rustc()
20+
.input("crateC.rs")
21+
.extern_("crateA", rust_lib_name("crateA-2"))
22+
.run_fail()
23+
.assert_stderr_contains("mismatched types")
24+
.assert_stderr_contains("crateB::try_foo(foo2);")
25+
.assert_stderr_contains("different versions of crate `crateA`")
26+
.assert_stderr_contains("crateB::try_bar(bar2);")
27+
.assert_stderr_contains("expected trait `crateA::bar::Bar`, found trait `Bar`")
28+
.assert_stderr_contains("different versions of crate `crateA`");
29+
}

0 commit comments

Comments
 (0)
Please sign in to comment.