remove bad_things.rs

This commit is contained in:
missing 2022-06-09 20:53:55 -05:00
parent 6eac2a31f9
commit 9f86e3e85f
2 changed files with 0 additions and 54 deletions

View file

@ -1,50 +0,0 @@
// use std::{fmt::Debug, intrinsics::transmute, mem::{transmute_copy, MaybeUninit, ManuallyDrop}, alloc::{dealloc, Layout}, ptr::drop_in_place};
// trait IsSized {
// type SizedRepr;
// fn is_sized() -> bool;
// }
// impl<T: ?Sized> IsSized for T {
// default type SizedRepr = Box<T>;
// default fn is_sized() -> bool {
// false
// }
// }
// impl<T> IsSized for T {
// type SizedRepr = T;
// fn is_sized() -> bool {
// true
// }
// }
// #[repr(transparent)]
// struct Item<T: ?Sized>(<T as IsSized>::SizedRepr);
// impl<T: ?Sized> Item<T> {
// fn from_box(v: Box<T>) -> Self {
// let ret = if T::is_sized() {
// // SAFETY: #[repr(transparent)], and we know its `SizedRepr` is just `T`
// unsafe { (&*v as *const _ as *const Self).read() }
// let ptr = Box::into_raw(v);
// unsafe { dealloc(ptr.cast(), Layout::for_value_raw(ptr)) }
// } else {
// // SAFETY: #[repr(transparent)], and we know its `SizedRepr` is `Box<T>`
// unsafe { (&v as *const _ as *const Self).read() }
// mem::forget(v);
// };
// ret
// }
// }
// #[test]
// pub fn testing() {
// dbg!(usize::is_sized());
// dbg!(<dyn Debug>::is_sized());
// }

View file

@ -117,9 +117,6 @@
//! [`unsize_stable`]: Vec::unsize_stable
#![cfg_attr(feature = "unstable", feature(coerce_unsized))]
// for `mod bad_things`, still a wip
// #![allow(incomplete_features)]
// #![feature(specialization)]
#![warn(missing_docs)]
#![warn(clippy::pedantic)]
@ -155,7 +152,6 @@ type Coercer<T, U> = for<'a> fn(&'a T) -> &'a U;
mod ptr_ext;
#[allow(clippy::wildcard_imports)]
use ptr_ext::*;
mod bad_things;
/// A heap allocated, dynamic length collection of `?Sized` elements.
///