Make std::mem::needs_drop
accept ?Sized
This commit is contained in:
parent
a513b2abae
commit
be34cb35c7
@ -514,7 +514,7 @@ pub mod intrinsics {
|
|||||||
pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
|
pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
|
||||||
pub fn transmute<T, U>(e: T) -> U;
|
pub fn transmute<T, U>(e: T) -> U;
|
||||||
pub fn ctlz_nonzero<T>(x: T) -> T;
|
pub fn ctlz_nonzero<T>(x: T) -> T;
|
||||||
pub fn needs_drop<T>() -> bool;
|
pub fn needs_drop<T: ?::Sized>() -> bool;
|
||||||
pub fn bitreverse<T>(x: T) -> T;
|
pub fn bitreverse<T>(x: T) -> T;
|
||||||
pub fn bswap<T>(x: T) -> T;
|
pub fn bswap<T>(x: T) -> T;
|
||||||
pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
|
pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
|
||||||
|
@ -47,6 +47,11 @@ struct NoisyDrop {
|
|||||||
inner: NoisyDropInner,
|
inner: NoisyDropInner,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct NoisyDropUnsized {
|
||||||
|
text: str,
|
||||||
|
inner: NoisyDropInner,
|
||||||
|
}
|
||||||
|
|
||||||
struct NoisyDropInner;
|
struct NoisyDropInner;
|
||||||
|
|
||||||
impl Drop for NoisyDrop {
|
impl Drop for NoisyDrop {
|
||||||
@ -184,7 +189,9 @@ fn main() {
|
|||||||
assert_eq!(intrinsics::min_align_of_val(&a) as u8, intrinsics::min_align_of::<&str>() as u8);
|
assert_eq!(intrinsics::min_align_of_val(&a) as u8, intrinsics::min_align_of::<&str>() as u8);
|
||||||
|
|
||||||
assert!(!intrinsics::needs_drop::<u8>());
|
assert!(!intrinsics::needs_drop::<u8>());
|
||||||
|
assert!(!intrinsics::needs_drop::<[u8]>());
|
||||||
assert!(intrinsics::needs_drop::<NoisyDrop>());
|
assert!(intrinsics::needs_drop::<NoisyDrop>());
|
||||||
|
assert!(intrinsics::needs_drop::<NoisyDropUnsized>());
|
||||||
|
|
||||||
Unique {
|
Unique {
|
||||||
pointer: 0 as *const &str,
|
pointer: 0 as *const &str,
|
||||||
|
Loading…
Reference in New Issue
Block a user