From 46091b083617953fe48ccf98d6cbff138cd78f9b Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 17 May 2024 15:05:36 -0400 Subject: [PATCH] rewrite and rename issue-46239 --- src/tools/run-make-support/src/rustc.rs | 6 ++++++ src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/issue-46239/Makefile | 6 ------ .../{issue-46239 => no-mark-noalias}/main.rs | 0 tests/run-make/no-mark-noalias/rmake.rs | 14 ++++++++++++++ 5 files changed, 20 insertions(+), 7 deletions(-) delete mode 100644 tests/run-make/issue-46239/Makefile rename tests/run-make/{issue-46239 => no-mark-noalias}/main.rs (100%) create mode 100644 tests/run-make/no-mark-noalias/rmake.rs diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs index d034826a830b4..f581204d5f1cb 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 1a3d6f8d81360..379d07ed22ded 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -112,7 +112,6 @@ run-make/issue-37839/Makefile run-make/issue-37893/Makefile run-make/issue-38237/Makefile run-make/issue-40535/Makefile -run-make/issue-46239/Makefile run-make/issue-47384/Makefile run-make/issue-47551/Makefile run-make/issue-51671/Makefile diff --git a/tests/run-make/issue-46239/Makefile b/tests/run-make/issue-46239/Makefile deleted file mode 100644 index 0006ced25156a..0000000000000 --- a/tests/run-make/issue-46239/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: - $(RUSTC) main.rs -C opt-level=1 - $(call RUN,main) diff --git a/tests/run-make/issue-46239/main.rs b/tests/run-make/no-mark-noalias/main.rs similarity index 100% rename from tests/run-make/issue-46239/main.rs rename to tests/run-make/no-mark-noalias/main.rs diff --git a/tests/run-make/no-mark-noalias/rmake.rs b/tests/run-make/no-mark-noalias/rmake.rs new file mode 100644 index 0000000000000..d47cc998961b6 --- /dev/null +++ b/tests/run-make/no-mark-noalias/rmake.rs @@ -0,0 +1,14 @@ +// In the rustc_trans crate, references returned by a Frozen pointer type +// could mark them as "noalias", which caused miscompilation errors. +// This test runs the most minimal possible code that can reproduce this bug, +// and checks that compilation remains successful. +// See https://github.com/rust-lang/rust/issues/46239 + +//@ ignore-cross-compile + +use run_make_support::{run, rustc}; + +fn main() { + rustc().input("main.rs").opt_level("1").run(); + run("main"); +}