-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
183 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 use of possibly-uninitialized variable: `x` | ||
let mut y: u64; | ||
asm!("{}", inout(reg) y); | ||
//~^ ERROR use of possibly-uninitialized variable: `y` | ||
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
error[E0381]: use of possibly-uninitialized variable: `x` | ||
--> $DIR/type-check-2-2.rs:19:28 | ||
| | ||
LL | asm!("{}", in(reg) x); | ||
| ^ use of possibly-uninitialized `x` | ||
|
||
error[E0381]: use of possibly-uninitialized variable: `y` | ||
--> $DIR/type-check-2-2.rs:22:9 | ||
| | ||
LL | asm!("{}", inout(reg) y); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly-uninitialized `y` | ||
|
||
error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable | ||
--> $DIR/type-check-2-2.rs:30:29 | ||
| | ||
LL | let v: Vec<u64> = vec![0, 1, 2]; | ||
| - help: consider changing this to be mutable: `mut v` | ||
LL | asm!("{}", in(reg) v[0]); | ||
LL | asm!("{}", out(reg) v[0]); | ||
| ^ cannot borrow as mutable | ||
|
||
error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable | ||
--> $DIR/type-check-2-2.rs:32:31 | ||
| | ||
LL | let v: Vec<u64> = vec![0, 1, 2]; | ||
| - help: consider changing this to be mutable: `mut v` | ||
... | ||
LL | asm!("{}", inout(reg) v[0]); | ||
| ^ cannot borrow as mutable | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0381, E0596. | ||
For more information about an error, try `rustc --explain E0381`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.