Skip to content

Commit 366a43b

Browse files
ivmarkovBennoLossin
authored andcommitted
Do not require nightly for no_std
1 parent 1f776c0 commit 366a43b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@
236236
237237
#![forbid(missing_docs, unsafe_op_in_unsafe_fn)]
238238
#![cfg_attr(not(feature = "std"), no_std)]
239-
#![feature(allocator_api)]
240-
#![cfg_attr(any(feature = "alloc"), feature(new_uninit))]
241-
#![cfg_attr(any(feature = "alloc"), feature(get_mut_unchecked))]
239+
#![cfg_attr(feature = "alloc", feature(allocator_api))]
240+
#![cfg_attr(feature = "alloc", feature(new_uninit))]
241+
#![cfg_attr(feature = "alloc", feature(get_mut_unchecked))]
242242

243243
#[cfg(feature = "alloc")]
244244
extern crate alloc;
@@ -249,7 +249,6 @@ use alloc::boxed::Box;
249249
use alloc::sync::Arc;
250250

251251
use core::{
252-
alloc::AllocError,
253252
cell::UnsafeCell,
254253
convert::Infallible,
255254
marker::PhantomData,
@@ -259,6 +258,9 @@ use core::{
259258
ptr::{self, NonNull},
260259
};
261260

261+
#[cfg(feature = "alloc")]
262+
use core::alloc::AllocError;
263+
262264
#[doc(hidden)]
263265
pub mod __internal;
264266
#[doc(hidden)]
@@ -1092,6 +1094,7 @@ unsafe impl<T, E> PinInit<T, E> for T {
10921094
}
10931095

10941096
/// Smart pointer that can initialize memory in-place.
1097+
#[cfg(feature = "alloc")]
10951098
pub trait InPlaceInit<T>: Sized {
10961099
/// Use the given pin-initializer to pin-initialize a `T` inside of a new smart pointer of this
10971100
/// type.

0 commit comments

Comments
 (0)