about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-25 15:02:19 -0400
committerOneirical <manchot@videotron.ca>2024-06-25 15:02:19 -0400
commitee529b72f911250a4c5b717f42fb955cdc08aad5 (patch)
tree3e9e961c726d5b0edde4b6c27050db53e86620d5
parentfe2406bcef7d0c51a39537283c7c151c8a2da238 (diff)
downloadrust-ee529b72f911250a4c5b717f42fb955cdc08aad5.tar.gz
rust-ee529b72f911250a4c5b717f42fb955cdc08aad5.zip
rewrite and rename issue-20626 to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/issue-20626/Makefile9
-rw-r--r--tests/run-make/raw-fn-pointer-opt-undefined-behavior/foo.rs (renamed from tests/run-make/issue-20626/foo.rs)0
-rw-r--r--tests/run-make/raw-fn-pointer-opt-undefined-behavior/rmake.rs16
4 files changed, 16 insertions, 10 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 560fd5c586e..cb68589d8a4 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -60,7 +60,6 @@ run-make/issue-109934-lto-debuginfo/Makefile
 run-make/issue-14698/Makefile
 run-make/issue-15460/Makefile
 run-make/issue-18943/Makefile
-run-make/issue-20626/Makefile
 run-make/issue-22131/Makefile
 run-make/issue-25581/Makefile
 run-make/issue-26006/Makefile
diff --git a/tests/run-make/issue-20626/Makefile b/tests/run-make/issue-20626/Makefile
deleted file mode 100644
index 63eee910a9c..00000000000
--- a/tests/run-make/issue-20626/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# Test output to be four
-# The original error only occurred when printing, not when comparing using assert!
-
-all:
-	$(RUSTC) foo.rs -O
-	[ `$(call RUN,foo)` = "4" ]
diff --git a/tests/run-make/issue-20626/foo.rs b/tests/run-make/raw-fn-pointer-opt-undefined-behavior/foo.rs
index 1007686d9fe..1007686d9fe 100644
--- a/tests/run-make/issue-20626/foo.rs
+++ b/tests/run-make/raw-fn-pointer-opt-undefined-behavior/foo.rs
diff --git a/tests/run-make/raw-fn-pointer-opt-undefined-behavior/rmake.rs b/tests/run-make/raw-fn-pointer-opt-undefined-behavior/rmake.rs
new file mode 100644
index 00000000000..61cf559a8fe
--- /dev/null
+++ b/tests/run-make/raw-fn-pointer-opt-undefined-behavior/rmake.rs
@@ -0,0 +1,16 @@
+// Despite the absence of any unsafe Rust code, foo.rs in this test would,
+// because of the raw function pointer,
+// cause undefined behavior and fail to print the expected result, "4" -
+// only when activating optimizations (opt-level 2). This test checks
+// that this bug does not make a resurgence.
+// Note that the bug cannot be observed in an assert_eq!, only in the stdout.
+// See https://github.com/rust-lang/rust/issues/20626
+
+//@ ignore-cross-compile
+
+use run_make_support::{run, rustc};
+
+fn main() {
+    rustc().input("foo.rs").opt().run();
+    run("foo").assert_stdout_equals("4");
+}