Merge #882
882: Remove separation of stable vs. nightly implementations in executor/raw r=Dirbaio a=jannic Since rust 1.61, the required const features are availabe on stable rust Co-authored-by: Jan Niehusmann <jan@gondor.com>
This commit is contained in:
		| @@ -57,7 +57,6 @@ pub struct TaskHeader { | ||||
| } | ||||
|  | ||||
| impl TaskHeader { | ||||
|     #[cfg(feature = "nightly")] | ||||
|     pub(crate) const fn new() -> Self { | ||||
|         Self { | ||||
|             state: AtomicU32::new(0), | ||||
| @@ -72,21 +71,6 @@ impl TaskHeader { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     #[cfg(not(feature = "nightly"))] | ||||
|     pub(crate) fn new() -> Self { | ||||
|         Self { | ||||
|             state: AtomicU32::new(0), | ||||
|             run_queue_item: RunQueueItem::new(), | ||||
|             executor: Cell::new(ptr::null()), | ||||
|             poll_fn: UninitCell::uninit(), | ||||
|  | ||||
|             #[cfg(feature = "time")] | ||||
|             expires_at: Cell::new(Instant::from_ticks(0)), | ||||
|             #[cfg(feature = "time")] | ||||
|             timer_queue_item: timer_queue::TimerQueueItem::new(), | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     pub(crate) unsafe fn enqueue(&self) { | ||||
|         critical_section::with(|cs| { | ||||
|             let state = self.state.load(Ordering::Relaxed); | ||||
| @@ -128,11 +112,9 @@ pub struct TaskStorage<F: Future + 'static> { | ||||
| } | ||||
|  | ||||
| impl<F: Future + 'static> TaskStorage<F> { | ||||
|     #[cfg(feature = "nightly")] | ||||
|     const NEW: Self = Self::new(); | ||||
|  | ||||
|     /// Create a new TaskStorage, in not-spawned state. | ||||
|     #[cfg(feature = "nightly")] | ||||
|     pub const fn new() -> Self { | ||||
|         Self { | ||||
|             raw: TaskHeader::new(), | ||||
| @@ -140,15 +122,6 @@ impl<F: Future + 'static> TaskStorage<F> { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /// Create a new TaskStorage, in not-spawned state. | ||||
|     #[cfg(not(feature = "nightly"))] | ||||
|     pub fn new() -> Self { | ||||
|         Self { | ||||
|             raw: TaskHeader::new(), | ||||
|             future: UninitCell::uninit(), | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /// Try to spawn the task. | ||||
|     /// | ||||
|     /// The `future` closure constructs the future. It's only called if spawning is | ||||
| @@ -210,12 +183,10 @@ unsafe impl<F: Future + 'static> Sync for TaskStorage<F> {} | ||||
| /// Raw storage that can hold up to N tasks of the same type. | ||||
| /// | ||||
| /// This is essentially a `[TaskStorage<F>; N]`. | ||||
| #[cfg(feature = "nightly")] | ||||
| pub struct TaskPool<F: Future + 'static, const N: usize> { | ||||
|     pool: [TaskStorage<F>; N], | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "nightly")] | ||||
| impl<F: Future + 'static, const N: usize> TaskPool<F, N> { | ||||
|     /// Create a new TaskPool, with all tasks in non-spawned state. | ||||
|     pub const fn new() -> Self { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user