From 6ab78bbe6c396660a5f171d47dfd362c0becbddb Mon Sep 17 00:00:00 2001 From: bluss Date: Sat, 6 Feb 2016 19:29:53 +0100 Subject: [PATCH] nodrop: Add std as default feature to enable libstd --- nodrop/Cargo.toml | 5 +++++ nodrop/src/lib.rs | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/nodrop/Cargo.toml b/nodrop/Cargo.toml index 678db85..8021198 100644 --- a/nodrop/Cargo.toml +++ b/nodrop/Cargo.toml @@ -12,6 +12,11 @@ repository = "https://github.com/bluss/arrayvec" keywords = ["container", "drop"] [features] +default = ["std"] + +# Default, Rust 1.6+ +# Use libstd +std = [] # Optional, nightly channel # Use no drop flag. See API doc for more info. diff --git a/nodrop/src/lib.rs b/nodrop/src/lib.rs index 1d7b723..6627b3d 100644 --- a/nodrop/src/lib.rs +++ b/nodrop/src/lib.rs @@ -1,6 +1,10 @@ //! //! The **nodrop** crate has the following cargo feature flags: //! +//! - `std` +//! - Optional, enabled by default +//! - Requires Rust 1.6 *to disable* +//! - Use libstd //! - `use_needs_drop` //! - Optional //! - Requires nightly channel. @@ -17,17 +21,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; +#![cfg_attr(not(any(test, feature="std")), no_std)] +#[cfg(not(any(test, feature="std")))] +extern crate core as std; extern crate odds; use odds::debug_assert_unreachable; -use core::ops::{Deref, DerefMut}; -use core::ptr; -use core::mem; +use std::ops::{Deref, DerefMut}; +use std::ptr; +use std::mem; /// repr(u8) - Make sure the non-nullable pointer optimization does not occur! #[repr(u8)]