Skip to content

Commit 4e960b3

Browse files
Merge #147
147: Implement StableDeref for singleton::Box r=korken89 a=thalesfragoso There was a discussion in the riot channel about what it's needed for a buffer to be DMA safe, where ra_kete came up with this POC: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=339a9a29fb59c080b42b6d77a902acb6 Where it seems that the requirements described in the [Embedonomicon](https://docs.rust-embedded.org/embedonomicon/dma.html#static-bound) doesn't seem to be enough to prevent stack corruption. If that is really the case and we decide to use `StableDeref` instead, then a implementation for Box is very important to be able to easily use it on DMA APIs and a new point release would be necessary. CC @korken89 Co-authored-by: thalesfragoso <thales.fragosoz@gmail.com>
2 parents e3f02b0 + bb712eb commit 4e960b3

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added `StableDeref` implementation for `pool::Box` and `pool::singleton::Box`.
13+
1014
## [v0.5.3] - 2020-01-27
1115

1216
### Added

src/pool/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ unsafe impl<T, S> Send for Box<T, S> where T: Send {}
375375

376376
unsafe impl<T, S> Sync for Box<T, S> where T: Sync {}
377377

378-
unsafe impl<T> stable_deref_trait::StableDeref for Box<T> {}
378+
unsafe impl<T> stable_deref_trait::StableDeref for Box<T> {}
379379

380380
impl<A> AsSlice for Box<A>
381381
where

src/pool/singleton.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ where
160160
}
161161
}
162162

163+
unsafe impl<P: Pool> stable_deref_trait::StableDeref for Box<P> {}
164+
163165
impl<P> fmt::Debug for Box<P>
164166
where
165167
P: Pool,

0 commit comments

Comments
 (0)