]> git.lizzy.rs Git - rust.git/blob - src/test/ui/asm/type-check-4.rs
Rollup merge of #99787 - aDotInTheVoid:rdj-dyn, r=camelid,notriddle,GuillaumeGomez
[rust.git] / src / test / ui / asm / type-check-4.rs
1 // needs-asm-support
2 // ignore-nvptx64
3 // ignore-spirv
4 // ignore-wasm32
5
6 use std::arch::asm;
7
8 fn main() {
9     unsafe {
10         // Can't output to borrowed values.
11
12         let mut a = 0isize;
13         let p = &a;
14         asm!("{}", out(reg) a);
15         //~^ cannot assign to `a` because it is borrowed
16         println!("{}", p);
17
18         // Can't read from mutable borrowed values.
19
20         let mut a = 0isize;
21         let p = &mut a;
22         asm!("{}", in(reg) a);
23         //~^ cannot use `a` because it was mutably borrowed
24         println!("{}", p);
25     }
26 }