Rollup merge of #131525 - Zalathar:emit-asm, r=jieyouxu

compiletest: Simplify the choice of `--emit` mode for assembly tests

Tiny little cleanup that I noticed while working on #131524. No functional change.

Historically, the original code structure (#58791) predates the `Emit` enum (#103298), so it was manually adding `--emit` flags to the compiler invocation. But now the match can just evaluate to the appropriate `Emit` value directly.
This commit is contained in:
Stuart Cook 2024-10-11 17:46:12 +11:00 committed by GitHub
commit 3bb522202f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1804,23 +1804,14 @@ fn compile_test_and_save_assembly(&self) -> (ProcRes, PathBuf) {
let output_path = self.output_base_name().with_extension("s");
let input_file = &self.testpaths.file;
let mut emit = Emit::None;
match self.props.assembly_output.as_ref().map(AsRef::as_ref) {
Some("emit-asm") => {
emit = Emit::Asm;
}
Some("bpf-linker") => {
emit = Emit::LinkArgsAsm;
}
Some("ptx-linker") => {
// No extra flags needed.
}
Some(header) => self.fatal(&format!("unknown 'assembly-output' header: {header}")),
None => self.fatal("missing 'assembly-output' header"),
}
// Use the `//@ assembly-output:` directive to determine how to emit assembly.
let emit = match self.props.assembly_output.as_deref() {
Some("emit-asm") => Emit::Asm,
Some("bpf-linker") => Emit::LinkArgsAsm,
Some("ptx-linker") => Emit::None, // No extra flags needed.
Some(other) => self.fatal(&format!("unknown 'assembly-output' directive: {other}")),
None => self.fatal("missing 'assembly-output' directive"),
};
let rustc = self.make_compile_args(
input_file,