Skip to content

Commit e9c7ecf

Browse files
committed
fix the build
1 parent ef1a0e9 commit e9c7ecf

File tree

2 files changed

+18
-10
lines changed
  • src/tools/run-make-support/src
  • tests/run-make/pgo-branch-weights

2 files changed

+18
-10
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use std::env;
22
use std::path::{Path, PathBuf};
33
use std::process::{Command, Output};
4+
use std::io::{self, BufReader, Write};
5+
use std::fs::File;
46

57
use crate::is_windows;
68

@@ -39,7 +41,10 @@ fn run_common(name: &str) -> (Command, Output) {
3941

4042
/// Run a command taking in standard input from a file, and passing an argument
4143
/// referring to a different file.
42-
pub fn stdin_command<P: AsRef<Path>>(command: &str, stdin: P, argument: P) {
44+
pub fn stdin_command<P>(command: &str, stdin: P, argument: P)
45+
where
46+
P: AsRef<Path> + AsRef<OsStr>,
47+
{
4348
let file = File::open(stdin).unwrap();
4449
let reader = BufReader::new(file);
4550

tests/run-make/pgo-branch-weights/rmake.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
//@ ignore-cross-compile
1616

1717
use run_make_support::{llvm_profdata, rustc, rustdoc, stdin_command, target, tmp_dir};
18-
use std::io::{self, Write};
19-
use std::process::Command;
2018

2119
fn main() {
2220
// For some very small programs GNU ld seems to not properly handle
2321
// instrumentation sections correctly. Neither Gold nor LLD have that
2422
// problem.
25-
let link_args = (cfg!(target_os = "linux") && target().contains("x86")).then_some("-Clink-args=-fuse-ld=gold");
23+
let link_args = (cfg!(target_os = "linux") && target().contains("x86"))
24+
.then_some("-Clink-args=-fuse-ld=gold");
2625

2726
let path_prof_data_dir = tmp_dir().join("prof_data_dir");
2827
let path_merged_profdata = path_prof_data_dir.join("merged.profdata");
@@ -32,24 +31,28 @@ fn main() {
3231
}
3332
invoc.run();
3433
fs::create_dir_all(&path_prof_data_dir);
35-
let invoc = rustc().input("interesting.rs")
34+
let invoc = rustc()
35+
.input("interesting.rs")
3636
.profile_generate(&path_prof_data_dir)
3737
.opt()
3838
.codegen_units(1);
3939
if let Some(link_args) = link_args {
4040
invoc.arg(link_args);
4141
}
4242
invoc.run();
43-
let invoc = rustc().input("main.rs")
44-
.profile_generate(&path_prof_data_dir)
45-
.opt();
43+
let invoc = rustc().input("main.rs").profile_generate(&path_prof_data_dir).opt();
4644
if let Some(link_args) = link_args {
4745
invoc.arg(link_args);
4846
}
4947
invoc.run();
5048
run("main");
51-
llvm_profdata().merge().output(&path_merged_profdata).input(path_prof_data_dir).command_output();
52-
let invoc = rustc().input("interesting.rs")
49+
llvm_profdata()
50+
.merge()
51+
.output(&path_merged_profdata)
52+
.input(path_prof_data_dir)
53+
.command_output();
54+
let invoc = rustc()
55+
.input("interesting.rs")
5356
.profile_use(path_merged_profdata)
5457
.opt()
5558
.codegen_units(1)

0 commit comments

Comments
 (0)