Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ name = "bare-metal"
repository = "https://github.com/japaric/bare-metal"
version = "0.2.4"

[features]
const-fn = []

[build-dependencies]
rustc_version = "0.2.3"
4 changes: 0 additions & 4 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ set -euxo pipefail
main() {
cargo check --target $TARGET

if [ $TRAVIS_RUST_VERSION = nightly ]; then
cargo check --target $TARGET --features const-fn
fi

if [ $TARGET = x86_64-unknown-linux-gnu ]; then
cargo test
fi
Expand Down
24 changes: 0 additions & 24 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

#![deny(missing_docs)]
#![deny(warnings)]
#![cfg_attr(
all(feature = "const-fn", unstable_const_fn),
feature(const_fn)
)]
#![no_std]

use core::cell::UnsafeCell;
Expand All @@ -23,23 +19,12 @@ impl<T> Peripheral<T> {
/// Creates a new peripheral
///
/// `address` is the base address of the register block
#[cfg(feature = "const-fn")]
pub const unsafe fn new(address: usize) -> Self {
Peripheral {
address: address as *mut T,
}
}

/// Creates a new peripheral
///
/// `address` is the base address of the register block
#[cfg(not(feature = "const-fn"))]
pub unsafe fn new(address: usize) -> Self {
Peripheral {
address: address as *mut T,
}
}

/// Borrows the peripheral for the duration of a critical section
pub fn borrow<'cs>(&self, _ctxt: &'cs CriticalSection) -> &'cs T {
unsafe { &*self.get() }
Expand Down Expand Up @@ -81,20 +66,11 @@ pub struct Mutex<T> {

impl<T> Mutex<T> {
/// Creates a new mutex
#[cfg(feature = "const-fn")]
pub const fn new(value: T) -> Self {
Mutex {
inner: UnsafeCell::new(value),
}
}

/// Creates a new mutex
#[cfg(not(feature = "const-fn"))]
pub fn new(value: T) -> Self {
Mutex {
inner: UnsafeCell::new(value),
}
}
}

impl<T> Mutex<T> {
Expand Down