8 use std::arch::{asm, global_asm};
12 // Outputs must be place expressions
14 asm!("{}", in(reg) 1 + 2);
15 asm!("{}", out(reg) 1 + 2);
16 //~^ ERROR invalid asm output
17 asm!("{}", inout(reg) 1 + 2);
18 //~^ ERROR invalid asm output
20 // Operands must be sized
22 let v: [u64; 3] = [0, 1, 2];
23 asm!("{}", in(reg) v[..]);
24 //~^ ERROR the size for values of type `[u64]` cannot be known at compilation time
25 asm!("{}", out(reg) v[..]);
26 //~^ ERROR the size for values of type `[u64]` cannot be known at compilation time
27 asm!("{}", inout(reg) v[..]);
28 //~^ ERROR the size for values of type `[u64]` cannot be known at compilation time
30 // Constants must be... constant
33 const fn const_foo(x: i32) -> i32 {
36 const fn const_bar<T>(x: T) -> T {
40 //~^ ERROR attempt to use a non-constant value in a constant
41 asm!("{}", const const_foo(0));
42 asm!("{}", const const_foo(x));
43 //~^ ERROR attempt to use a non-constant value in a constant
44 asm!("{}", const const_bar(0));
45 asm!("{}", const const_bar(x));
46 //~^ ERROR attempt to use a non-constant value in a constant
48 // Const operands must be integers and must be constants.
51 asm!("{}", const 0i32);
52 asm!("{}", const 0i128);
53 asm!("{}", const 0f32);
54 //~^ ERROR mismatched types
55 asm!("{}", const 0 as *mut u8);
56 //~^ ERROR mismatched types
58 //~^ ERROR mismatched types
62 // Const operands must be integers and must be constants.
64 global_asm!("{}", const 0);
65 global_asm!("{}", const 0i32);
66 global_asm!("{}", const 0i128);
67 global_asm!("{}", const 0f32);
68 //~^ ERROR mismatched types
69 global_asm!("{}", const 0 as *mut u8);
70 //~^ ERROR mismatched types