From 9c7053d77fa18ac4928869427971f5c6b746c611 Mon Sep 17 00:00:00 2001 From: coolreader18 <969-coolreader18@users.noreply.gitlab.redox-os.org> Date: Tue, 15 Jun 2021 19:53:58 +0000 Subject: [PATCH] Specify feature(const_fn_trait_bound) --- src/io/io.rs | 12 ++++++++---- src/lib.rs | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/io/io.rs b/src/io/io.rs index fb866b5..2c4acd3 100644 --- a/src/io/io.rs +++ b/src/io/io.rs @@ -22,17 +22,19 @@ pub trait Io { } } -pub struct ReadOnly { +pub struct ReadOnly { inner: I } -impl ReadOnly { +impl ReadOnly { pub const fn new(inner: I) -> ReadOnly { ReadOnly { inner: inner } } +} +impl ReadOnly { #[inline(always)] pub fn read(&self) -> I::Value { self.inner.read() @@ -44,17 +46,19 @@ impl ReadOnly { } } -pub struct WriteOnly { +pub struct WriteOnly { inner: I } -impl WriteOnly { +impl WriteOnly { pub const fn new(inner: I) -> WriteOnly { WriteOnly { inner: inner } } +} +impl WriteOnly { #[inline(always)] pub fn write(&mut self, value: I::Value) { self.inner.write(value) diff --git a/src/lib.rs b/src/lib.rs index 09ffda7..60c0c60 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ #![feature(asm)] #![feature(llvm_asm)] -#![feature(const_fn)] // see https://github.com/rust-lang/rfcs/pull/2632 #![cfg_attr(not(test), no_std)] #[cfg(test)]