Skip to content

Commit ed0f84c

Browse files
authored
Merge pull request #56 from rust-embedded/nonsendsync
Fix #55, release v1.2.0.
2 parents 91e8b9e + 7f8536c commit ed0f84c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
No unreleased changes yet
1111

12+
## [v1.2.0] - 2024-10-16
13+
14+
- Soundness fix: ensure the `CriticalSection` token is not `Send` or `Sync`, so that it can only be used in the thread that acquired it. [#55](https://github.com/rust-embedded/critical-section/issues/55)
15+
- Soundness fix: Fix aliasing `&mut` in the `std` implementation. [#46](https://github.com/rust-embedded/critical-section/pull/46)
16+
- Fix build with `restore-state-usize`. [#50](https://github.com/rust-embedded/critical-section/pull/50)
17+
1218
## [v1.1.3] - 2024-08-22
1319

1420
- Added option to use a `usize` sized restore state
@@ -123,8 +129,9 @@ If you're seeing a linker error like `undefined symbol: _critical_section_1_0_ac
123129

124130
- First release
125131

126-
[Unreleased]: https://github.com/rust-embedded/critical-section/compare/v1.1.3...HEAD
127-
[v1.1.2]: https://github.com/rust-embedded/critical-section/compare/v1.1.2...v1.1.3
132+
[Unreleased]: https://github.com/rust-embedded/critical-section/compare/v1.2.0...HEAD
133+
[v1.2.0]: https://github.com/rust-embedded/critical-section/compare/v1.1.3...v1.2.0
134+
[v1.1.3]: https://github.com/rust-embedded/critical-section/compare/v1.1.2...v1.1.3
128135
[v1.1.2]: https://github.com/rust-embedded/critical-section/compare/v1.1.1...v1.1.2
129136
[v1.1.1]: https://github.com/rust-embedded/critical-section/compare/v1.1.0...v1.1.1
130137
[v1.1.0]: https://github.com/rust-embedded/critical-section/compare/v1.0.0...v1.1.0

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "critical-section"
3-
version = "1.1.3"
3+
version = "1.2.0"
44
edition = "2018"
55
description = "Cross-platform critical section"
66
repository = "https://github.com/rust-embedded/critical-section"

src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ pub use self::mutex::Mutex;
1616
#[derive(Clone, Copy, Debug)]
1717
pub struct CriticalSection<'cs> {
1818
_private: PhantomData<&'cs ()>,
19+
20+
// Prevent CriticalSection from being Send or Sync
21+
// https://github.com/rust-embedded/critical-section/issues/55
22+
_not_send_sync: PhantomData<*mut ()>,
1923
}
2024

2125
impl<'cs> CriticalSection<'cs> {
@@ -40,6 +44,7 @@ impl<'cs> CriticalSection<'cs> {
4044
pub unsafe fn new() -> Self {
4145
CriticalSection {
4246
_private: PhantomData,
47+
_not_send_sync: PhantomData,
4348
}
4449
}
4550
}

0 commit comments

Comments
 (0)