Skip to content

Commit f7a54fe

Browse files
committed
TEMP: crash and fail run-pass, crash and pass run-fail, fail and pass run-crash
1 parent 64c076e commit f7a54fe

File tree

6 files changed

+16
-17
lines changed

6 files changed

+16
-17
lines changed

tests/ui/deref.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ run-pass
2+
3+
pub fn main() {
4+
panic!("moop");
5+
}

tests/ui/inlined-main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
//@ run-pass
22

33
#[inline(always)]
4-
fn main() {}
4+
fn main() {
5+
unsafe {
6+
let null: *mut u32 = std::ptr::null_mut();
7+
*null = 42;
8+
}
9+
}

tests/ui/mir/alignment/borrow_misaligned_field_projection.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,5 @@
33
//@ compile-flags: -C debug-assertions
44
//@ error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is
55

6-
struct Misalignment {
7-
a: u32,
8-
}
9-
106
fn main() {
11-
let mut items: [Misalignment; 2] = [Misalignment { a: 0 }, Misalignment { a: 1 }];
12-
unsafe {
13-
let ptr: *const Misalignment = items.as_ptr().byte_add(1);
14-
let _ptr: &u32 = unsafe { &(*ptr).a };
15-
}
167
}

tests/ui/mir/alignment/misaligned_borrow.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,5 @@
44
//@ error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is
55

66
fn main() {
7-
let x = [0u32; 2];
8-
let ptr = x.as_ptr();
9-
unsafe {
10-
let _ptr = &(*(ptr.byte_add(1)));
11-
}
7+
panic!("moop");
128
}

tests/ui/panics/main-panic.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
//@ needs-subprocess
44

55
fn main() {
6-
panic!()
6+
unsafe {
7+
let null: *mut u32 = std::ptr::null_mut();
8+
*null = 42;
9+
}
710
}

tests/ui/panics/panic-main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
//@ needs-subprocess
44

55
fn main() {
6-
panic!("moop");
76
}

0 commit comments

Comments
 (0)