|
32 | 32 | #![feature(core_intrinsics)] |
33 | 33 | #![feature(dropck_eyepatch)] |
34 | 34 | #![feature(generic_param_attrs)] |
| 35 | +#![feature(needs_drop)] |
35 | 36 | #![cfg_attr(stage0, feature(staged_api))] |
36 | 37 | #![cfg_attr(test, feature(test))] |
37 | 38 |
|
@@ -82,7 +83,7 @@ impl<T> TypedArenaChunk<T> { |
82 | 83 | unsafe fn destroy(&mut self, len: usize) { |
83 | 84 | // The branch on needs_drop() is an -O1 performance optimization. |
84 | 85 | // Without the branch, dropping TypedArena<u8> takes linear time. |
85 | | - if intrinsics::needs_drop::<T>() { |
| 86 | + if mem::needs_drop::<T>() { |
86 | 87 | let mut start = self.start(); |
87 | 88 | // Destroy all allocated objects. |
88 | 89 | for _ in 0..len { |
@@ -350,7 +351,7 @@ impl DroplessArena { |
350 | 351 | #[inline] |
351 | 352 | pub fn alloc<T>(&self, object: T) -> &mut T { |
352 | 353 | unsafe { |
353 | | - assert!(!intrinsics::needs_drop::<T>()); |
| 354 | + assert!(!mem::needs_drop::<T>()); |
354 | 355 | assert!(mem::size_of::<T>() != 0); |
355 | 356 |
|
356 | 357 | self.align_for::<T>(); |
@@ -379,9 +380,7 @@ impl DroplessArena { |
379 | 380 | #[inline] |
380 | 381 | pub fn alloc_slice<T>(&self, slice: &[T]) -> &mut [T] |
381 | 382 | where T: Copy { |
382 | | - unsafe { |
383 | | - assert!(!intrinsics::needs_drop::<T>()); |
384 | | - } |
| 383 | + assert!(!mem::needs_drop::<T>()); |
385 | 384 | assert!(mem::size_of::<T>() != 0); |
386 | 385 | assert!(slice.len() != 0); |
387 | 386 | self.align_for::<T>(); |
|
0 commit comments