Skip to content

Commit b58cc84

Browse files
authored
Merge pull request #18 from Disasm/stable-const-fn
Use stable const-fn
2 parents 58c876c + 7f2c565 commit b58cc84

File tree

3 files changed

+0
-31
lines changed

3 files changed

+0
-31
lines changed

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,5 @@ name = "bare-metal"
99
repository = "https://github.com/japaric/bare-metal"
1010
version = "0.2.4"
1111

12-
[features]
13-
const-fn = []
14-
1512
[build-dependencies]
1613
rustc_version = "0.2.3"

ci/script.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ set -euxo pipefail
33
main() {
44
cargo check --target $TARGET
55

6-
if [ $TRAVIS_RUST_VERSION = nightly ]; then
7-
cargo check --target $TARGET --features const-fn
8-
fi
9-
106
if [ $TARGET = x86_64-unknown-linux-gnu ]; then
117
cargo test
128
fi

src/lib.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
33
#![deny(missing_docs)]
44
#![deny(warnings)]
5-
#![cfg_attr(
6-
all(feature = "const-fn", unstable_const_fn),
7-
feature(const_fn)
8-
)]
95
#![no_std]
106

117
use core::cell::UnsafeCell;
@@ -23,23 +19,12 @@ impl<T> Peripheral<T> {
2319
/// Creates a new peripheral
2420
///
2521
/// `address` is the base address of the register block
26-
#[cfg(feature = "const-fn")]
2722
pub const unsafe fn new(address: usize) -> Self {
2823
Peripheral {
2924
address: address as *mut T,
3025
}
3126
}
3227

33-
/// Creates a new peripheral
34-
///
35-
/// `address` is the base address of the register block
36-
#[cfg(not(feature = "const-fn"))]
37-
pub unsafe fn new(address: usize) -> Self {
38-
Peripheral {
39-
address: address as *mut T,
40-
}
41-
}
42-
4328
/// Borrows the peripheral for the duration of a critical section
4429
pub fn borrow<'cs>(&self, _ctxt: &'cs CriticalSection) -> &'cs T {
4530
unsafe { &*self.get() }
@@ -81,20 +66,11 @@ pub struct Mutex<T> {
8166

8267
impl<T> Mutex<T> {
8368
/// Creates a new mutex
84-
#[cfg(feature = "const-fn")]
8569
pub const fn new(value: T) -> Self {
8670
Mutex {
8771
inner: UnsafeCell::new(value),
8872
}
8973
}
90-
91-
/// Creates a new mutex
92-
#[cfg(not(feature = "const-fn"))]
93-
pub fn new(value: T) -> Self {
94-
Mutex {
95-
inner: UnsafeCell::new(value),
96-
}
97-
}
9874
}
9975

10076
impl<T> Mutex<T> {

0 commit comments

Comments
 (0)