Skip to content

Commit

Permalink
Unrolled build for rust-lang#131525
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rust-timer authored Oct 11, 2024
2 parents 0321e73 + 4637630 commit e0e3fac
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1847,23 +1847,14 @@ impl<'test> TestCx<'test> {
let output_file = self.get_output_file("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,
Expand Down

0 comments on commit e0e3fac

Please sign in to comment.