diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs index d034826a830b4..f581204d5f1cb 100644 --- a/src/tools/run-make-support/src/rustc.rs +++ b/src/tools/run-make-support/src/rustc.rs @@ -64,6 +64,12 @@ impl Rustc { self } + /// Specify a specific optimization level. + pub fn opt_level(&mut self, option: &str) -> &mut Self { + self.cmd.arg(format!("-Copt-level={option}")); + self + } + /// Specify type(s) of output files to generate. pub fn emit(&mut self, kinds: &str) -> &mut Self { self.cmd.arg(format!("--emit={kinds}")); diff --git a/tests/run-make/no-mark-noalias/rmake.rs b/tests/run-make/no-mark-noalias/rmake.rs index 5e5868248ce6c..d47cc998961b6 100644 --- a/tests/run-make/no-mark-noalias/rmake.rs +++ b/tests/run-make/no-mark-noalias/rmake.rs @@ -9,6 +9,6 @@ use run_make_support::{run, rustc}; fn main() { - rustc().input("main.rs").opt-level("1").run(); + rustc().input("main.rs").opt_level("1").run(); run("main"); }