]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/asm/type-check-1.rs
3 #![feature(asm, global_asm)]
7 // Outputs must be place expressions
9 asm
!("{}", in(reg
) 1 + 2);
10 asm
!("{}", out(reg
) 1 + 2);
11 //~^ ERROR invalid asm output
12 asm
!("{}", inout(reg
) 1 + 2);
13 //~^ ERROR invalid asm output
15 // Operands must be sized
17 let v
: [u64; 3] = [0, 1, 2];
18 asm
!("{}", in(reg
) v
[..]);
19 //~^ ERROR the size for values of type `[u64]` cannot be known at compilation time
20 asm
!("{}", out(reg
) v
[..]);
21 //~^ ERROR the size for values of type `[u64]` cannot be known at compilation time
22 asm
!("{}", inout(reg
) v
[..]);
23 //~^ ERROR the size for values of type `[u64]` cannot be known at compilation time
25 // Constants must be... constant
28 const fn const_foo(x
: i32) -> i32 {
31 const fn const_bar
<T
>(x
: T
) -> T
{
35 //~^ ERROR attempt to use a non-constant value in a constant
36 asm
!("{}", const const_foo(0));
37 asm
!("{}", const const_foo(x
));
38 //~^ ERROR attempt to use a non-constant value in a constant
39 asm
!("{}", const const_bar(0));
40 asm
!("{}", const const_bar(x
));
41 //~^ ERROR attempt to use a non-constant value in a constant
43 // Const operands must be integers and must be constants.
46 asm
!("{}", const 0i32);
47 asm
!("{}", const 0i128);
48 asm
!("{}", const 0f32);
49 //~^ ERROR mismatched types
50 asm
!("{}", const 0 as *mut u8);
51 //~^ ERROR mismatched types
55 // Const operands must be integers and must be constants.
57 global_asm
!("{}", const 0);
58 global_asm
!("{}", const 0i32);
59 global_asm
!("{}", const 0i128);
60 global_asm
!("{}", const 0f32);
61 //~^ ERROR mismatched types
62 global_asm
!("{}", const 0 as *mut u8);
63 //~^ ERROR mismatched types