File tree Expand file tree Collapse file tree 2 files changed +2
-8
lines changed
tests/ui/precondition-checks Expand file tree Collapse file tree 2 files changed +2
-8
lines changed Original file line number Diff line number Diff line change 1
1
//@ run-fail
2
2
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
3
3
//@ error-pattern: unsafe precondition(s) violated: ptr::read_volatile requires
4
- //@ revisions: null misaligned
4
+ //@ revisions: misaligned
5
5
6
6
#![ allow( invalid_null_arguments) ]
7
7
@@ -11,8 +11,6 @@ fn main() {
11
11
let src = [ 0u16 ; 2 ] ;
12
12
let src = src. as_ptr ( ) ;
13
13
unsafe {
14
- #[ cfg( null) ]
15
- ptr:: read_volatile ( ptr:: null :: < u8 > ( ) ) ;
16
14
#[ cfg( misaligned) ]
17
15
ptr:: read_volatile ( src. byte_add ( 1 ) ) ;
18
16
}
Original file line number Diff line number Diff line change 1
1
//@ run-fail
2
2
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
3
3
//@ error-pattern: unsafe precondition(s) violated: ptr::write_volatile requires
4
- //@ revisions: null misaligned
5
-
6
- #![ allow( invalid_null_arguments) ]
4
+ //@ revisions: misaligned
7
5
8
6
use std:: ptr;
9
7
10
8
fn main ( ) {
11
9
let mut dst = [ 0u16 ; 2 ] ;
12
10
let mut dst = dst. as_mut_ptr ( ) ;
13
11
unsafe {
14
- #[ cfg( null) ]
15
- ptr:: write_volatile ( ptr:: null_mut :: < u8 > ( ) , 1u8 ) ;
16
12
#[ cfg( misaligned) ]
17
13
ptr:: write_volatile ( dst. byte_add ( 1 ) , 1u16 ) ;
18
14
}
You can’t perform that action at this time.
0 commit comments