]> git.lizzy.rs Git - rust.git/blob - src/test/ui/asm/parse-error.rs
asm: Allow multiple template strings; interpret them as newline-separated
[rust.git] / src / test / ui / asm / parse-error.rs
1 // only-x86_64
2
3 #![feature(asm)]
4
5 fn main() {
6     let mut foo = 0;
7     let mut bar = 0;
8     unsafe {
9         asm!();
10         //~^ ERROR requires at least a template string argument
11         asm!(foo);
12         //~^ ERROR asm template must be a string literal
13         asm!("{}" foo);
14         //~^ ERROR expected token: `,`
15         asm!("{}", foo);
16         //~^ ERROR expected operand, options, or additional template string
17         asm!("{}", in foo);
18         //~^ ERROR expected `(`, found `foo`
19         asm!("{}", in(reg foo));
20         //~^ ERROR expected `)`, found `foo`
21         asm!("{}", in(reg));
22         //~^ ERROR expected expression, found end of macro arguments
23         asm!("{}", inout(=) foo => bar);
24         //~^ ERROR expected register class or explicit register
25         asm!("{}", inout(reg) foo =>);
26         //~^ ERROR expected expression, found end of macro arguments
27         asm!("{}", in(reg) foo => bar);
28         //~^ ERROR expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `=>`
29         asm!("{}", sym foo + bar);
30         //~^ ERROR argument to `sym` must be a path expression
31         asm!("", options(foo));
32         //~^ ERROR expected one of
33         asm!("", options(nomem foo));
34         //~^ ERROR expected one of
35         asm!("", options(nomem, foo));
36         //~^ ERROR expected one of
37         asm!("", options(), options());
38         //~^ ERROR asm options cannot be specified multiple times
39         asm!("", options(), options(), options());
40         //~^ ERROR asm options cannot be specified multiple times
41         //~^^ ERROR asm options cannot be specified multiple times
42         asm!("{}", options(), const foo);
43         //~^ ERROR arguments are not allowed after options
44         asm!("{a}", a = const foo, a = const bar);
45         //~^ ERROR duplicate argument named `a`
46         //~^^ ERROR argument never used
47         asm!("", a = in("eax") foo);
48         //~^ ERROR explicit register arguments cannot have names
49         asm!("{a}", in("eax") foo, a = const bar);
50         //~^ ERROR named arguments cannot follow explicit register arguments
51         asm!("{a}", in("eax") foo, a = const bar);
52         //~^ ERROR named arguments cannot follow explicit register arguments
53         asm!("{1}", in("eax") foo, const bar);
54         //~^ ERROR positional arguments cannot follow named arguments or explicit register arguments
55         asm!("", options(), "");
56         //~^ ERROR expected one of
57         asm!("{}", in(reg) foo, "{}", out(reg) foo);
58         //~^ ERROR expected one of
59         asm!(format!("{{{}}}", 0), in(reg) foo);
60         //~^ ERROR asm template must be a string literal
61         asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar);
62         //~^ ERROR asm template must be a string literal
63     }
64 }