nodrop: Use odds & bump version
This commit is contained in:
+4
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nodrop"
|
name = "nodrop"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
authors = ["bluss"]
|
authors = ["bluss"]
|
||||||
|
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
@@ -16,3 +16,6 @@ keywords = ["container", "drop"]
|
|||||||
# Optional, nightly channel
|
# Optional, nightly channel
|
||||||
# Use no drop flag. See API doc for more info.
|
# Use no drop flag. See API doc for more info.
|
||||||
no_drop_flag = []
|
no_drop_flag = []
|
||||||
|
|
||||||
|
[dependencies.odds]
|
||||||
|
version = "0.1"
|
||||||
|
|||||||
+4
-18
@@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
#![cfg_attr(feature="no_drop_flag", feature(unsafe_no_drop_flag))]
|
#![cfg_attr(feature="no_drop_flag", feature(unsafe_no_drop_flag))]
|
||||||
|
|
||||||
|
extern crate odds;
|
||||||
|
|
||||||
|
use odds::debug_assert_unreachable;
|
||||||
|
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
@@ -58,24 +62,6 @@ impl<T> Drop for NoDrop<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Void { }
|
|
||||||
|
|
||||||
/// FIXME: Replace with intrinsic when it's stable
|
|
||||||
#[inline]
|
|
||||||
unsafe fn unreachable() -> ! {
|
|
||||||
let void: &Void = mem::transmute(&());
|
|
||||||
match *void {
|
|
||||||
// no cases
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
unsafe fn debug_assert_unreachable() -> ! {
|
|
||||||
debug_assert!(false, "Entered unreachable section, this is a bug!");
|
|
||||||
unreachable()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
impl<T> Deref for NoDrop<T> {
|
impl<T> Deref for NoDrop<T> {
|
||||||
type Target = T;
|
type Target = T;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user