Skip to content

Commit

Permalink
Merge #2215
Browse files Browse the repository at this point in the history
2215: remove all uses of unstable const_in_array_repeat_expressions feature r=bradjc a=hudson-ayers

### Pull Request Overview

This pull request removes all uses of the unstable `const_in_array_repeat_expressions` feature. It was originally necessary in order to have ergonomic scheduler components, but a subset of the feature that is sufficient for our use was accidentally stabilized, and the Rust maintainers are moving to make that stabilization permanent (see rust-lang/rust#79270). So this is an easy way to get rid of an unstable feature.


### Testing Strategy

This pull request was tested by compiling and flashing several apps on an Imix.


### TODO or Help Wanted

N/A

### Documentation Updated

- [x] No updates are required.

### Formatting

- [x] Ran `make prepush`.


Co-authored-by: Hudson Ayers <hayers@stanford.edu>
  • Loading branch information
bors[bot] and hudson-ayers committed Dec 2, 2020
2 parents 40d7961 + 60fb214 commit b939473
Show file tree
Hide file tree
Showing 20 changed files with 7 additions and 21 deletions.
1 change: 0 additions & 1 deletion boards/acd52832/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use capsules::virtual_alarm::VirtualMuxAlarm;
Expand Down
2 changes: 1 addition & 1 deletion boards/arty_e21/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_fn, const_in_array_repeat_expressions)]
#![feature(const_fn)]

use arty_e21_chip::chip::ArtyExxDefaultPeripherals;
use capsules::virtual_alarm::{MuxAlarm, VirtualMuxAlarm};
Expand Down
1 change: 0 additions & 1 deletion boards/components/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![no_std]
#![feature(const_in_array_repeat_expressions)]

pub mod adc;
pub mod alarm;
Expand Down
3 changes: 2 additions & 1 deletion boards/components/src/sched/cooperative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ macro_rules! coop_component_helper {
use core::mem::MaybeUninit;
use kernel::static_buf;
use kernel::CoopProcessNode;
static mut BUF: [MaybeUninit<CoopProcessNode<'static>>; $N] = [MaybeUninit::uninit(); $N];
const UNINIT: MaybeUninit<CoopProcessNode<'static>> = MaybeUninit::uninit();
static mut BUF: [MaybeUninit<CoopProcessNode<'static>>; $N] = [UNINIT; $N];
&mut BUF
};};
}
Expand Down
3 changes: 2 additions & 1 deletion boards/components/src/sched/mlfq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ macro_rules! mlfq_component_helper {
static mut BUF1: MaybeUninit<VirtualMuxAlarm<'static, $A>> = MaybeUninit::uninit();
static mut BUF2: MaybeUninit<MLFQSched<'static, VirtualMuxAlarm<'static, $A>>> =
MaybeUninit::uninit();
static mut BUF3: [MaybeUninit<MLFQProcessNode<'static>>; $N] = [MaybeUninit::uninit(); $N];
const UNINIT: MaybeUninit<MLFQProcessNode<'static>> = MaybeUninit::uninit();
static mut BUF3: [MaybeUninit<MLFQProcessNode<'static>>; $N] = [UNINIT; $N];
(&mut BUF1, &mut BUF2, &mut BUF3)
};};
}
Expand Down
4 changes: 2 additions & 2 deletions boards/components/src/sched/round_robin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ macro_rules! rr_component_helper {
use core::mem::MaybeUninit;
use kernel::static_buf;
use kernel::RoundRobinProcessNode;
static mut BUF: [MaybeUninit<RoundRobinProcessNode<'static>>; $N] =
[MaybeUninit::uninit(); $N];
const UNINIT: MaybeUninit<RoundRobinProcessNode<'static>> = MaybeUninit::uninit();
static mut BUF: [MaybeUninit<RoundRobinProcessNode<'static>>; $N] = [UNINIT; $N];
&mut BUF
};};
}
Expand Down
1 change: 0 additions & 1 deletion boards/earlgrey-nexysvideo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]

use capsules::virtual_alarm::{MuxAlarm, VirtualMuxAlarm};
use capsules::virtual_hmac::VirtualMuxHmac;
Expand Down
1 change: 0 additions & 1 deletion boards/hail/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use capsules::virtual_alarm::VirtualMuxAlarm;
Expand Down
1 change: 0 additions & 1 deletion boards/hifive1/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]

use capsules::virtual_alarm::{MuxAlarm, VirtualMuxAlarm};
use e310x::chip::E310xDefaultPeripherals;
Expand Down
1 change: 0 additions & 1 deletion boards/imix/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

mod imix_components;
Expand Down
1 change: 0 additions & 1 deletion boards/msp_exp432p401r/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use components::gpio::GpioComponent;
Expand Down
1 change: 0 additions & 1 deletion boards/nano33ble/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use kernel::capabilities;
Expand Down
1 change: 0 additions & 1 deletion boards/nordic/nrf52840_dongle/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use capsules::virtual_alarm::VirtualMuxAlarm;
Expand Down
1 change: 0 additions & 1 deletion boards/nordic/nrf52840dk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![deny(missing_docs)]
#![feature(const_in_array_repeat_expressions)]

use capsules::net::ieee802154::MacAddress;
use capsules::net::ipv6::ip_utils::IPAddr;
Expand Down
1 change: 0 additions & 1 deletion boards/nordic/nrf52dk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use capsules::virtual_alarm::VirtualMuxAlarm;
Expand Down
1 change: 0 additions & 1 deletion boards/nucleo_f429zi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use capsules::virtual_alarm::VirtualMuxAlarm;
Expand Down
1 change: 0 additions & 1 deletion boards/nucleo_f446re/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use capsules::virtual_alarm::VirtualMuxAlarm;
Expand Down
1 change: 0 additions & 1 deletion boards/redboard_artemis_nano/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use apollo3::chip::Apollo3DefaultPeripherals;
Expand Down
1 change: 0 additions & 1 deletion boards/stm32f3discovery/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Disable this attribute when documenting, as a workaround for
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![feature(const_in_array_repeat_expressions)]
#![deny(missing_docs)]

use capsules::lsm303dlhc;
Expand Down
1 change: 0 additions & 1 deletion boards/stm32f412gdiscovery/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![deny(missing_docs)]
#![feature(const_in_array_repeat_expressions)]
use capsules::virtual_alarm::VirtualMuxAlarm;
use components::gpio::GpioComponent;
use components::rng::RngComponent;
Expand Down

0 comments on commit b939473

Please sign in to comment.