diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index 674860f8413b6..dd1f306dd6167 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -1,7 +1,7 @@ use std::env; +use std::ffi::OsStr; use std::path::{Path, PathBuf}; use std::process::{Command, Output}; - pub use wasmparser; pub fn out_dir() -> PathBuf { @@ -43,7 +43,7 @@ impl RustcInvocationBuilder { Self { cmd } } - pub fn arg(&mut self, arg: &str) -> &mut RustcInvocationBuilder { + pub fn arg>(&mut self, arg: S) -> &mut RustcInvocationBuilder { self.cmd.arg(arg); self } diff --git a/tests/run-make/hir-tree/Makefile b/tests/run-make/hir-tree/Makefile deleted file mode 100644 index b0450ea4bc5fd..0000000000000 --- a/tests/run-make/hir-tree/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# Test that hir-tree output doesn't crash and includes -# the string constant we would expect to see. - -all: - $(RUSTC) -o $(TMPDIR)/input.hir -Z unpretty=hir-tree input.rs - $(CGREP) '"Hello, Rustaceans!\n"' < $(TMPDIR)/input.hir diff --git a/tests/run-make/hir-tree/rmake.rs b/tests/run-make/hir-tree/rmake.rs new file mode 100644 index 0000000000000..799dfcee564de --- /dev/null +++ b/tests/run-make/hir-tree/rmake.rs @@ -0,0 +1,17 @@ +extern crate run_make_support; + +use run_make_support::{out_dir, rustc}; + +// Test that hir-tree output doesn't crash and includes +// the string constant we would expect to see. + +fn main() { + rustc() + .arg("-o") + .arg(&out_dir().join("input.hir")) + .arg("-Zunpretty=hir-tree") + .arg("input.rs") + .run(); + let file = std::fs::read_to_string(&out_dir().join("input.hir")).unwrap(); + assert!(file.contains(r#""Hello, Rustaceans!\n""#)); +}