Skip to content

Commit 0e468eb

Browse files
committed
add a "const-fn" feature
1 parent 7a0ba80 commit 0e468eb

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [v0.5.1] - 2018-05-13
9+
10+
### Added
11+
12+
- An opt-in `"const-fn"` feature that makes `Mutex.new` constructor into a `const fn`. This feature
13+
requires a nightly toolchain.
14+
815
## [v0.5.0] - 2018-05-11
916

1017
### Added
@@ -44,6 +51,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4451
- [breaking-change] removed several fields from `cpuid::RegisterBlock` on ARMv6-M. These registers
4552
are not available on that sub-architecture.
4653

54+
- [breaking-change] The `Mutex.new` constructor is not a `const fn` by default. To make it a `const
55+
fn` you have to opt into the `"const-fn"` feature, which was added in v0.5.1, and switch to a
56+
nightly compiler.
57+
4758
### Removed
4859

4960
- [breaking-change] The `exception` module has been removed. A replacement for `Exception::active`

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords = ["arm", "cortex-m", "register", "peripheral"]
77
license = "MIT OR Apache-2.0"
88
name = "cortex-m"
99
repository = "https://github.com/japaric/cortex-m"
10-
version = "0.5.0"
10+
version = "0.5.1"
1111

1212
[build-dependencies]
1313
cc = "1.0.10"
@@ -19,4 +19,5 @@ volatile-register = "0.2.0"
1919

2020
[features]
2121
cm7-r0p1 = []
22-
inline-asm = []
22+
const-fn = ["bare-metal/const-fn"]
23+
inline-asm = []

ci/script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ main() {
44
cargo check --target $TARGET
55

66
if [ $TRAVIS_RUST_VERSION = nightly ]; then
7-
cargo check --target $TARGET --features inline-asm
7+
cargo check --target $TARGET --features 'const-fn inline-asm'
88
fi
99

1010
case $TARGET in
1111
thumbv7em-none-eabi*)
1212
cargo check --target $TARGET --features cm7-r0p1
1313

1414
if [ $TRAVIS_RUST_VERSION = nightly ]; then
15-
cargo check --target $TARGET --features 'cm7-r0p1 inline-asm'
15+
cargo check --target $TARGET --features 'cm7-r0p1 const-fn inline-asm'
1616
fi
1717
;;
1818

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
//! API docs for details.
3131
//!
3232
//! The disadvantage is that `inline-asm` requires a nightly toolchain.
33+
//!
34+
//! ## `const-fn`
35+
//!
36+
//! Enabling this feature turns the `Mutex.new` constructor into a `const fn`.
37+
//!
38+
//! This feature requires a nightly toolchain.
3339
3440
#![cfg_attr(feature = "inline-asm", feature(asm))]
3541
#![deny(missing_docs)]

0 commit comments

Comments
 (0)