about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-09 16:18:12 -0400
committerOneirical <manchot@videotron.ca>2024-07-16 15:33:26 -0400
commitb55fa8f7575602b9e629903d6146e9504a977933 (patch)
tree2f1e2fe3711d79a2a9d959c85ecdb6f0691ce9f7
parent9ce62297fafc4640351164be8b335ab6b6fb2880 (diff)
downloadrust-b55fa8f7575602b9e629903d6146e9504a977933.tar.gz
rust-b55fa8f7575602b9e629903d6146e9504a977933.zip
rewrite dump-mono-stats to rmake format
-rw-r--r--src/tools/run-make-support/src/rustc.rs9
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/dump-mono-stats/Makefile5
-rw-r--r--tests/run-make/dump-mono-stats/rmake.rs12
4 files changed, 17 insertions, 10 deletions
diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs
index 31efd89be07..21cde437771 100644
--- a/src/tools/run-make-support/src/rustc.rs
+++ b/src/tools/run-make-support/src/rustc.rs
@@ -135,9 +135,6 @@ impl Rustc {
         self.cmd.arg("--remap-path-prefix");
         self.cmd.arg(format!("{from}={to}"));
 
-        self
-    }
-
     /// Specify path to the input file.
     pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
         self.cmd.arg(path.as_ref());
@@ -243,7 +240,11 @@ impl Rustc {
     }
 
     /// Add a directory to the library search path with a restriction. Equivalent to `-L KIND=PATH` in rustc.
-    pub fn specific_library_search_path<P: AsRef<Path>>(&mut self, kind: &str, path: P) -> &mut Self {
+    pub fn specific_library_search_path<P: AsRef<Path>>(
+        &mut self,
+        kind: &str,
+        path: P,
+    ) -> &mut Self {
         assert!(["dependency", "native", "all", "framework", "crate"].contains(&kind));
         let path = path.as_ref().to_string_lossy();
         self.cmd.arg(format!("-L{kind}={path}"));
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 9faeb7df402..b8b0fc23e53 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -20,7 +20,6 @@ run-make/dep-info-doesnt-run-much/Makefile
 run-make/dep-info-spaces/Makefile
 run-make/dep-info/Makefile
 run-make/dump-ice-to-disk/Makefile
-run-make/dump-mono-stats/Makefile
 run-make/emit-to-stdout/Makefile
 run-make/export-executable-symbols/Makefile
 run-make/extern-diff-internal-name/Makefile
diff --git a/tests/run-make/dump-mono-stats/Makefile b/tests/run-make/dump-mono-stats/Makefile
deleted file mode 100644
index 196f84be6ec..00000000000
--- a/tests/run-make/dump-mono-stats/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../tools.mk
-
-all:
-	$(RUSTC) --crate-type lib foo.rs -Z dump-mono-stats=$(TMPDIR) -Zdump-mono-stats-format=json
-	cat $(TMPDIR)/foo.mono_items.json | $(CGREP) '"name":"bar"'
diff --git a/tests/run-make/dump-mono-stats/rmake.rs b/tests/run-make/dump-mono-stats/rmake.rs
new file mode 100644
index 00000000000..67915959e6d
--- /dev/null
+++ b/tests/run-make/dump-mono-stats/rmake.rs
@@ -0,0 +1,12 @@
+// A flag named dump-mono-stats was added to the compiler in 2022, which
+// collects stats on instantiation of items and their associated costs.
+// This test checks that the output stat file exists, and that it contains
+// a specific expected string.
+// See https://github.com/rust-lang/rust/pull/105481
+
+use run_make_support::{cwd, fs_wrapper, rustc};
+
+fn main() {
+    rustc().crate_type("lib").input("foo.rs").dump_mono_stats(cwd()).arg("-Zdump-mono-stats-format=json").run();
+    assert!(fs_wrapper::read_to_string("foo.mono_items.json").contains("\"name\":\"bar\"");
+}