Skip to content

Commit 4fd0dc1

Browse files
committed
move NonNull into minicore
1 parent e1a2ec6 commit 4fd0dc1

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

tests/auxiliary/minicore.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,24 @@ pub struct ManuallyDrop<T: PointeeSized> {
119119
}
120120
impl<T: Copy + PointeeSized> Copy for ManuallyDrop<T> {}
121121

122+
#[repr(transparent)]
123+
#[rustc_layout_scalar_valid_range_start(1)]
124+
#[rustc_nonnull_optimization_guaranteed]
125+
pub struct NonNull<T: ?Sized> {
126+
pointer: *const T,
127+
}
128+
impl<T: ?Sized> Copy for NonNull<T> {}
129+
130+
#[repr(transparent)]
131+
#[rustc_layout_scalar_valid_range_start(1)]
132+
#[rustc_nonnull_optimization_guaranteed]
133+
pub struct NonZero<T>(T);
134+
135+
pub struct Unique<T: ?Sized> {
136+
pub pointer: NonNull<T>,
137+
pub _marker: PhantomData<T>,
138+
}
139+
122140
#[lang = "unsafe_cell"]
123141
#[repr(transparent)]
124142
pub struct UnsafeCell<T: PointeeSized> {

tests/ui/abi/compatibility.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,31 +87,13 @@ mod prelude {
8787
fn clone(&self) -> Self;
8888
}
8989

90-
#[repr(transparent)]
91-
#[rustc_layout_scalar_valid_range_start(1)]
92-
#[rustc_nonnull_optimization_guaranteed]
93-
pub struct NonNull<T: ?Sized> {
94-
pointer: *const T,
95-
}
96-
impl<T: ?Sized> Copy for NonNull<T> {}
97-
98-
#[repr(transparent)]
99-
#[rustc_layout_scalar_valid_range_start(1)]
100-
#[rustc_nonnull_optimization_guaranteed]
101-
pub struct NonZero<T>(T);
102-
10390
// This just stands in for a non-trivial type.
10491
pub struct Vec<T> {
10592
ptr: NonNull<T>,
10693
cap: usize,
10794
len: usize,
10895
}
10996

110-
pub struct Unique<T: ?Sized> {
111-
pub pointer: NonNull<T>,
112-
pub _marker: PhantomData<T>,
113-
}
114-
11597
#[lang = "global_alloc_ty"]
11698
pub struct Global;
11799

tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ async unsafe extern "cmse-nonsecure-entry" fn async_is_not_allowed() {
3131
// this file, but they may be moved into `minicore` if/when other `#[no_core]` tests want to use
3232
// them.
3333

34-
// NOTE: in `core` this type uses `NonNull`.
3534
#[lang = "ResumeTy"]
36-
pub struct ResumeTy(*mut Context<'static>);
35+
pub struct ResumeTy(NonNull<Context<'static>>);
3736

3837
#[lang = "future_trait"]
3938
pub trait Future {

0 commit comments

Comments
 (0)