diff options
| author | Ralf Jung <post@ralfj.de> | 2017-09-16 12:11:48 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2017-09-16 12:11:48 +0200 |
| commit | bc240ff606586bae4e1496ec3954c2f3a2b27c76 (patch) | |
| tree | e5b6e774d8ce3e365c82b3b7751ee07b1481980a | |
| parent | 8509dbbafe1a08ea5cee367bb1599e0bb09a2a2d (diff) | |
| download | rust-bc240ff606586bae4e1496ec3954c2f3a2b27c76.tar.gz rust-bc240ff606586bae4e1496ec3954c2f3a2b27c76.zip | |
add an undef validation test
| -rw-r--r-- | tests/compile-fail/validation_undef.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/compile-fail/validation_undef.rs b/tests/compile-fail/validation_undef.rs new file mode 100644 index 00000000000..b889b1ea531 --- /dev/null +++ b/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(); +} |
