Auto merge of #127381 - Oneirical:testalt-consciousness, r= · rust-lang/rust@90002cd (original) (raw)

12 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ pub use llvm::{
35 35 LlvmProfdata, LlvmReadobj,
36 36 };
37 37 pub use run::{cmd, run, run_fail, run_with_args};
38 -pub use rustc::{aux_build, rustc, Rustc};
38 +pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
39 39 pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
40 40
41 41 #[track_caller]
Original file line number Diff line number Diff line change
@@ -10,7 +10,13 @@ pub fn rustc() -> Rustc {
10 10 Rustc::new()
11 11 }
12 12
13 -/// Construct a new `rustc` aux-build invocation.
13 +/// Construct a plain `rustc` invocation with no flags set.
14 +#[track_caller]
15 +pub fn bare_rustc() -> Rustc {
16 +Rustc::bare()
17 +}
18 +
19 +// Construct a new `rustc` aux-build invocation.
14 20 #[track_caller]
15 21 pub fn aux_build() -> Rustc {
16 22 Rustc::new_aux_build()
@@ -30,7 +36,6 @@ fn setup_common() -> Command {
30 36 let rustc = env_var("RUSTC");
31 37 let mut cmd = Command::new(rustc);
32 38 set_host_rpath(&mut cmd);
33 - cmd.arg("-L").arg(cwd());
34 39 cmd
35 40 }
36 41
@@ -40,6 +45,14 @@ impl Rustc {
40 45 /// Construct a new `rustc` invocation.
41 46 #[track_caller]
42 47 pub fn new() -> Self {
48 +let mut cmd = setup_common();
49 + cmd.arg("-L").arg(cwd());
50 +Self { cmd }
51 +}
52 +
53 +/// Construct a bare `rustc` invocation with no flags set.
54 + #[track_caller]
55 +pub fn bare() -> Self {
43 56 let cmd = setup_common();
44 57 Self { cmd }
45 58 }
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@ run-make/dump-mono-stats/Makefile
26 26 run-make/emit-path-unhashed/Makefile
27 27 run-make/emit-shared-files/Makefile
28 28 run-make/emit-to-stdout/Makefile
29 -run-make/env-dep-info/Makefile
30 29 run-make/export-executable-symbols/Makefile
31 30 run-make/extern-diff-internal-name/Makefile
32 31 run-make/extern-flag-disambiguates/Makefile
@@ -65,7 +64,6 @@ run-make/issue-36710/Makefile
65 64 run-make/issue-37839/Makefile
66 65 run-make/issue-47551/Makefile
67 66 run-make/issue-69368/Makefile
68 -run-make/issue-83045/Makefile
69 67 run-make/issue-83112-incr-test-moved-file/Makefile
70 68 run-make/issue-84395-lto-embed-bitcode/Makefile
71 69 run-make/issue-85019-moved-src-dir/Makefile
@@ -129,7 +127,6 @@ run-make/return-non-c-like-enum-from-c/Makefile
129 127 run-make/rlib-format-packed-bundled-libs-2/Makefile
130 128 run-make/rlib-format-packed-bundled-libs-3/Makefile
131 129 run-make/rlib-format-packed-bundled-libs/Makefile
132 -run-make/rustc-macro-dep-files/Makefile
133 130 run-make/sanitizer-cdylib-link/Makefile
134 131 run-make/sanitizer-dylib-link/Makefile
135 132 run-make/sanitizer-staticlib-link/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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::{fs_wrapper, rustc};
8 +
9 +// FIXME(Oneirical): try on musl
10 +
11 +fn main() {
12 +rustc()
13 +.env("EXISTING_ENV", "1")
14 +.env("EXISTING_OPT_ENV", "1")
15 +.emit("dep-info")
16 +.input("main.rs")
17 +.run();
18 +let dep_info = fs_wrapper::read_to_string("main.d");
19 +assert!(&dep_info.contains("# env-dep:EXISTING_ENV=1"));
20 +assert!(&dep_info.contains("# env-dep:EXISTING_OPT_ENV=1"));
21 +assert!(&dep_info.contains("# env-dep:NONEXISTENT_OPT_ENV"));
22 +assert!(dep_info.contains(r#"# env-dep:ESCAPE\nESCAPE\\"#));
23 +// Procedural macro
24 +rustc().input("macro_def.rs").run();
25 +rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run();
26 +let dep_info = fs_wrapper::read_to_string("macro_use.d");
27 +assert!(&dep_info.contains("# env-dep:EXISTING_PROC_MACRO_ENV=1"));
28 +assert!(dep_info.contains("# env-dep:NONEXISTENT_PROC_MACEO_ENV"));
29 +}

File renamed without changes.

File renamed without changes.

File renamed without changes.

Original file line number Diff line number Diff 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 +}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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::{fs_wrapper, rustc, target};
8 +
9 +fn main() {
10 +rustc().input("foo.rs").run();
11 +rustc().input("bar.rs").target(target()).emit("dep-info").run();
12 +assert!(!fs_wrapper::read_to_string("bar.d").contains("proc-macro source"));
13 +}