diff --git a/nodrop/src/lib.rs b/nodrop/src/lib.rs index 645e2b3..1d7b723 100644 --- a/nodrop/src/lib.rs +++ b/nodrop/src/lib.rs @@ -17,13 +17,17 @@ #![cfg_attr(feature="no_drop_flag", feature(unsafe_no_drop_flag))] #![cfg_attr(feature="use_needs_drop", feature(core_intrinsics))] +#![cfg_attr(not(test), no_std)] +#[cfg(test)] +extern crate core; + extern crate odds; use odds::debug_assert_unreachable; -use std::ops::{Deref, DerefMut}; -use std::ptr; -use std::mem; +use core::ops::{Deref, DerefMut}; +use core::ptr; +use core::mem; /// repr(u8) - Make sure the non-nullable pointer optimization does not occur! #[repr(u8)] @@ -107,6 +111,7 @@ impl DerefMut for NoDrop { } } +#[cfg(test)] #[test] fn test_no_nonnullable_opt() { // Make sure `Flag` does not apply the non-nullable pointer optimization @@ -116,6 +121,7 @@ fn test_no_nonnullable_opt() { assert!(mem::size_of::>>() > mem::size_of::>()); } +#[cfg(test)] #[test] fn test_drop() { use std::cell::Cell;