diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index a04e239abb0e1..088d5ba0c2b37 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -23,8 +23,6 @@ run-make/no-alloc-shim/Makefile run-make/pdb-buildinfo-cl-cmd/Makefile run-make/pgo-gen-lto/Makefile run-make/pgo-indirect-call-promotion/Makefile -run-make/print-calling-conventions/Makefile -run-make/print-target-list/Makefile run-make/raw-dylib-alt-calling-convention/Makefile run-make/raw-dylib-c/Makefile run-make/redundant-libs/Makefile diff --git a/tests/run-make/print-calling-conventions/Makefile b/tests/run-make/print-calling-conventions/Makefile deleted file mode 100644 index 27b87e610862d..0000000000000 --- a/tests/run-make/print-calling-conventions/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --print calling-conventions diff --git a/tests/run-make/print-cfg/rmake.rs b/tests/run-make/print-cfg/rmake.rs index d83e8a36f2c08..471a99b90d982 100644 --- a/tests/run-make/print-cfg/rmake.rs +++ b/tests/run-make/print-cfg/rmake.rs @@ -6,7 +6,6 @@ //! It also checks that some targets have the correct set cfgs. use std::collections::HashSet; -use std::ffi::OsString; use std::iter::FromIterator; use std::path::PathBuf; @@ -91,10 +90,8 @@ fn check(PrintCfg { target, includes, disallow }: PrintCfg) { // --print=cfg=PATH { let tmp_path = PathBuf::from(format!("{target}.cfg")); - let mut print_arg = OsString::from("--print=cfg="); - print_arg.push(tmp_path.as_os_str()); - rustc().target(target).arg(print_arg).run(); + rustc().target(target).print(&format!("cfg={}", tmp_path.display())).run(); let output = rfs::read_to_string(&tmp_path); diff --git a/tests/run-make/print-check-cfg/rmake.rs b/tests/run-make/print-check-cfg/rmake.rs index 4a79910c8e05e..b10336f88c649 100644 --- a/tests/run-make/print-check-cfg/rmake.rs +++ b/tests/run-make/print-check-cfg/rmake.rs @@ -87,7 +87,7 @@ fn main() { fn check(CheckCfg { args, contains }: CheckCfg) { let output = - rustc().input("lib.rs").arg("-Zunstable-options").arg("--print=check-cfg").args(args).run(); + rustc().input("lib.rs").arg("-Zunstable-options").print("check-cfg").args(args).run(); let stdout = output.stdout_utf8(); diff --git a/tests/run-make/print-target-list/Makefile b/tests/run-make/print-target-list/Makefile deleted file mode 100644 index f23c40d4281e3..0000000000000 --- a/tests/run-make/print-target-list/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# Checks that all the targets returned by `rustc --print target-list` are valid -# target specifications -all: - for target in $(shell $(BARE_RUSTC) --print target-list); do \ - $(BARE_RUSTC) --target $$target --print sysroot; \ - done diff --git a/tests/run-make/print-target-list/rmake.rs b/tests/run-make/print-target-list/rmake.rs new file mode 100644 index 0000000000000..743ed52069dea --- /dev/null +++ b/tests/run-make/print-target-list/rmake.rs @@ -0,0 +1,21 @@ +// Checks that all the targets returned by `rustc --print target-list` are valid +// target specifications + +use run_make_support::bare_rustc; + +// FIXME(127877): certain experimental targets fail with creating a 'LLVM TargetMachine' +// in CI, so we skip them +const EXPERIMENTAL_TARGETS: &[&str] = &["avr", "m68k", "csky", "xtensa"]; + +fn main() { + let targets = bare_rustc().print("target-list").run().stdout_utf8(); + + for target in targets.lines() { + // skip experimental targets that would otherwise fail + if EXPERIMENTAL_TARGETS.iter().any(|experimental| target.contains(experimental)) { + continue; + } + + bare_rustc().target(target).print("sysroot").run(); + } +} diff --git a/tests/run-make/print-to-output/rmake.rs b/tests/run-make/print-to-output/rmake.rs index d0cba725b3679..db2a291f8e737 100644 --- a/tests/run-make/print-to-output/rmake.rs +++ b/tests/run-make/print-to-output/rmake.rs @@ -1,7 +1,6 @@ //! This checks the output of some `--print` options when //! output to a file (instead of stdout) -use std::ffi::OsString; use std::path::PathBuf; use run_make_support::{rfs, rustc, target}; @@ -44,10 +43,8 @@ fn check(args: Option) { // --print={option}=PATH let output = { let tmp_path = PathBuf::from(format!("{}.txt", args.option)); - let mut print_arg = OsString::from(format!("--print={}=", args.option)); - print_arg.push(tmp_path.as_os_str()); - rustc().target(args.target).arg(print_arg).run(); + rustc().target(args.target).print(&format!("{}={}", args.option, tmp_path.display())).run(); rfs::read_to_string(&tmp_path) }; diff --git a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs index bfe4a1df4569d..b77df7adc8d9e 100644 --- a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs +++ b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs @@ -11,8 +11,7 @@ fn main() { let dylib_name = rustc() .crate_name(proc_crate_name) .crate_type("dylib") - .arg("--print") - .arg("file-names") + .print("file-names") .arg("-") .run() .stdout_utf8(); diff --git a/tests/ui/print-calling-conventions.rs b/tests/ui/print-calling-conventions.rs new file mode 100644 index 0000000000000..302ed088142d8 --- /dev/null +++ b/tests/ui/print-calling-conventions.rs @@ -0,0 +1,2 @@ +//@ compile-flags: --print calling-conventions +//@ build-pass diff --git a/tests/ui/print-calling-conventions.stdout b/tests/ui/print-calling-conventions.stdout new file mode 100644 index 0000000000000..da67a57f420d7 --- /dev/null +++ b/tests/ui/print-calling-conventions.stdout @@ -0,0 +1,34 @@ +C +C-cmse-nonsecure-call +C-unwind +Rust +aapcs +aapcs-unwind +avr-interrupt +avr-non-blocking-interrupt +cdecl +cdecl-unwind +efiapi +fastcall +fastcall-unwind +msp430-interrupt +ptx-kernel +riscv-interrupt-m +riscv-interrupt-s +rust-call +rust-cold +rust-intrinsic +stdcall +stdcall-unwind +system +system-unwind +sysv64 +sysv64-unwind +thiscall +thiscall-unwind +unadjusted +vectorcall +vectorcall-unwind +win64 +win64-unwind +x86-interrupt