Skip to content

Commit

Permalink
add an undef validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Sep 16, 2017
1 parent 8509dbb commit bc240ff
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/compile-fail/validation_undef.rs
@@ -0,0 +1,14 @@
#![allow(unused_variables)]
// error-pattern: attempted to read undefined bytes

mod safe {
use std::mem;

pub(crate) fn make_float() -> f32 {
unsafe { mem::uninitialized() }
}
}

fn main() {
let _x = safe::make_float();
}

0 comments on commit bc240ff

Please sign in to comment.