nodrop: Remove the no_drop_flag crate feature
This unstable feature is not supported in nightly anymore (and nor is it meaningful).
This commit is contained in:
@@ -18,10 +18,6 @@ default = ["std"]
|
|||||||
# Use libstd
|
# Use libstd
|
||||||
std = ["odds/std"]
|
std = ["odds/std"]
|
||||||
|
|
||||||
# Optional, nightly channel
|
|
||||||
# Use no drop flag. See API doc for more info.
|
|
||||||
no_drop_flag = []
|
|
||||||
|
|
||||||
# Optional, nightly channel
|
# Optional, nightly channel
|
||||||
# Use `needs_drop` to skip overwriting if not necessary
|
# Use `needs_drop` to skip overwriting if not necessary
|
||||||
use_needs_drop = []
|
use_needs_drop = []
|
||||||
|
|||||||
@@ -9,16 +9,8 @@
|
|||||||
//! - Optional
|
//! - Optional
|
||||||
//! - Requires nightly channel.
|
//! - Requires nightly channel.
|
||||||
//! - Use `needs_drop` to skip overwriting if not necessary
|
//! - Use `needs_drop` to skip overwriting if not necessary
|
||||||
//! - `no_drop_flag`.
|
|
||||||
//! - Optional.
|
|
||||||
//! - Requires nightly channel.
|
|
||||||
//! - Use no drop flag on the **NoDrop** type,
|
|
||||||
//! which means less space overhead. Use with care and report a bug if anything
|
|
||||||
//! changes behavior with this feature.
|
|
||||||
//!
|
|
||||||
//!
|
//!
|
||||||
|
|
||||||
#![cfg_attr(feature="no_drop_flag", feature(unsafe_no_drop_flag))]
|
|
||||||
#![cfg_attr(feature="use_needs_drop", feature(core_intrinsics))]
|
#![cfg_attr(feature="use_needs_drop", feature(core_intrinsics))]
|
||||||
|
|
||||||
#![cfg_attr(not(any(test, feature="std")), no_std)]
|
#![cfg_attr(not(any(test, feature="std")), no_std)]
|
||||||
@@ -41,7 +33,6 @@ enum Flag<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A type holding **T** that will not call its destructor on drop
|
/// A type holding **T** that will not call its destructor on drop
|
||||||
#[cfg_attr(feature="no_drop_flag", unsafe_no_drop_flag)]
|
|
||||||
pub struct NoDrop<T>(Flag<T>);
|
pub struct NoDrop<T>(Flag<T>);
|
||||||
|
|
||||||
impl<T> NoDrop<T> {
|
impl<T> NoDrop<T> {
|
||||||
@@ -82,7 +73,6 @@ fn needs_drop<T>() -> bool {
|
|||||||
impl<T> Drop for NoDrop<T> {
|
impl<T> Drop for NoDrop<T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if needs_drop::<T>() {
|
if needs_drop::<T>() {
|
||||||
// no drop flag info: writing repeatedly is idempotent
|
|
||||||
// inhibit drop
|
// inhibit drop
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::write(&mut self.0, Flag::Dropped);
|
ptr::write(&mut self.0, Flag::Dropped);
|
||||||
|
|||||||
Reference in New Issue
Block a user