mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Add new ui tests
This commit is contained in:
parent
88d6e9f868
commit
9e1b2d909b
@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
|
||||
const ENTRY_LIMIT: usize = 900;
|
||||
// FIXME: The following limits should be reduced eventually.
|
||||
const ISSUES_ENTRY_LIMIT: usize = 1819;
|
||||
const ROOT_ENTRY_LIMIT: usize = 871;
|
||||
const ROOT_ENTRY_LIMIT: usize = 872;
|
||||
|
||||
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
|
||||
"rs", // test source files
|
||||
|
11
tests/ui/precondition-checks/misaligned-slice.rs
Normal file
11
tests/ui/precondition-checks/misaligned-slice.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// run-fail
|
||||
// compile-flags: -Copt-level=3 -Cdebug-assertions=yes
|
||||
// error-pattern: unsafe precondition(s) violated: slice::from_raw_parts
|
||||
// ignore-debug
|
||||
// ignore-wasm32-bare no panic messages
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let _s: &[u64] = std::slice::from_raw_parts(1usize as *const u64, 0);
|
||||
}
|
||||
}
|
11
tests/ui/precondition-checks/null-slice.rs
Normal file
11
tests/ui/precondition-checks/null-slice.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// run-fail
|
||||
// compile-flags: -Copt-level=3 -Cdebug-assertions=yes
|
||||
// error-pattern: unsafe precondition(s) violated: slice::from_raw_parts
|
||||
// ignore-debug
|
||||
// ignore-wasm32-bare no panic messages
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let _s: &[u8] = std::slice::from_raw_parts(std::ptr::null(), 0);
|
||||
}
|
||||
}
|
12
tests/ui/precondition-checks/out-of-bounds-get-unchecked.rs
Normal file
12
tests/ui/precondition-checks/out-of-bounds-get-unchecked.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// run-fail
|
||||
// compile-flags: -Copt-level=3 -Cdebug-assertions=yes
|
||||
// error-pattern: unsafe precondition(s) violated: hint::assert_unchecked
|
||||
// ignore-debug
|
||||
// ignore-wasm32-bare no panic messages
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let sli: &[u8] = &[0];
|
||||
sli.get_unchecked(1);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user