diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-05-09 12:15:44 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-05-09 15:28:29 -0700 |
| commit | ca18ed8f64daa12138352541f7d8ccfc593b2970 (patch) | |
| tree | f8334edb11837e94cb1c5f2d0e5b213877bf8cec | |
| parent | cd235d423008ce9a35d0d5f3a7e35a91b8c3033b (diff) | |
| download | rust-ca18ed8f64daa12138352541f7d8ccfc593b2970.tar.gz rust-ca18ed8f64daa12138352541f7d8ccfc593b2970.zip | |
testsuite: Test that init and forget are both unsafe
| -rw-r--r-- | src/test/compile-fail/forget-init-unsafe.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/compile-fail/forget-init-unsafe.rs b/src/test/compile-fail/forget-init-unsafe.rs new file mode 100644 index 00000000000..2361b5ad6a9 --- /dev/null +++ b/src/test/compile-fail/forget-init-unsafe.rs @@ -0,0 +1,17 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use core::unstable::intrinsics::{init, forget}; + +// Test that the `forget` and `init` intrinsics are really unsafe +pub fn main() { + let stuff = init::<int>(); //~ ERROR access to unsafe function requires unsafe + forget(stuff); //~ ERROR access to unsafe function requires unsafe +} \ No newline at end of file |
