From 907edf2752cf8b74ffada66cc179184ba42a6ef8 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Tue, 22 Oct 2024 12:07:15 +0800 Subject: [PATCH] fix const in arr expression --- experiments/src/main.rs | 1 - libcortex_a9/src/lib.rs | 1 - libcortex_a9/src/sync_channel.rs | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/experiments/src/main.rs b/experiments/src/main.rs index d7cc915..c832e80 100644 --- a/experiments/src/main.rs +++ b/experiments/src/main.rs @@ -1,6 +1,5 @@ #![no_std] #![no_main] -#![feature(const_in_array_repeat_expressions)] #![feature(naked_functions)] extern crate alloc; diff --git a/libcortex_a9/src/lib.rs b/libcortex_a9/src/lib.rs index 4d023b1..b124a38 100644 --- a/libcortex_a9/src/lib.rs +++ b/libcortex_a9/src/lib.rs @@ -1,6 +1,5 @@ #![no_std] #![feature(never_type)] -#![feature(const_fn)] extern crate alloc; diff --git a/libcortex_a9/src/sync_channel.rs b/libcortex_a9/src/sync_channel.rs index e21df16..b0b37b6 100644 --- a/libcortex_a9/src/sync_channel.rs +++ b/libcortex_a9/src/sync_channel.rs @@ -172,13 +172,13 @@ impl<'a, T> Iterator for Receiver<'a, T> where T: Clone { #[macro_export] /// Macro for initializing the sync_channel with static buffer and indexes. -/// Note that this requires `#![feature(const_in_array_repeat_expressions)]` macro_rules! sync_channel { ($t: ty, $cap: expr) => { { use core::sync::atomic::{AtomicUsize, AtomicPtr}; use $crate::sync_channel::{Sender, Receiver}; - static LIST: [AtomicPtr<$t>; $cap + 1] = [AtomicPtr::new(core::ptr::null_mut()); $cap + 1]; + const cnst_ptr: AtomicPtr<$t> = AtomicPtr::new(core::ptr::null_mut()); + static LIST: [AtomicPtr<$t>; $cap + 1] = [cnst_ptr; $cap + 1]; static WRITE: AtomicUsize = AtomicUsize::new(0); static READ: AtomicUsize = AtomicUsize::new(0); (Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ))