Skip to content

Commit e0e3fac

Browse files
authored
Unrolled build for rust-lang#131525
Rollup merge of rust-lang#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 rust-lang#131524. No functional change. Historically, the original code structure (rust-lang#58791) predates the `Emit` enum (rust-lang#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 0321e73 + 4637630 commit e0e3fac

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
@@ -1847,23 +1847,14 @@ impl<'test> TestCx<'test> {
18471847
let output_file = self.get_output_file("s");
18481848
let input_file = &self.testpaths.file;
18491849

1850-
let mut emit = Emit::None;
1851-
match self.props.assembly_output.as_ref().map(AsRef::as_ref) {
1852-
Some("emit-asm") => {
1853-
emit = Emit::Asm;
1854-
}
1855-
1856-
Some("bpf-linker") => {
1857-
emit = Emit::LinkArgsAsm;
1858-
}
1859-
1860-
Some("ptx-linker") => {
1861-
// No extra flags needed.
1862-
}
1863-
1864-
Some(header) => self.fatal(&format!("unknown 'assembly-output' header: {header}")),
1865-
None => self.fatal("missing 'assembly-output' header"),
1866-
}
1850+
// Use the `//@ assembly-output:` directive to determine how to emit assembly.
1851+
let emit = match self.props.assembly_output.as_deref() {
1852+
Some("emit-asm") => Emit::Asm,
1853+
Some("bpf-linker") => Emit::LinkArgsAsm,
1854+
Some("ptx-linker") => Emit::None, // No extra flags needed.
1855+
Some(other) => self.fatal(&format!("unknown 'assembly-output' directive: {other}")),
1856+
None => self.fatal("missing 'assembly-output' directive"),
1857+
};
18671858

18681859
let rustc = self.make_compile_args(
18691860
input_file,

0 commit comments

Comments
 (0)