From 545ae6e609610ddcbb0e9c52e0f353dc247a27a4 Mon Sep 17 00:00:00 2001 From: bluss Date: Mon, 16 Oct 2017 22:13:53 +0200 Subject: [PATCH] FEAT: Update nodrop for stable needs_drop --- .travis.yml | 1 + nodrop/README.rst | 50 +++++++++++++++++++++++++++++++++++++++++++++++ nodrop/src/lib.rs | 7 ++----- 3 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 nodrop/README.rst diff --git a/.travis.yml b/.travis.yml index 95bd3c3..1424602 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ matrix: - rust: stable env: - NODEFAULT=1 + - NODROP_FEATURES='use_needs_drop' - rust: beta - rust: nightly env: diff --git a/nodrop/README.rst b/nodrop/README.rst new file mode 100644 index 0000000..413b638 --- /dev/null +++ b/nodrop/README.rst @@ -0,0 +1,50 @@ + +nodrop +====== + +Recent Changes (nodrop) +----------------------- + +- + + - Update for stable ``needs_drop`` (Rust 1.21, was nightly only) + +- 0.1.9 + + - Fix issue in recent nightly where ``repr(u8)`` did not work. Use + a better way to get rid of the enum layout optimization. + +- 0.1.8 + + - Add crate feature ``use_union`` that uses untagged unions to implement NoDrop. + Finally we have an implementation without hacks, without a runtime flag, + and without an actual ``Drop`` impl (which was needed to suppress drop). + The crate feature requires nightly and is unstable. + +- 0.1.7 + + - Remove crate feature ``no_drop_flag``, because it doesn't compile on nightly + anymore. Drop flags are gone anyway! + +- 0.1.6 + + - Add feature std, which you can opt out of to use ``no_std``. + +- 0.1.5 + + - Added crate feature ``use_needs_drop`` which is a nightly-only + optimization, which skips overwriting if the inner value does not need + drop. + +License +======= + +Dual-licensed to be compatible with the Rust project. + +Licensed under the Apache License, Version 2.0 +http://www.apache.org/licenses/LICENSE-2.0 or the MIT license +http://opensource.org/licenses/MIT, at your +option. This file may not be copied, modified, or distributed +except according to those terms. + + diff --git a/nodrop/src/lib.rs b/nodrop/src/lib.rs index eeea126..4aed18c 100644 --- a/nodrop/src/lib.rs +++ b/nodrop/src/lib.rs @@ -3,11 +3,10 @@ //! //! - `std` //! - Optional, enabled by default -//! - Requires Rust 1.6 *to disable* //! - Use libstd //! - `use_needs_drop` //! - Optional -//! - Requires nightly channel. +//! - Requires Rust 1.21 //! - Use `needs_drop` to skip overwriting if not necessary //! - `use_union` //! - Optional @@ -16,8 +15,6 @@ //! for example the fact that `NoDrop` never has a destructor anymore. //! -#![cfg_attr(feature="use_needs_drop", feature(core_intrinsics))] - #![cfg_attr(not(any(test, feature="std")), no_std)] #[cfg(not(any(test, feature="std")))] extern crate core as std; @@ -81,7 +78,7 @@ mod imp { #[inline] fn needs_drop() -> bool { unsafe { - ::std::intrinsics::needs_drop::() + ::std::mem::needs_drop::() } }