diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-06-22 12:57:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-22 12:57:21 +0200 |
| commit | d265538016883df447b7335abcb83ccfa97d63cb (patch) | |
| tree | 034bc87cbdefa1a3b308ace98a2f4467c2b60201 | |
| parent | 25bcc7d130a3ec8cdd9c61c65ca2b8db4bc00f21 (diff) | |
| parent | e7dfd4a9135c7935a843c3a3cdb970a4f08d4588 (diff) | |
| download | rust-d265538016883df447b7335abcb83ccfa97d63cb.tar.gz rust-d265538016883df447b7335abcb83ccfa97d63cb.zip | |
Rollup merge of #126823 - GuillaumeGomez:migrate-run-make-inline-always-many-cgu, r=Kobzol
Migrate `run-make/inline-always-many-cgu` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`
| -rw-r--r-- | src/tools/run-make-support/src/lib.rs | 2 | ||||
| -rw-r--r-- | src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 | ||||
| -rw-r--r-- | tests/run-make/inline-always-many-cgu/Makefile | 8 | ||||
| -rw-r--r-- | tests/run-make/inline-always-many-cgu/rmake.rs | 18 |
4 files changed, 19 insertions, 10 deletions
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index f4c101cf81c..487132683e9 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -387,7 +387,7 @@ pub fn recursive_diff(dir1: impl AsRef<Path>, dir2: impl AsRef<Path>) { }); } -pub fn read_dir<F: Fn(&Path)>(dir: impl AsRef<Path>, callback: F) { +pub fn read_dir<F: FnMut(&Path)>(dir: impl AsRef<Path>, mut callback: F) { for entry in fs_wrapper::read_dir(dir) { callback(&entry.unwrap().path()); } diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 970a424d998..c3a94d17cd9 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -52,7 +52,6 @@ run-make/foreign-rust-exceptions/Makefile run-make/include_bytes_deps/Makefile run-make/incr-add-rust-src-component/Makefile run-make/incr-foreign-head-span/Makefile -run-make/inline-always-many-cgu/Makefile run-make/interdependent-c-libraries/Makefile run-make/intrinsic-unreachable/Makefile run-make/invalid-library/Makefile diff --git a/tests/run-make/inline-always-many-cgu/Makefile b/tests/run-make/inline-always-many-cgu/Makefile deleted file mode 100644 index 9945821db28..00000000000 --- a/tests/run-make/inline-always-many-cgu/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --emit llvm-ir -C codegen-units=2 - if cat $(TMPDIR)/*.ll | $(CGREP) -e '\bcall\b'; then \ - echo "found call instruction when one wasn't expected"; \ - exit 1; \ - fi diff --git a/tests/run-make/inline-always-many-cgu/rmake.rs b/tests/run-make/inline-always-many-cgu/rmake.rs new file mode 100644 index 00000000000..c55ea69f3b9 --- /dev/null +++ b/tests/run-make/inline-always-many-cgu/rmake.rs @@ -0,0 +1,18 @@ +use run_make_support::fs_wrapper::read_to_string; +use run_make_support::regex::Regex; +use run_make_support::{read_dir, rustc}; + +use std::ffi::OsStr; + +fn main() { + rustc().input("foo.rs").emit("llvm-ir").codegen_units(2).run(); + let re = Regex::new(r"\bcall\b").unwrap(); + let mut nb_ll = 0; + read_dir(".", |path| { + if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("ll")) { + assert!(!re.is_match(&read_to_string(path))); + nb_ll += 1; + } + }); + assert!(nb_ll > 0); +} |
