]> git.lizzy.rs Git - rust.git/blob - src/test/ui/asm/x86_64/bad-options.rs
Rollup merge of #97325 - tmiasko:capture-enum-field, r=arora-aman
[rust.git] / src / test / ui / asm / x86_64 / bad-options.rs
1 // only-x86_64
2
3 use std::arch::{asm, global_asm};
4
5 fn main() {
6     let mut foo = 0;
7     unsafe {
8         asm!("", options(nomem, readonly));
9         //~^ ERROR the `nomem` and `readonly` options are mutually exclusive
10         asm!("", options(pure, nomem, noreturn));
11         //~^ ERROR the `pure` and `noreturn` options are mutually exclusive
12         //~^^ ERROR asm with the `pure` option must have at least one output
13         asm!("{}", in(reg) foo, options(pure, nomem));
14         //~^ ERROR asm with the `pure` option must have at least one output
15         asm!("{}", out(reg) foo, options(noreturn));
16         //~^ ERROR asm outputs are not allowed with the `noreturn` option
17     }
18
19     unsafe {
20         asm!("", clobber_abi("foo"));
21         //~^ ERROR invalid ABI for `clobber_abi`
22         asm!("{}", out(reg) foo, clobber_abi("C"));
23         //~^ ERROR asm with `clobber_abi` must specify explicit registers for outputs
24         asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C"));
25         //~^ ERROR asm with `clobber_abi` must specify explicit registers for outputs
26         //~| ERROR `C` ABI specified multiple times
27         asm!("", out("eax") foo, clobber_abi("C"));
28     }
29 }
30
31 global_asm!("", options(nomem));
32 //~^ ERROR expected one of
33 global_asm!("", options(readonly));
34 //~^ ERROR expected one of
35 global_asm!("", options(noreturn));
36 //~^ ERROR expected one of
37 global_asm!("", options(pure));
38 //~^ ERROR expected one of
39 global_asm!("", options(nostack));
40 //~^ ERROR expected one of
41 global_asm!("", options(preserves_flags));
42 //~^ ERROR expected one of