summaryrefslogtreecommitdiff
path: root/vendor/ref-cast/src/layout.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ref-cast/src/layout.rs')
-rw-r--r--vendor/ref-cast/src/layout.rs60
1 files changed, 0 insertions, 60 deletions
diff --git a/vendor/ref-cast/src/layout.rs b/vendor/ref-cast/src/layout.rs
deleted file mode 100644
index 55f91f8c..00000000
--- a/vendor/ref-cast/src/layout.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-use core::mem;
-
-#[doc(hidden)]
-pub struct Layout<T: ?Sized>(T);
-
-#[doc(hidden)]
-pub trait LayoutUnsized<T: ?Sized> {
- const SIZE: usize = usize::MAX;
- const ALIGN: usize = usize::MAX;
-}
-
-impl<T: ?Sized> LayoutUnsized<T> for Layout<T> {}
-
-impl<T> Layout<T> {
- pub const SIZE: usize = mem::size_of::<T>();
- pub const ALIGN: usize = mem::align_of::<T>();
-}
-
-#[doc(hidden)]
-#[inline]
-pub fn assert_layout<Outer: ?Sized, Inner: ?Sized>(
- name: &'static str,
- outer_size: usize,
- inner_size: usize,
- outer_align: usize,
- inner_align: usize,
-) {
- if outer_size != inner_size {
- #[cfg(no_intrinsic_type_name)]
- panic!(
- "unexpected size in cast to {}: {} != {}",
- name, outer_size, inner_size,
- );
- #[cfg(not(no_intrinsic_type_name))]
- panic!(
- "unexpected size in cast from {} to {}: {} != {}",
- core::any::type_name::<Inner>(),
- core::any::type_name::<Outer>(),
- inner_size,
- outer_size,
- );
- }
- if outer_align != inner_align {
- #[cfg(no_intrinsic_type_name)]
- panic!(
- "unexpected alignment in cast to {}: {} != {}",
- name, outer_align, inner_align,
- );
- #[cfg(not(no_intrinsic_type_name))]
- panic!(
- "unexpected alignment in cast from {} to {}: {} != {}",
- core::any::type_name::<Inner>(),
- core::any::type_name::<Outer>(),
- inner_align,
- outer_align,
- );
- }
- #[cfg(not(no_intrinsic_type_name))]
- let _ = name;
-}