diff --git a/src/tools/run-make-support/src/command.rs b/src/tools/run-make-support/src/command.rs index f39bcfd60df..0a1bd9b0b34 100644 --- a/src/tools/run-make-support/src/command.rs +++ b/src/tools/run-make-support/src/command.rs @@ -36,8 +36,10 @@ impl Command { Self { cmd: StdCommand::new(program), stdin: None, drop_bomb: DropBomb::arm(program) } } - pub fn set_stdin(&mut self, stdin: Box<[u8]>) { - self.stdin = Some(stdin); + /// Specify a stdin input + pub fn stdin>(&mut self, input: I) -> &mut Self { + self.stdin = Some(input.as_ref().to_vec().into_boxed_slice()); + self } /// Specify an environment variable. diff --git a/src/tools/run-make-support/src/llvm.rs b/src/tools/run-make-support/src/llvm.rs index c397bd3b1a0..7f42223bf7f 100644 --- a/src/tools/run-make-support/src/llvm.rs +++ b/src/tools/run-make-support/src/llvm.rs @@ -171,7 +171,7 @@ impl LlvmFilecheck { /// Pipe a read file into standard input containing patterns that will be matched against the .patterns(path) call. pub fn stdin>(&mut self, input: I) -> &mut Self { - self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice()); + self.cmd.stdin(input); self } diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs index a377dad99d6..28ece1dff12 100644 --- a/src/tools/run-make-support/src/rustc.rs +++ b/src/tools/run-make-support/src/rustc.rs @@ -244,7 +244,7 @@ impl Rustc { /// Specify a stdin input pub fn stdin>(&mut self, input: I) -> &mut Self { - self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice()); + self.cmd.stdin(input); self } diff --git a/src/tools/run-make-support/src/rustdoc.rs b/src/tools/run-make-support/src/rustdoc.rs index 93078561254..fb00427b1c1 100644 --- a/src/tools/run-make-support/src/rustdoc.rs +++ b/src/tools/run-make-support/src/rustdoc.rs @@ -92,7 +92,7 @@ impl Rustdoc { /// Specify a stdin input pub fn stdin>(&mut self, input: I) -> &mut Self { - self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice()); + self.cmd.stdin(input); self }