diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-10-11 11:50:43 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-10-11 12:09:08 +1100 |
| commit | 4637630ed7e64a5a3f56ff8e4f5d2552f0df455b (patch) | |
| tree | fbae1400de57f70cab5d2ea5e76fc4097b78a362 | |
| parent | 52fd9983996d9fcfb719749838336be66dee68f9 (diff) | |
| download | rust-4637630ed7e64a5a3f56ff8e4f5d2552f0df455b.tar.gz rust-4637630ed7e64a5a3f56ff8e4f5d2552f0df455b.zip | |
Simplify the choice of `--emit` mode for assembly tests
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 256b88758f0..f3e7137967e 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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, |
