summaryrefslogtreecommitdiffstats
path: root/src/test/ui/asm/aarch64/type-check-2-2.rs
blob: aa12d4aa4b40c8326e2cc3476efedfb4db148bb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// only-aarch64

#![feature(repr_simd, never_type, asm_sym)]

use std::arch::{asm, global_asm};

#[repr(simd)]
#[derive(Clone, Copy)]
struct SimdType(f32, f32, f32, f32);

#[repr(simd)]
struct SimdNonCopy(f32, f32, f32, f32);

fn main() {
    unsafe {
        // Inputs must be initialized

        let x: u64;
        asm!("{}", in(reg) x);
        //~^ ERROR used binding `x` isn't initialized
        let mut y: u64;
        asm!("{}", inout(reg) y);
        //~^ ERROR used binding `y` isn't initialized
        let _ = y;

        // Outputs require mutable places

        let v: Vec<u64> = vec![0, 1, 2];
        asm!("{}", in(reg) v[0]);
        asm!("{}", out(reg) v[0]);
        //~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
        asm!("{}", inout(reg) v[0]);
        //~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable

        // Sym operands must point to a function or static
    }
}