Skip to content

Commit fc1329a

Browse files
committed
fix apple compilation with c_alloc, 0.11.3
1 parent f1b1914 commit fc1329a

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

CHANGELOG.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
[//]: # (methinks 1.0.0 soon? maybe im getting ahead of myself though)
99

10-
## Unreleased
10+
## [Unreleased]
11+
12+
---
13+
14+
## [0.11.3]
15+
16+
### Fixed
17+
18+
* Crate failing to compile on Apple systems with the `c_alloc` feature
1119

1220
---
1321

1422
## [0.11.2] - 2026-02-15
1523

1624
### Added
1725

18-
* `ffi::c_alloc::MIN_ALIGN`, the current platform's minimum guaranteed alignment returned by implicitly aligned allocation functions
26+
* `ffi::c_alloc::MIN_ALIGN`, the current platform's minimum guaranteed alignment returned by
27+
implicitly aligned allocation functions
1928

2029
### Changed
2130

22-
* `CAlloc` now uses `malloc`/`calloc` when possible instead of explicitly aligned allocation functions
31+
* `CAlloc` now uses `malloc`/`calloc` when possible instead of explicitly aligned allocation
32+
functions
2333

2434
### Fixed
2535

26-
* Crate compiles on Windows with the `c_alloc` feature
27-
* The return code of `posix_memalign` is now handled properly.
36+
* Crate failing to compile on Windows with the `c_alloc` feature
37+
* Return code of `posix_memalign` being discarded
2838

2939
---
3040

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "memapi2"
3-
version = "0.11.2"
3+
version = "0.11.3"
44
edition = "2018"
55
rust-version = "1.46.0"
66
authors = ["echohumm"]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
A small, `no_std`/`no_alloc`-friendly allocation interface for raw buffers, with explicit layouts,
77
split allocator traits, and structured errors.
88

9-
Version: 0.11.2
9+
Version: 0.11.3
1010
MSRV: 1.46.0 (some features require newer compilers or nightly; see [Feature flags](#feature-flags))
1111

1212
## Highlights
@@ -31,14 +31,14 @@ MSRV: 1.46.0 (some features require newer compilers or nightly; see [Feature fla
3131

3232
```toml
3333
[dependencies]
34-
memapi2 = "0.11.2"
34+
memapi2 = "0.11.3"
3535
```
3636

3737
If you want common optional features:
3838

3939
```toml
4040
[dependencies]
41-
memapi2 = { version = "0.11.2", features = ["os_err_reporting"] }
41+
memapi2 = { version = "0.11.3", features = ["os_err_reporting"] }
4242
```
4343

4444
## Example

src/ffi/c_alloc.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ pub unsafe fn c_alloc(align: usize, size: usize) -> (*mut c_void, c_int) {
181181
unsafe fn c_alloc_spec(align: usize, size: usize) -> (*mut c_void, c_int) {
182182
#[cfg(target_vendor = "apple")]
183183
{
184-
if layout.align() > (1 << 31) {
185-
return ptr::null_mut();
184+
if align > (1 << 31) {
185+
// 22 is the errno for EINVAL
186+
return (NULL, 22);
186187
}
187188
}
188189
let mut out = NULL;

0 commit comments

Comments
 (0)