diff --git a/experiments/src/main.rs b/experiments/src/main.rs index d7cc915..b6ef65c 100644 --- a/experiments/src/main.rs +++ b/experiments/src/main.rs @@ -1,7 +1,8 @@ #![no_std] #![no_main] -#![feature(const_in_array_repeat_expressions)] #![feature(naked_functions)] +#![feature(asm)] +#![feature(inline_const)] extern crate alloc; diff --git a/libcortex_a9/src/lib.rs b/libcortex_a9/src/lib.rs index 26aa3dd..013d524 100644 --- a/libcortex_a9/src/lib.rs +++ b/libcortex_a9/src/lib.rs @@ -1,8 +1,9 @@ #![no_std] #![feature(never_type)] -#![feature(const_fn)] #![feature(global_asm)] #![feature(asm)] +#![feature(inline_const)] +#![feature(const_fn_trait_bound)] extern crate alloc; diff --git a/libcortex_a9/src/sync_channel.rs b/libcortex_a9/src/sync_channel.rs index e21df16..6910531 100644 --- a/libcortex_a9/src/sync_channel.rs +++ b/libcortex_a9/src/sync_channel.rs @@ -172,13 +172,15 @@ 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 fn new_atomic() -> AtomicPtr<$t> { + AtomicPtr::new(core::ptr::null_mut()) + } + static LIST: [AtomicPtr<$t>; $cap + 1] = [const { new_atomic() }; $cap + 1]; static WRITE: AtomicUsize = AtomicUsize::new(0); static READ: AtomicUsize = AtomicUsize::new(0); (Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ))