Skip to content

Commit 4b3ce76

Browse files
committed
fix: remove tests for null failure in volatile
1 parent 36574d9 commit 4b3ce76

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

tests/ui/precondition-checks/read_volatile.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ run-fail
22
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
33
//@ error-pattern: unsafe precondition(s) violated: ptr::read_volatile requires
4-
//@ revisions: null misaligned
4+
//@ revisions: misaligned
55

66
#![allow(invalid_null_arguments)]
77

@@ -11,8 +11,6 @@ fn main() {
1111
let src = [0u16; 2];
1212
let src = src.as_ptr();
1313
unsafe {
14-
#[cfg(null)]
15-
ptr::read_volatile(ptr::null::<u8>());
1614
#[cfg(misaligned)]
1715
ptr::read_volatile(src.byte_add(1));
1816
}

tests/ui/precondition-checks/write_volatile.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
//@ run-fail
22
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
33
//@ error-pattern: unsafe precondition(s) violated: ptr::write_volatile requires
4-
//@ revisions: null misaligned
5-
6-
#![allow(invalid_null_arguments)]
4+
//@ revisions: misaligned
75

86
use std::ptr;
97

108
fn main() {
119
let mut dst = [0u16; 2];
1210
let mut dst = dst.as_mut_ptr();
1311
unsafe {
14-
#[cfg(null)]
15-
ptr::write_volatile(ptr::null_mut::<u8>(), 1u8);
1612
#[cfg(misaligned)]
1713
ptr::write_volatile(dst.byte_add(1), 1u16);
1814
}

0 commit comments

Comments
 (0)