Skip to content

Commit 5f6898f

Browse files
bors[bot]burrbull
andauthored
Merge #502
502: unsafe write_with_zero r=therealprof a=burrbull As 0 is not always correct value, `write_with_zero` can't be safe for all registers. Co-authored-by: Andrey Zgarbul <[email protected]>
2 parents 3d2c79f + 9a59425 commit 5f6898f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3030

3131
### Changed
3232

33+
- [breaking-change] make `write_with_zero` method `unsafe` because the way it is
34+
3335
- [breaking-change] remove `Variant<U, ENUM_A>`, use `Option<ENUM_A>` instead
3436

3537
- split out register size type (`RawType`) from `ResetValue` trait

src/generate/generic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ where
123123
///
124124
/// Similar to `write`, but unused bits will contain 0.
125125
#[inline(always)]
126-
pub fn write_with_zero<F>(&self, f: F)
126+
pub unsafe fn write_with_zero<F>(&self, f: F)
127127
where
128128
F: FnOnce(&mut REG::Writer) -> &mut W<REG>
129129
{

0 commit comments

Comments
 (0)