Skip to content

Commit bc240ff

Browse files
committed
add an undef validation test
1 parent 8509dbb commit bc240ff

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![allow(unused_variables)]
2+
// error-pattern: attempted to read undefined bytes
3+
4+
mod safe {
5+
use std::mem;
6+
7+
pub(crate) fn make_float() -> f32 {
8+
unsafe { mem::uninitialized() }
9+
}
10+
}
11+
12+
fn main() {
13+
let _x = safe::make_float();
14+
}

0 commit comments

Comments
 (0)