diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index af5ae6a8e60..cb58f08a0fc 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -35,7 +35,7 @@ pub use llvm::{ LlvmProfdata, LlvmReadobj, }; pub use run::{cmd, run, run_fail, run_with_args}; -pub use rustc::{aux_build, rustc, Rustc}; +pub use rustc::{aux_build, bare_rustc, rustc, Rustc}; pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc}; #[track_caller] diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs index 885b361f72a..a2a7c8064dc 100644 --- a/src/tools/run-make-support/src/rustc.rs +++ b/src/tools/run-make-support/src/rustc.rs @@ -10,6 +10,12 @@ pub fn rustc() -> Rustc { Rustc::new() } +/// Construct a plain `rustc` invocation with no flags set. +#[track_caller] +pub fn bare_rustc() -> Rustc { + Rustc::bare() +} + /// Construct a new `rustc` aux-build invocation. #[track_caller] pub fn aux_build() -> Rustc { @@ -30,7 +36,6 @@ fn setup_common() -> Command { let rustc = env_var("RUSTC"); let mut cmd = Command::new(rustc); set_host_rpath(&mut cmd); - cmd.arg("-L").arg(cwd()); cmd } @@ -40,6 +45,14 @@ impl Rustc { /// Construct a new `rustc` invocation. #[track_caller] pub fn new() -> Self { + let mut cmd = setup_common(); + cmd.arg("-L").arg(cwd()); + Self { cmd } + } + + /// Construct a bare `rustc` invocation with no flags set. + #[track_caller] + pub fn bare() -> Self { let cmd = setup_common(); Self { cmd } } diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 70c1b055c6e..79b3f4b8295 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -62,7 +62,6 @@ run-make/issue-28595/Makefile run-make/issue-33329/Makefile run-make/issue-35164/Makefile run-make/issue-36710/Makefile -run-make/issue-37839/Makefile run-make/issue-47551/Makefile run-make/issue-69368/Makefile run-make/issue-83045/Makefile diff --git a/tests/run-make/issue-37839/Makefile b/tests/run-make/issue-37839/Makefile deleted file mode 100644 index 6bad27b7bdc..00000000000 --- a/tests/run-make/issue-37839/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: - $(RUSTC) a.rs && $(RUSTC) b.rs - $(BARE_RUSTC) c.rs -L dependency=$(TMPDIR) --extern b=$(TMPDIR)/libb.rlib \ - --out-dir=$(TMPDIR) diff --git a/tests/run-make/issue-37839/a.rs b/tests/run-make/proc-macro-three-crates/a.rs similarity index 100% rename from tests/run-make/issue-37839/a.rs rename to tests/run-make/proc-macro-three-crates/a.rs diff --git a/tests/run-make/issue-37839/b.rs b/tests/run-make/proc-macro-three-crates/b.rs similarity index 100% rename from tests/run-make/issue-37839/b.rs rename to tests/run-make/proc-macro-three-crates/b.rs diff --git a/tests/run-make/issue-37839/c.rs b/tests/run-make/proc-macro-three-crates/c.rs similarity index 100% rename from tests/run-make/issue-37839/c.rs rename to tests/run-make/proc-macro-three-crates/c.rs diff --git a/tests/run-make/proc-macro-three-crates/rmake.rs b/tests/run-make/proc-macro-three-crates/rmake.rs new file mode 100644 index 00000000000..62dc547fcfb --- /dev/null +++ b/tests/run-make/proc-macro-three-crates/rmake.rs @@ -0,0 +1,22 @@ +// A compiler bug caused the following issue: +// If a crate A depends on crate B, and crate B +// depends on crate C, and crate C contains a procedural +// macro, compiling crate A would fail. +// This was fixed in #37846, and this test checks +// that this bug does not make a resurgence. + +//FIXME(Oneirical): ignore-cross-compile + +use run_make_support::{bare_rustc, cwd, rust_lib_name, rustc}; + +fn main() { + rustc().input("a.rs").run(); + rustc().input("b.rs").run(); + let curr_dir = cwd().display().to_string(); + bare_rustc() + .input("c.rs") + .arg(format!("-Ldependency={curr_dir}")) + .extern_("b", cwd().join(rust_lib_name("b"))) + .out_dir(cwd()) + .run(); +}