about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/tools/run-make-support/src/rustc.rs6
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/issue64319/Makefile40
-rw-r--r--tests/run-make/share-generics-export-again/bar.rs (renamed from tests/run-make/issue64319/bar.rs)0
-rw-r--r--tests/run-make/share-generics-export-again/foo.rs (renamed from tests/run-make/issue64319/foo.rs)0
-rw-r--r--tests/run-make/share-generics-export-again/rmake.rs45
6 files changed, 51 insertions, 41 deletions
diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs
index d034826a830..f581204d5f1 100644
--- a/src/tools/run-make-support/src/rustc.rs
+++ b/src/tools/run-make-support/src/rustc.rs
@@ -64,6 +64,12 @@ impl Rustc {
         self
     }
 
+    /// Specify a specific optimization level.
+    pub fn opt_level(&mut self, option: &str) -> &mut Self {
+        self.cmd.arg(format!("-Copt-level={option}"));
+        self
+    }
+
     /// Specify type(s) of output files to generate.
     pub fn emit(&mut self, kinds: &str) -> &mut Self {
         self.cmd.arg(format!("--emit={kinds}"));
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 3412d03b180..ff339ed2f71 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -128,7 +128,6 @@ run-make/issue-85401-static-mir/Makefile
 run-make/issue-85441/Makefile
 run-make/issue-88756-default-output/Makefile
 run-make/issue-97463-abi-param-passing/Makefile
-run-make/issue64319/Makefile
 run-make/jobserver-error/Makefile
 run-make/libs-through-symlinks/Makefile
 run-make/libtest-json/Makefile
diff --git a/tests/run-make/issue64319/Makefile b/tests/run-make/issue64319/Makefile
deleted file mode 100644
index 56346cbcc15..00000000000
--- a/tests/run-make/issue64319/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# Different optimization levels imply different values for `-Zshare-generics`,
-# so try out a whole bunch of combinations to make sure everything is compatible
-all:
-	# First up, try some defaults
-	$(RUSTC) --crate-type rlib foo.rs
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=3
-
-	# Next try mixing up some things explicitly
-	$(RUSTC) --crate-type rlib foo.rs -Z share-generics=no
-	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no
-	$(RUSTC) --crate-type rlib foo.rs -Z share-generics=no
-	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes
-	$(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes
-	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no
-	$(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes
-	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes
-
-	# Now combine a whole bunch of options together
-	$(RUSTC) --crate-type rlib foo.rs
-	$(RUSTC) --crate-type dylib bar.rs
-	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no
-	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=1
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=no
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=yes
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=2
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=no
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=yes
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=3
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=no
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=yes
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=s
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=no
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=yes
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=z
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=no
-	$(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=yes
diff --git a/tests/run-make/issue64319/bar.rs b/tests/run-make/share-generics-export-again/bar.rs
index 3895c0b6cdb..3895c0b6cdb 100644
--- a/tests/run-make/issue64319/bar.rs
+++ b/tests/run-make/share-generics-export-again/bar.rs
diff --git a/tests/run-make/issue64319/foo.rs b/tests/run-make/share-generics-export-again/foo.rs
index c54a238e9ad..c54a238e9ad 100644
--- a/tests/run-make/issue64319/foo.rs
+++ b/tests/run-make/share-generics-export-again/foo.rs
diff --git a/tests/run-make/share-generics-export-again/rmake.rs b/tests/run-make/share-generics-export-again/rmake.rs
new file mode 100644
index 00000000000..b9964eb442a
--- /dev/null
+++ b/tests/run-make/share-generics-export-again/rmake.rs
@@ -0,0 +1,45 @@
+// When crates had different optimization levels, a bug caused
+// incorrect symbol name generations. -Z share-generics could
+// also fail to re-export upstream generics on multiple compile
+// runs of the same dynamic library.
+
+// This test repeatedly compiles an rlib and a dylib with these flags
+// to check if this bug ever returns.
+
+// See https://github.com/rust-lang/rust/pull/68277
+// See https://github.com/rust-lang/rust/issues/64319
+//@ ignore-cross-compile
+
+use run_make_support::rustc;
+
+fn main() {
+    rustc().crate_type("rlib").input("foo.rs").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("3").run();
+    rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=no").run();
+    rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run();
+    rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=no").run();
+    rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run();
+    rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("rlib").input("foo.rs").run();
+    rustc().crate_type("dylib").input("bar.rs").run();
+    rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run();
+    rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("1").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("1").arg("-Zshare-generics=no").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("1").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("2").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("2").arg("-Zshare-generics=no").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("2").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("3").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("3").arg("-Zshare-generics=no").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("3").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("s").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("s").arg("-Zshare-generics=no").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("s").arg("-Zshare-generics=yes").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("z").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("z").arg("-Zshare-generics=no").run();
+    rustc().crate_type("dylib").input("bar.rs").opt_level("z").arg("-Zshare-generics=yes").run();
+}