Auto merge of #127877 - Rejyr:migrate-print-rmake, r=jieyouxu · rust-lang/rust@58fb508 (original) (raw)

File tree

10 files changed

lines changed

10 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -23,8 +23,6 @@ run-make/no-alloc-shim/Makefile
23 23 run-make/pdb-buildinfo-cl-cmd/Makefile
24 24 run-make/pgo-gen-lto/Makefile
25 25 run-make/pgo-indirect-call-promotion/Makefile
26 -run-make/print-calling-conventions/Makefile
27 -run-make/print-target-list/Makefile
28 26 run-make/raw-dylib-alt-calling-convention/Makefile
29 27 run-make/raw-dylib-c/Makefile
30 28 run-make/redundant-libs/Makefile
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
6 6 //! It also checks that some targets have the correct set cfgs.
7 7
8 8 use std::collections::HashSet;
9 -use std::ffi::OsString;
10 9 use std::iter::FromIterator;
11 10 use std::path::PathBuf;
12 11
@@ -91,10 +90,8 @@ fn check(PrintCfg { target, includes, disallow }: PrintCfg) {
91 90 // --print=cfg=PATH
92 91 {
93 92 let tmp_path = PathBuf::from(format!("{target}.cfg"));
94 -let mut print_arg = OsString::from("--print=cfg=");
95 - print_arg.push(tmp_path.as_os_str());
96 93
97 -rustc().target(target).arg(print_arg).run();
94 +rustc().target(target).print(&format!("cfg={}", tmp_path.display())).run();
98 95
99 96 let output = rfs::read_to_string(&tmp_path);
100 97
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ fn main() {
87 87
88 88 fn check(CheckCfg { args, contains }: CheckCfg) {
89 89 let output =
90 -rustc().input("lib.rs").arg("-Zunstable-options").arg("--print=check-cfg").args(args).run();
90 +rustc().input("lib.rs").arg("-Zunstable-options").print("check-cfg").args(args).run();
91 91
92 92 let stdout = output.stdout_utf8();
93 93
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1 +// Checks that all the targets returned by `rustc --print target-list` are valid
2 +// target specifications
3 +
4 +use run_make_support::bare_rustc;
5 +
6 +// FIXME(127877): certain experimental targets fail with creating a 'LLVM TargetMachine'
7 +// in CI, so we skip them
8 +const EXPERIMENTAL_TARGETS: &[&str] = &["avr", "m68k", "csky", "xtensa"];
9 +
10 +fn main() {
11 +let targets = bare_rustc().print("target-list").run().stdout_utf8();
12 +
13 +for target in targets.lines() {
14 +// skip experimental targets that would otherwise fail
15 +if EXPERIMENTAL_TARGETS.iter().any(|experimental
16 +continue;
17 +}
18 +
19 +bare_rustc().target(target).print("sysroot").run();
20 +}
21 +}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
1 1 //! This checks the output of some `--print` options when
2 2 //! output to a file (instead of stdout)
3 3
4 -use std::ffi::OsString;
5 4 use std::path::PathBuf;
6 5
7 6 use run_make_support::{rfs, rustc, target};
@@ -44,10 +43,8 @@ fn check(args: Option) {
44 43 // --print={option}=PATH
45 44 let output = {
46 45 let tmp_path = PathBuf::from(format!("{}.txt", args.option));
47 -let mut print_arg = OsString::from(format!("--print={}=", args.option));
48 - print_arg.push(tmp_path.as_os_str());
49 46
50 -rustc().target(args.target).arg(print_arg).run();
47 +rustc().target(args.target).print(&format!("{}={}", args.option, tmp_path.display())).run();
51 48
52 49 rfs::read_to_string(&tmp_path)
53 50 };
Original file line number Diff line number Diff line change
@@ -11,8 +11,7 @@ fn main() {
11 11 let dylib_name = rustc()
12 12 .crate_name(proc_crate_name)
13 13 .crate_type("dylib")
14 -.arg("--print")
15 -.arg("file-names")
14 +.print("file-names")
16 15 .arg("-")
17 16 .run()
18 17 .stdout_utf8();
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 +//@ compile-flags: --print calling-conventions
2 +//@ build-pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
1 +C
2 +C-cmse-nonsecure-call
3 +C-unwind
4 +Rust
5 +aapcs
6 +aapcs-unwind
7 +avr-interrupt
8 +avr-non-blocking-interrupt
9 +cdecl
10 +cdecl-unwind
11 +efiapi
12 +fastcall
13 +fastcall-unwind
14 +msp430-interrupt
15 +ptx-kernel
16 +riscv-interrupt-m
17 +riscv-interrupt-s
18 +rust-call
19 +rust-cold
20 +rust-intrinsic
21 +stdcall
22 +stdcall-unwind
23 +system
24 +system-unwind
25 +sysv64
26 +sysv64-unwind
27 +thiscall
28 +thiscall-unwind
29 +unadjusted
30 +vectorcall
31 +vectorcall-unwind
32 +win64
33 +win64-unwind
34 +x86-interrupt