mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
move NonNull into minicore
This commit is contained in:
@@ -119,6 +119,24 @@ pub struct ManuallyDrop<T: PointeeSized> {
|
||||
}
|
||||
impl<T: Copy + PointeeSized> Copy for ManuallyDrop<T> {}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[rustc_layout_scalar_valid_range_start(1)]
|
||||
#[rustc_nonnull_optimization_guaranteed]
|
||||
pub struct NonNull<T: ?Sized> {
|
||||
pointer: *const T,
|
||||
}
|
||||
impl<T: ?Sized> Copy for NonNull<T> {}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[rustc_layout_scalar_valid_range_start(1)]
|
||||
#[rustc_nonnull_optimization_guaranteed]
|
||||
pub struct NonZero<T>(T);
|
||||
|
||||
pub struct Unique<T: ?Sized> {
|
||||
pub pointer: NonNull<T>,
|
||||
pub _marker: PhantomData<T>,
|
||||
}
|
||||
|
||||
#[lang = "unsafe_cell"]
|
||||
#[repr(transparent)]
|
||||
pub struct UnsafeCell<T: PointeeSized> {
|
||||
|
||||
@@ -87,19 +87,6 @@ pub trait Clone: Sized {
|
||||
fn clone(&self) -> Self;
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[rustc_layout_scalar_valid_range_start(1)]
|
||||
#[rustc_nonnull_optimization_guaranteed]
|
||||
pub struct NonNull<T: ?Sized> {
|
||||
pointer: *const T,
|
||||
}
|
||||
impl<T: ?Sized> Copy for NonNull<T> {}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[rustc_layout_scalar_valid_range_start(1)]
|
||||
#[rustc_nonnull_optimization_guaranteed]
|
||||
pub struct NonZero<T>(T);
|
||||
|
||||
// This just stands in for a non-trivial type.
|
||||
pub struct Vec<T> {
|
||||
ptr: NonNull<T>,
|
||||
@@ -107,11 +94,6 @@ pub struct Vec<T> {
|
||||
len: usize,
|
||||
}
|
||||
|
||||
pub struct Unique<T: ?Sized> {
|
||||
pub pointer: NonNull<T>,
|
||||
pub _marker: PhantomData<T>,
|
||||
}
|
||||
|
||||
#[lang = "global_alloc_ty"]
|
||||
pub struct Global;
|
||||
|
||||
|
||||
@@ -31,9 +31,8 @@
|
||||
// this file, but they may be moved into `minicore` if/when other `#[no_core]` tests want to use
|
||||
// them.
|
||||
|
||||
// NOTE: in `core` this type uses `NonNull`.
|
||||
#[lang = "ResumeTy"]
|
||||
pub struct ResumeTy(*mut Context<'static>);
|
||||
pub struct ResumeTy(NonNull<Context<'static>>);
|
||||
|
||||
#[lang = "future_trait"]
|
||||
pub trait Future {
|
||||
|
||||
Reference in New Issue
Block a user