From 06972c16b0a1a303ffa06750c30cb64f7f97a0e4 Mon Sep 17 00:00:00 2001 From: Per <Per Lindgren> Date: Sat, 30 Dec 2017 16:39:51 +0100 Subject: [PATCH] lock public aligned --- src/dma.rs | 5 ++++- src/lib.rs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dma.rs b/src/dma.rs index 6ebbd25..71a2788 100644 --- a/src/dma.rs +++ b/src/dma.rs @@ -73,6 +73,7 @@ pub struct Dma2Channel6 { // NOTE(packed) workaround for rust-lang/rust#41315 #[repr(packed)] pub struct Buffer<T, CHANNEL> { + #[repr(align(32))] data: UnsafeCell<T>, flag: Cell<BorrowFlag>, state: Cell<State>, @@ -195,7 +196,9 @@ impl<T, CHANNEL> Buffer<T, CHANNEL> { } } - pub(crate) fn lock(&self) -> &T { + // shuould be pub(crate) + /// + pub fn lock(&self) -> &T { assert_eq!(self.state.get(), State::Unlocked); assert_ne!(self.flag.get(), WRITING); diff --git a/src/lib.rs b/src/lib.rs index 5db97dd..72d1e8b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,6 +23,8 @@ #![feature(get_type_id)] #![feature(never_type)] #![feature(unsize)] +#![feature(repr_align)] +#![feature(attr_literals)] #![no_std] extern crate cast; -- GitLab