Skip to content

Commit c1fdd65

Browse files
authored
Unrolled build for rust-lang#127381
Rollup merge of rust-lang#127381 - Oneirical:testalt-consciousness, r=jieyouxu Migrate `issue-83045`, `rustc-macro-dep-files` and `env-dep-info` `run-make` tests to rmake Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Please try on musl. try-job: dist-x86_64-musl
2 parents c6727fc + fe76650 commit c1fdd65

File tree

14 files changed

+96
-69
lines changed

14 files changed

+96
-69
lines changed

src/tools/run-make-support/src/rustc.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ use std::path::Path;
44

55
use crate::{command, cwd, env_var, set_host_rpath};
66

7-
/// Construct a new `rustc` invocation.
7+
/// Construct a new `rustc` invocation. This will automatically set the library
8+
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
89
#[track_caller]
910
pub fn rustc() -> Rustc {
1011
Rustc::new()
1112
}
1213

13-
/// Construct a plain `rustc` invocation with no flags set.
14+
/// Construct a plain `rustc` invocation with no flags set. Note that [`set_host_rpath`]
15+
/// still presets the environment variable `HOST_RPATH_DIR` by default.
1416
#[track_caller]
1517
pub fn bare_rustc() -> Rustc {
1618
Rustc::bare()
@@ -42,7 +44,8 @@ fn setup_common() -> Command {
4244
impl Rustc {
4345
// `rustc` invocation constructor methods
4446

45-
/// Construct a new `rustc` invocation.
47+
/// Construct a new `rustc` invocation. This will automatically set the library
48+
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
4649
#[track_caller]
4750
pub fn new() -> Self {
4851
let mut cmd = setup_common();

src/tools/tidy/src/allowed_run_make_makefiles.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ run-make/dep-info/Makefile
2323
run-make/dump-ice-to-disk/Makefile
2424
run-make/dump-mono-stats/Makefile
2525
run-make/emit-to-stdout/Makefile
26-
run-make/env-dep-info/Makefile
2726
run-make/export-executable-symbols/Makefile
2827
run-make/extern-diff-internal-name/Makefile
2928
run-make/extern-flag-disambiguates/Makefile
@@ -58,7 +57,6 @@ run-make/issue-35164/Makefile
5857
run-make/issue-36710/Makefile
5958
run-make/issue-47551/Makefile
6059
run-make/issue-69368/Makefile
61-
run-make/issue-83045/Makefile
6260
run-make/issue-84395-lto-embed-bitcode/Makefile
6361
run-make/issue-85019-moved-src-dir/Makefile
6462
run-make/issue-85401-static-mir/Makefile
@@ -116,7 +114,6 @@ run-make/return-non-c-like-enum-from-c/Makefile
116114
run-make/rlib-format-packed-bundled-libs-2/Makefile
117115
run-make/rlib-format-packed-bundled-libs-3/Makefile
118116
run-make/rlib-format-packed-bundled-libs/Makefile
119-
run-make/rustc-macro-dep-files/Makefile
120117
run-make/sanitizer-cdylib-link/Makefile
121118
run-make/sanitizer-dylib-link/Makefile
122119
run-make/sanitizer-staticlib-link/Makefile

tests/run-make/env-dep-info/Makefile

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
macro_use.d: macro_use.rs
2+
3+
macro_use.rs:
4+
5+
# env-dep:EXISTING_PROC_MACRO_ENV=1
6+
# env-dep:NONEXISTENT_PROC_MACEO_ENV
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
main.d: main.rs
2+
3+
main.rs:
4+
5+
# env-dep:ESCAPE\nESCAPE\\
6+
# env-dep:EXISTING_ENV=1
7+
# env-dep:EXISTING_OPT_ENV=1
8+
# env-dep:NONEXISTENT_OPT_ENV

tests/run-make/env-dep-info/rmake.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Inside dep-info emit files, #71858 made it so all accessed environment
2+
// variables are usefully printed. This test checks that this feature works
3+
// as intended by checking if the environment variables used in compilation
4+
// appear in the output dep-info files.
5+
// See https://github.com/rust-lang/rust/issues/40364
6+
7+
use run_make_support::{diff, rustc};
8+
9+
fn main() {
10+
rustc()
11+
.env("EXISTING_ENV", "1")
12+
.env("EXISTING_OPT_ENV", "1")
13+
.emit("dep-info")
14+
.input("main.rs")
15+
.run();
16+
diff().expected_file("correct_main.d").actual_file("main.d").run();
17+
// Procedural macro
18+
rustc().input("macro_def.rs").run();
19+
rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run();
20+
diff().expected_file("correct_macro.d").actual_file("macro_use.d").run();
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// This test case creates a situation where the crate loader would run
2+
// into an ICE (internal compiler error) when confronted with an invalid setup where it cannot
3+
// find the dependency of a direct dependency.
4+
//
5+
// The test case makes sure that the compiler produces the expected
6+
// error message but does not ICE immediately after.
7+
//
8+
// See https://github.com/rust-lang/rust/issues/83045
9+
10+
//@ only-x86_64
11+
//@ only-linux
12+
// Reason: This is a platform-independent issue, no need to waste time testing
13+
// everywhere.
14+
15+
// NOTE: We use `bare_rustc` below so that the compiler can't find liba.rlib
16+
// If we used `rustc` the additional '-L rmake_out' option would allow rustc to
17+
// actually find the crate.
18+
19+
use run_make_support::{bare_rustc, fs_wrapper, rust_lib_name, rustc};
20+
21+
fn main() {
22+
rustc().crate_name("a").crate_type("rlib").input("a.rs").arg("--verbose").run();
23+
rustc()
24+
.crate_name("b")
25+
.crate_type("rlib")
26+
.extern_("a", rust_lib_name("a"))
27+
.input("b.rs")
28+
.arg("--verbose")
29+
.run();
30+
bare_rustc()
31+
.extern_("b", rust_lib_name("b"))
32+
.crate_type("rlib")
33+
.edition("2018")
34+
.input("c.rs")
35+
.run_fail()
36+
.assert_stderr_contains("E0463")
37+
.assert_stderr_not_contains("internal compiler error");
38+
}

tests/run-make/issue-83045/Makefile

-33
This file was deleted.

tests/run-make/rustc-macro-dep-files/Makefile

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bar.d: bar.rs
2+
3+
bar.rs:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// --emit dep-info used to print all macro-generated code it could
2+
// find as if it was part of a nonexistent file named "proc-macro source",
3+
// which is not a valid path. After this was fixed in #36776, this test checks
4+
// that macro code is not falsely seen as coming from a different file in dep-info.
5+
// See https://github.com/rust-lang/rust/issues/36625
6+
7+
use run_make_support::{diff, rustc, target};
8+
9+
fn main() {
10+
rustc().input("foo.rs").run();
11+
rustc().input("bar.rs").target(target()).emit("dep-info").run();
12+
// The emitted file should not contain "proc-macro source".
13+
diff().expected_file("correct.d").actual_file("bar.d").run();
14+
}

0 commit comments

Comments
 (0)