about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-26 12:04:35 -0400
committerOneirical <manchot@videotron.ca>2024-06-26 12:04:35 -0400
commitbfc8dc8e5fb937ccc1e163e5f23d2561f0bd66c9 (patch)
treeb866b2aa125edd398fe1b8acf4dff7e1b9a00d92
parent4bdf8d2d5877f20b54c1506a607ad8c4744cc387 (diff)
downloadrust-bfc8dc8e5fb937ccc1e163e5f23d2561f0bd66c9.tar.gz
rust-bfc8dc8e5fb937ccc1e163e5f23d2561f0bd66c9.zip
rewrite use-suggestions-rust-2018 to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/use-suggestions-rust-2018/Makefile7
-rw-r--r--tests/run-make/use-suggestions-rust-2018/rmake.rs18
3 files changed, 18 insertions, 8 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index cb68589d8a4..199d9fd53f3 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -193,7 +193,6 @@ run-make/translation/Makefile
 run-make/type-mismatch-same-crate-name/Makefile
 run-make/unknown-mod-stdin/Makefile
 run-make/unstable-flag-required/Makefile
-run-make/use-suggestions-rust-2018/Makefile
 run-make/used-cdylib-macos/Makefile
 run-make/volatile-intrinsics/Makefile
 run-make/wasm-exceptions-nostd/Makefile
diff --git a/tests/run-make/use-suggestions-rust-2018/Makefile b/tests/run-make/use-suggestions-rust-2018/Makefile
deleted file mode 100644
index 37cd6283c0a..00000000000
--- a/tests/run-make/use-suggestions-rust-2018/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-include ../tools.mk
-
-all:
-	$(RUSTC) ep-nested-lib.rs
-
-	$(RUSTC) use-suggestions.rs --edition=2018 --extern ep_nested_lib=$(TMPDIR)/libep_nested_lib.rlib 2>&1 | $(CGREP) "use ep_nested_lib::foo::bar::Baz"
-
diff --git a/tests/run-make/use-suggestions-rust-2018/rmake.rs b/tests/run-make/use-suggestions-rust-2018/rmake.rs
new file mode 100644
index 00000000000..52c694da75e
--- /dev/null
+++ b/tests/run-make/use-suggestions-rust-2018/rmake.rs
@@ -0,0 +1,18 @@
+// The compilation error caused by calling on an unimported crate
+// should have a suggestion to write, say, crate::bar::Foo instead
+// of just bar::Foo. However, this suggestion used to only appear for
+// extern crate statements, not crate struct. After this was fixed in #51456,
+// this test checks that the correct suggestion is printed no matter what.
+// See https://github.com/rust-lang/rust/issues/51212
+
+use run_make_support::{rust_lib_name, rustc};
+
+fn main() {
+    rustc().input("ep-nested-lib.rs").run();
+    rustc()
+        .input("use-suggestions.rs")
+        .edition("2018")
+        .extern_("ep_nested_lib", rust_lib_name("ep_nested_lib"))
+        .run_fail()
+        .assert_stderr_contains("use ep_nested_lib::foo::bar::Baz");
+}