Skip to content

Commit 6a84baf

Browse files
committed
add tests for '_' places
1 parent f394d45 commit 6a84baf

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(strict_provenance)]
2+
// Make sure places assigned to a `_` pattern are still checked for deref'ability.
3+
4+
fn main() {
5+
let ptr = std::ptr::invalid(32) as *const u8;
6+
unsafe {
7+
let _ = *ptr;
8+
} //~ERROR: dangling pointer
9+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![feature(strict_provenance)]
2+
// Make sure places assigned to a `_` pattern are still checked for deref'ability.
3+
4+
fn main() {
5+
let ptr = std::ptr::invalid(32) as *const u8;
6+
unsafe {
7+
match *ptr {
8+
_ => {}
9+
} //~ERROR: dangling pointer
10+
}
11+
}

0 commit comments

Comments
 (0)