Lines Matching +full:dangling +full:- +full:reference
26 pub fn cast_box<A: NoUninit, B: AnyBitPattern>(input: Box<A>) -> Box<B> { in cast_box()
42 ) -> Result<Box<B>, (PodCastError, Box<A>)> { in try_cast_box()
65 pub fn try_zeroed_box<T: Zeroable>() -> Result<Box<T>, ()> { in try_zeroed_box()
67 // This will not allocate but simply create a dangling pointer. in try_zeroed_box()
68 let dangling = core::ptr::NonNull::dangling().as_ptr(); in try_zeroed_box() localVariable
69 return Ok(unsafe { Box::from_raw(dangling) }); in try_zeroed_box()
83 pub fn zeroed_box<T: Zeroable>() -> Box<T> { in zeroed_box()
94 pub fn try_zeroed_vec<T: Zeroable>(length: usize) -> Result<Vec<T>, ()> { in try_zeroed_vec()
104 pub fn zeroed_vec<T: Zeroable>(length: usize) -> Vec<T> { in zeroed_vec()
122 ) -> Result<Box<[T]>, ()> { in try_zeroed_slice_box()
124 // This will not allocate but simply create a dangling slice pointer. in try_zeroed_slice_box()
125 let dangling = core::ptr::NonNull::dangling().as_ptr(); in try_zeroed_slice_box() localVariable
126 let dangling_slice = core::ptr::slice_from_raw_parts_mut(dangling, length); in try_zeroed_slice_box()
142 pub fn zeroed_slice_box<T: Zeroable>(length: usize) -> Box<[T]> { in zeroed_slice_box()
150 ) -> Box<[B]> { in cast_slice_box()
167 ) -> Result<Box<[B]>, (PodCastError, Box<[A]>)> { in try_cast_slice_box()
199 pub fn cast_vec<A: NoUninit, B: AnyBitPattern>(input: Vec<A>) -> Vec<B> { in cast_vec()
217 ) -> Result<Vec<B>, (PodCastError, Vec<A>)> { in try_cast_vec()
245 // Note(Lokathor): Next we "pre-forget" the old Vec by wrapping with in try_cast_vec()
259 // Note(Lokathor): Next we "pre-forget" the old Vec by wrapping with in try_cast_vec()
288 ) -> Vec<B> { in pod_collect_to_vec()
306 ) -> Rc<B> { in cast_rc()
326 ) -> Result<Rc<B>, (PodCastError, Rc<A>)> { in try_cast_rc()
343 ) -> Arc<B> { in cast_arc()
367 ) -> Result<Arc<B>, (PodCastError, Arc<A>)> { in try_cast_arc()
386 ) -> Rc<[B]> { in cast_slice_rc()
410 ) -> Result<Rc<[B]>, (PodCastError, Rc<[A]>)> { in try_cast_slice_rc()
429 // intermediate const reference, because it has mutable provenance, in try_cast_slice_rc()
430 // nor an intermediate mutable reference, because it could be aliased. in try_cast_slice_rc()
449 ) -> Arc<[B]> { in cast_slice_arc()
474 ) -> Result<Arc<[B]>, (PodCastError, Arc<[A]>)> { in try_cast_slice_arc()
493 // intermediate const reference, because it has mutable provenance, in try_cast_slice_arc()
494 // nor an intermediate mutable reference, because it could be aliased. in try_cast_slice_arc()
510 fn wrap_vec(s: Vec<Inner>) -> Vec<Self> in wrap_vec()
523 // * ptr comes from Vec (and will not be double-dropped) in wrap_vec()
533 fn wrap_box(s: Box<Inner>) -> Box<Self> { in wrap_box()
544 // * Box is guaranteed to have representation identical to a (non-null) in wrap_box()
557 fn wrap_rc(s: Rc<Inner>) -> Rc<Self> { in wrap_rc()
580 fn wrap_arc(s: Arc<Inner>) -> Arc<Self> { in wrap_arc()
600 fn peel_vec(s: Vec<Self>) -> Vec<Inner> in peel_vec()
613 // * ptr comes from Vec (and will not be double-dropped) in peel_vec()
623 fn peel_box(s: Box<Self>) -> Box<Inner> { in peel_box()
634 // * Box is guaranteed to have representation identical to a (non-null) in peel_box()
647 fn peel_rc(s: Rc<Self>) -> Rc<Inner> { in peel_rc()
670 fn peel_arc(s: Arc<Self>) -> Arc<Inner> { in peel_arc()
706 fn deref(&self) -> &Self::Target { in deref()
715 fn deref_mut(&mut self) -> &mut Self::Target { in deref_mut()
731 fn from(value: Box<T>) -> Self { in from()
734 // SAFETY: Box::into_raw() returns a non-null pointer. in from()
740 /// Re-interprets `Box<T>` as `BoxBytes`.
742 pub fn box_bytes_of<T: NoUninit>(input: Box<T>) -> BoxBytes { in box_bytes_of()
746 /// Re-interprets `BoxBytes` as `Box<T>`.
753 pub fn from_box_bytes<T: AnyBitPattern>(input: BoxBytes) -> Box<T> { in from_box_bytes()
757 /// Re-interprets `BoxBytes` as `Box<T>`.
766 ) -> Result<Box<T>, (PodCastError, BoxBytes)> { in try_from_box_bytes()
786 pub unsafe fn from_raw_parts(ptr: NonNull<u8>, layout: Layout) -> Self { in from_raw_parts()
794 pub fn into_raw_parts(self) -> (NonNull<u8>, Layout) { in into_raw_parts()
800 pub fn layout(&self) -> Layout { in layout()