mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Support getrandom syscall
This commit is contained in:
parent
ea02f4cba1
commit
59420afa46
8 changed files with 180 additions and 21 deletions
|
@ -2494,6 +2494,28 @@ fn exec_limits() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn memory_limit() {
|
||||
check_fail(
|
||||
r#"
|
||||
extern "Rust" {
|
||||
#[rustc_allocator]
|
||||
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
|
||||
}
|
||||
|
||||
const GOAL: u8 = unsafe {
|
||||
__rust_alloc(30_000_000_000, 1); // 30GB
|
||||
2
|
||||
};
|
||||
"#,
|
||||
|e| {
|
||||
e == ConstEvalError::MirEvalError(MirEvalError::Panic(
|
||||
"Memory allocation of 30000000000 bytes failed".to_string(),
|
||||
))
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn type_error() {
|
||||
check_fail(
|
||||
|
|
|
@ -602,3 +602,41 @@ fn rotate() {
|
|||
320192512,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simd() {
|
||||
check_number(
|
||||
r#"
|
||||
pub struct i8x16(
|
||||
i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,
|
||||
);
|
||||
extern "platform-intrinsic" {
|
||||
pub fn simd_bitmask<T, U>(x: T) -> U;
|
||||
}
|
||||
const GOAL: u16 = simd_bitmask(i8x16(
|
||||
0, 1, 0, 0, 2, 255, 100, 0, 50, 0, 1, 1, 0, 0, 0, 0
|
||||
));
|
||||
"#,
|
||||
0b0000110101110010,
|
||||
);
|
||||
check_number(
|
||||
r#"
|
||||
pub struct i8x16(
|
||||
i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,
|
||||
);
|
||||
extern "platform-intrinsic" {
|
||||
pub fn simd_lt<T, U>(x: T, y: T) -> U;
|
||||
pub fn simd_bitmask<T, U>(x: T) -> U;
|
||||
}
|
||||
const GOAL: u16 = simd_bitmask(simd_lt::<i8x16, i8x16>(
|
||||
i8x16(
|
||||
-105, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
|
||||
),
|
||||
i8x16(
|
||||
-4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
|
||||
),
|
||||
));
|
||||
"#,
|
||||
0xFFFF,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue