]> git.lizzy.rs Git - rust.git/blob - src/test/ui/asm/aarch64/type-check-2-2.rs
Auto merge of #98471 - wesleywiser:update_measureme, r=Mark-Simulacrum
[rust.git] / src / test / ui / asm / aarch64 / type-check-2-2.rs
1 // only-aarch64
2
3 #![feature(repr_simd, never_type, asm_sym)]
4
5 use std::arch::{asm, global_asm};
6
7 #[repr(simd)]
8 #[derive(Clone, Copy)]
9 struct SimdType(f32, f32, f32, f32);
10
11 #[repr(simd)]
12 struct SimdNonCopy(f32, f32, f32, f32);
13
14 fn main() {
15     unsafe {
16         // Inputs must be initialized
17
18         let x: u64;
19         asm!("{}", in(reg) x);
20         //~^ ERROR used binding `x` isn't initialized
21         let mut y: u64;
22         asm!("{}", inout(reg) y);
23         //~^ ERROR used binding `y` isn't initialized
24         let _ = y;
25
26         // Outputs require mutable places
27
28         let v: Vec<u64> = vec![0, 1, 2];
29         asm!("{}", in(reg) v[0]);
30         asm!("{}", out(reg) v[0]);
31         //~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
32         asm!("{}", inout(reg) v[0]);
33         //~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
34
35         // Sym operands must point to a function or static
36     }
37 }