Skip to content

Commit b55fa8f

Browse files
committed
rewrite dump-mono-stats to rmake format
1 parent 9ce6229 commit b55fa8f

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

src/tools/run-make-support/src/rustc.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ impl Rustc {
135135
self.cmd.arg("--remap-path-prefix");
136136
self.cmd.arg(format!("{from}={to}"));
137137

138-
self
139-
}
140-
141138
/// Specify path to the input file.
142139
pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
143140
self.cmd.arg(path.as_ref());
@@ -243,7 +240,11 @@ impl Rustc {
243240
}
244241

245242
/// Add a directory to the library search path with a restriction. Equivalent to `-L KIND=PATH` in rustc.
246-
pub fn specific_library_search_path<P: AsRef<Path>>(&mut self, kind: &str, path: P) -> &mut Self {
243+
pub fn specific_library_search_path<P: AsRef<Path>>(
244+
&mut self,
245+
kind: &str,
246+
path: P,
247+
) -> &mut Self {
247248
assert!(["dependency", "native", "all", "framework", "crate"].contains(&kind));
248249
let path = path.as_ref().to_string_lossy();
249250
self.cmd.arg(format!("-L{kind}={path}"));

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ run-make/dep-info-doesnt-run-much/Makefile
2020
run-make/dep-info-spaces/Makefile
2121
run-make/dep-info/Makefile
2222
run-make/dump-ice-to-disk/Makefile
23-
run-make/dump-mono-stats/Makefile
2423
run-make/emit-to-stdout/Makefile
2524
run-make/export-executable-symbols/Makefile
2625
run-make/extern-diff-internal-name/Makefile

tests/run-make/dump-mono-stats/Makefile

-5
This file was deleted.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// A flag named dump-mono-stats was added to the compiler in 2022, which
2+
// collects stats on instantiation of items and their associated costs.
3+
// This test checks that the output stat file exists, and that it contains
4+
// a specific expected string.
5+
// See https://github.com/rust-lang/rust/pull/105481
6+
7+
use run_make_support::{cwd, fs_wrapper, rustc};
8+
9+
fn main() {
10+
rustc().crate_type("lib").input("foo.rs").dump_mono_stats(cwd()).arg("-Zdump-mono-stats-format=json").run();
11+
assert!(fs_wrapper::read_to_string("foo.mono_items.json").contains("\"name\":\"bar\"");
12+
}

0 commit comments

Comments
 (0)