From 675ef795a8a1d50806fdc888e8c54a52e9e0ab1d 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 | 3 +-- 3 files changed, 1 insertion(+), 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..d3aff23 100644 --- a/libcortex_a9/src/sync_channel.rs +++ b/libcortex_a9/src/sync_channel.rs @@ -172,13 +172,12 @@ 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]; + static LIST: [AtomicPtr<$t>; $cap + 1] = [const { AtomicPtr::new(core::ptr::null_mut()); }; $cap + 1]; static WRITE: AtomicUsize = AtomicUsize::new(0); static READ: AtomicUsize = AtomicUsize::new(0); (Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ))