move NonNull into minicore

This commit is contained in:
Folkert de Vries 2025-11-16 13:13:18 +01:00
parent e1a2ec6051
commit 4fd0dc1050
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 19 additions and 20 deletions

View file

@ -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> {

View file

@ -87,19 +87,6 @@ mod prelude {
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 @@ mod prelude {
len: usize,
}
pub struct Unique<T: ?Sized> {
pub pointer: NonNull<T>,
pub _marker: PhantomData<T>,
}
#[lang = "global_alloc_ty"]
pub struct Global;

View file

@ -31,9 +31,8 @@ async unsafe extern "cmse-nonsecure-entry" fn async_is_not_allowed() {
// 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 {