Version bump (minor): New feature `no_std`. (https://github.com/notflan/stackalloc-rs/pull/1)

Removed unwind protection test for `no_std`: It will always cause an abort, this is expected.

Fortune for stackalloc's current commit: Blessing − 吉
master
Avril 3 years ago
parent ebb4f8d653
commit 391a537107
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,6 +1,6 @@
[package]
name = "stackalloc"
version = "1.1.2"
version = "1.2.0"
homepage = "https://git.flanchan.moe/flanchan/stackalloc-rs"
repository = "https://github.com/notflan/stackalloc-rs"
keywords = ["alloca", "stack", "stack-allocation", "safe"]

@ -11,6 +11,9 @@ However, it is still possible to cause a stack overflow by allocating too much m
# Requirements
The crate works on stable or nightly Rust, but a C99-compliant compiler is required to build.
# Features
* `no_std` - Enabled `no_std` support on nightly toolchains.
# Examples
Allocating a byte buffer on the stack.
```rust

@ -91,7 +91,9 @@
#![cfg_attr(all(feature = "no_std", not(test)), no_std)]
#![cfg_attr(all(feature = "no_std"), feature(core_intrinsics))]
#![cfg_attr(all(feature = "no_std", not(feature="no_unwind_protection")), feature(core_intrinsics))]
// NOTE: This feature `no_unwind_protection` doesn't actually exist at the moment; since a binary crate built with #![no_std] will not be using a stable compiler toolchain. It was just for testing.
#[cfg(all(nightly, test))] extern crate test;
@ -111,7 +113,12 @@ use core::{
ptr,
};
pub mod avec; pub use avec::AVec;
#[cfg(not(feature = "no_std"))]
pub mod avec;
#[cfg(not(feature = "no_std"))]
pub use avec::AVec;
mod ffi;
/// Allocate a runtime length uninitialised byte buffer on the stack, call `callback` with this buffer, and then deallocate the buffer.
@ -206,7 +213,14 @@ where F: FnOnce(&mut [MaybeUninit<u8>]) -> T
#[cfg(feature = "no_std")]
#[cfg(all(feature = "no_std", feature = "no_unwind_protection"))]
unsafe fn catch_unwind<R, F: FnOnce() -> R>(f: F) -> Result<R, ()> {
// Catching unwinds disabled for this build for now since it requires core intrinsics.
Ok(f())
}
#[cfg(all(feature = "no_std", not(feature = "no_unwind_protection")))]
unsafe fn catch_unwind<R, F: FnOnce() -> R>(f: F) -> Result<R, ()>{
union Data<F, R> {

@ -32,6 +32,7 @@ fn exact_size_iter()
}), result);
}
#[cfg(all(nightly, not(feature="no_std")))] // XXX: process will abort on no_std. This is expected, but won't "pass" this test.
#[test]
#[should_panic]
fn unwinding_over_boundary()

Loading…
Cancel
Save