Skip to content

Commit 3bb5222

Browse files
authored
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.
2 parents f6bdf71 + 4637630 commit 3bb5222

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/tools/compiletest/src/runtest.rs

+8-17
Original file line numberDiff line numberDiff line change
@@ -1804,23 +1804,14 @@ impl<'test> TestCx<'test> {
18041804
let output_path = self.output_base_name().with_extension("s");
18051805
let input_file = &self.testpaths.file;
18061806

1807-
let mut emit = Emit::None;
1808-
match self.props.assembly_output.as_ref().map(AsRef::as_ref) {
1809-
Some("emit-asm") => {
1810-
emit = Emit::Asm;
1811-
}
1812-
1813-
Some("bpf-linker") => {
1814-
emit = Emit::LinkArgsAsm;
1815-
}
1816-
1817-
Some("ptx-linker") => {
1818-
// No extra flags needed.
1819-
}
1820-
1821-
Some(header) => self.fatal(&format!("unknown 'assembly-output' header: {header}")),
1822-
None => self.fatal("missing 'assembly-output' header"),
1823-
}
1807+
// Use the `//@ assembly-output:` directive to determine how to emit assembly.
1808+
let emit = match self.props.assembly_output.as_deref() {
1809+
Some("emit-asm") => Emit::Asm,
1810+
Some("bpf-linker") => Emit::LinkArgsAsm,
1811+
Some("ptx-linker") => Emit::None, // No extra flags needed.
1812+
Some(other) => self.fatal(&format!("unknown 'assembly-output' directive: {other}")),
1813+
None => self.fatal("missing 'assembly-output' directive"),
1814+
};
18241815

18251816
let rustc = self.make_compile_args(
18261817
input_file,

0 commit comments

Comments
 (0)