Skip to content
This repository was archived by the owner on Nov 7, 2022. It is now read-only.

Commit fd76eb6

Browse files
qwandorandre-richter
authored andcommitted
Add nightly feature.
Without this the registers module will be disabled, so the crate can build with stable Rust.
1 parent 3ad4f55 commit fd76eb6

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ exclude = [
1919
"Makefile"
2020
]
2121

22+
[features]
23+
default = ["nightly"]
24+
nightly = ["tock-registers"]
25+
2226
[dependencies]
23-
tock-registers = { version = "0.7.x", default-features = false } # Use it as interface-only library.
27+
tock-registers = { version = "0.7.x", default-features = false, optional = true } # Use it as interface-only library.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Low level access to Cortex-A processors.
1212

1313
## Minimum Supported Rust Version
1414

15-
Requires a recent nightly of Rust.
15+
Requires a recent nightly of Rust if the (default) `nightly` feature is enabled. Without this the
16+
register access module is not available.
1617

1718
## Usage
1819

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@
4747
//! code.
4848
//!
4949
//! ```rust
50+
//! # #[cfg(feature = "nightly")]
5051
//! use cortex_a::{asm, registers::*};
52+
//! # #[cfg(feature = "nightly")]
5153
//! use tock_registers::interfaces::Writeable; // <-- Trait needed to use `write()` and `set()`.
5254
//!
5355
//! // Some parts omitted for brevity.
5456
//!
57+
//! # #[cfg(feature = "nightly")]
5558
//! unsafe fn prepare_el2_to_el1_transition(
5659
//! virt_boot_core_stack_end_exclusive_addr: u64,
5760
//! virt_kernel_init_addr: u64,
@@ -82,9 +85,10 @@
8285
//! ARMv8, for ARMv8-A architecture
8386
//! profile](https://static.docs.arm.com/ddi0487/ca/DDI0487C_a_armv8_arm.pdf?_ga=2.266626254.1122218691.1534883460-1326731866.1530967873).
8487
85-
#![feature(core_intrinsics)]
86-
#![feature(custom_inner_attributes)]
88+
#![cfg_attr(feature = "nightly", feature(core_intrinsics))]
89+
#![cfg_attr(feature = "nightly", feature(custom_inner_attributes))]
8790
#![no_std]
8891

8992
pub mod asm;
93+
#[cfg(feature = "nightly")]
9094
pub mod registers;

0 commit comments

Comments
 (0)