Skip to content

Commit

Permalink
Update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
p-avital committed Jul 5, 2024
1 parent b1a28fa commit e3d761a
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 58 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# 36.1.1-rc1 (api=2.0.0, abi=2.0.0)
- BREAKING CHANGES: A large rework of allocation occurred, breaking both API and ABI compatibility with the previous version:
- `RustAlloc` is the new default allocator of `stabby`: this allocator is a simple pointer to a v-table allowing cross-ffi use of Rust's `alloc::GlobalAlloc`.
- This allocator is global, thread-safe, and guaranteed to work properly with pointers passed across the FFI.
- Benchmarks indicate that performance between `RustAlloc` and `LibcAlloc` is equivalent.
- However, it is non-zero-sized, and therefore makes types that don't always shove it into their `AllocPrefix` are slightly bigger when using `RustAlloc` rather than `LibcAlloc`.
- The reason for this change is that `LibcAlloc` isn't available on certain platforms, whereas `RustAlloc` is available on any platform supported by Rust. Importantly, the `wasm32` architecture was unsupported until now.
- The `libc_alloc` module was replaced by the `allocators` module to improve readability.
- While the previous `IAlloc` version was fine to interface with `libc::malloc`'s API, it actually had a few big holes that required patching for custom allocators to be able to do interesting stuff.
- This was unearthed by implementing `RustAlloc`
- The `AllocPrefix`'s location relative to prefixed allocations (such as those used by all of `stabby`'s container types) has changed for types with alignments greater than pointer-size.
- The prefix was previously placed as if the allocation held `Tuple2<AllocPrefix, T>`, meaning that for larger alignments, there could be padding between the prefix and the pointed value.
- This padding has been removed, as it could cause soundness issues when the pointer was opacified, such as for trait objects.
- `stabby::collections::arc_btree`'s types are now ABI-stable.
- `#[stabby::stabby]` can now understand when a type refers to itself to avoid forming proof cycles.
- The `experimental-ctypes` feature-flag was added to mark the integration between `stabby` and `safer-ffi` as experimental.
- Experimental feature-flags and any API/ABI they annotate are allowed to be broken without triggering a `major` update, but a `minor` instead. If you rely on these features, pinning your minor is advised.

# 6.2.2 (api=1.1.1, abi=1.0.0)
- Relax many dependency requirements to help avoid conflicts with crates that pin them

Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ license = " EPL-2.0 OR Apache-2.0"
categories = ["development-tools::ffi", "no-std::no-alloc"]
repository = "https://github.com/ZettaScaleLabs/stabby"
readme = "stabby/README.md"
version = "6.2.2" # Track
version = "36.1.1-rc1" # Track

[workspace.dependencies]
stabby-macros = { path = "./stabby-macros/", version = "6.2.2", default-features = false } # Track
stabby-abi = { path = "./stabby-abi/", version = "6.2.2", default-features = false } # Track
stabby = { path = "./stabby/", version = "6.2.2", default-features = false } # Track
stabby-macros = { path = "./stabby-macros/", version = "36.1.1-rc1", default-features = false } # Track
stabby-abi = { path = "./stabby-abi/", version = "36.1.1-rc1", default-features = false } # Track
stabby = { path = "./stabby/", version = "36.1.1-rc1", default-features = false } # Track

abi_stable = "0.11.0"
libc = "0.2"
Expand Down
4 changes: 2 additions & 2 deletions stabby-abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ description = "stabby's core ABI, you shouldn't add this crate to your dependenc

[features]
default = ["std"]
std = ["libc", "alloc-rs"]
std = ["alloc-rs"]
alloc-rs = []
ctypes = ["stabby-macros/ctypes"]
experimental-ctypes = ["stabby-macros/experimental-ctypes"]
libc = ["dep:libc"]
test = []
serde = ["dep:serde"]
Expand Down
6 changes: 3 additions & 3 deletions stabby-abi/src/enums/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ unsafe impl IStable for BitDeterminant {
type UnusedBits = Array<U0, U254, End>;
type HasExactlyOneNiche = Saturator;
type ContainsIndirections = B0;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = u8;
primitive_report!("BitDeterminant");
}
Expand Down Expand Up @@ -97,7 +97,7 @@ unsafe impl<Offset, Value, Tail: IStable> IStable for ValueIsErr<Offset, Value,
type UnusedBits = Tail::UnusedBits;
type HasExactlyOneNiche = Tail::HasExactlyOneNiche;
type ContainsIndirections = B0;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = ();
primitive_report!("ValueIsErr");
}
Expand Down Expand Up @@ -190,7 +190,7 @@ unsafe impl<Determinant: IStable> IStable for Not<Determinant> {
type UnusedBits = Determinant::UnusedBits;
type HasExactlyOneNiche = Determinant::HasExactlyOneNiche;
type ContainsIndirections = Determinant::ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = Determinant::CType;
primitive_report!("Not", Determinant);
}
Expand Down
14 changes: 7 additions & 7 deletions stabby-abi/src/istable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub unsafe trait IStable: Sized {
type HasExactlyOneNiche: ISaturatingAdd;
/// Whether or not the type contains indirections (pointers, indices in independent data-structures...)
type ContainsIndirections: Bit;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
/// A support mechanism for [`safer-ffi`](https://crates.io/crates/safer-ffi), allowing all [`IStable`] types to also be `safer_ffi::ReprC`
type CType: IStable;
/// A compile-time generated report of the fields of the type, allowing for compatibility inspection.
Expand Down Expand Up @@ -124,7 +124,7 @@ unsafe impl<T: IStable> IStable for NotPod<T> {
type ForbiddenValues = T::ForbiddenValues;
type HasExactlyOneNiche = T::HasExactlyOneNiche;
type UnusedBits = T::UnusedBits;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = T::CType;
primitive_report!("NotPod", T);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ unsafe impl<
type UnusedBits = UnusedBits;
type HasExactlyOneNiche = HasExactlyOneNiche;
type ContainsIndirections = B0;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = ();
primitive_report!("NicheExporter");
}
Expand Down Expand Up @@ -389,7 +389,7 @@ unsafe impl<A: IStable, B: IStable> IStable for FieldPair<A, B> {
<AlignedAfter<B, A::Size> as IStable>::HasExactlyOneNiche,
>;
type ContainsIndirections = <A::ContainsIndirections as Bit>::Or<B::ContainsIndirections>;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = ();
primitive_report!("FP");
}
Expand Down Expand Up @@ -521,7 +521,7 @@ unsafe impl<A: IStable, B: IStable> IStable for Union<A, B> {
type Align = <A::Align as Alignment>::Max<B::Align>;
type HasExactlyOneNiche = B0;
type ContainsIndirections = <A::ContainsIndirections as Bit>::Or<B::ContainsIndirections>;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = <<Self::Align as PowerOf2>::Divide<Self::Size> as IUnsignedBase>::Array<
<Self::Align as Alignment>::AsUint,
>;
Expand All @@ -542,7 +542,7 @@ unsafe impl<T: IStable, Start: Unsigned> IStable for AlignedAfter<T, Start> {
>;
type HasExactlyOneNiche = T::HasExactlyOneNiche;
type ContainsIndirections = T::ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = ();
primitive_report!("FP");
}
Expand All @@ -555,7 +555,7 @@ unsafe impl<T: IStable> IStable for Struct<T> {
<<tyeval!(<T::Size as Unsigned>::NextMultipleOf<T::Align> - T::Size) as IUnsignedBase>::PaddingBitMask as IBitMask>::Shift<T::Size>>;
type HasExactlyOneNiche = Saturator;
type ContainsIndirections = T::ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = ();
primitive_report!("FP");
}
Expand Down
6 changes: 3 additions & 3 deletions stabby-abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ unsafe impl<T, As: IStable> IStable for StableLike<T, As> {
type UnusedBits = As::UnusedBits;
type HasExactlyOneNiche = As::HasExactlyOneNiche;
type ContainsIndirections = As::ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = As::CType;
const ID: u64 = crate::report::gen_id(Self::REPORT);
const REPORT: &'static report::TypeReport = As::REPORT;
Expand Down Expand Up @@ -298,7 +298,7 @@ unsafe impl<
type UnusedBits = End;
type HasExactlyOneNiche = HasExactlyOneNiche;
type ContainsIndirections = ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = ();
primitive_report!("NoNiches");
}
Expand Down Expand Up @@ -351,7 +351,7 @@ unsafe impl<T: IStable, Cond: IStable> IStable for StableIf<T, Cond> {
type UnusedBits = T::UnusedBits;
type HasExactlyOneNiche = T::HasExactlyOneNiche;
type ContainsIndirections = T::ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = T::CType;
const REPORT: &'static report::TypeReport = T::REPORT;
const ID: u64 = crate::report::gen_id(Self::REPORT);
Expand Down
4 changes: 2 additions & 2 deletions stabby-abi/src/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ macro_rules! define_non_max {
type UnusedBits = <$NonZeroU8 as crate::IStable>::UnusedBits;
type HasExactlyOneNiche = <$NonZeroU8 as crate::IStable>::HasExactlyOneNiche;
type ContainsIndirections = <$NonZeroU8 as crate::IStable>::ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = <$NonZeroU8 as crate::IStable>::CType;
const ID: u64 = $crate::report::gen_id(Self::REPORT);
const REPORT: &'static $crate::report::TypeReport = &$crate::report::TypeReport {
Expand Down Expand Up @@ -159,7 +159,7 @@ macro_rules! define_non_x {
type UnusedBits = <$NonZeroU8 as crate::IStable>::UnusedBits;
type HasExactlyOneNiche = <$NonZeroU8 as crate::IStable>::HasExactlyOneNiche;
type ContainsIndirections = <$NonZeroU8 as crate::IStable>::ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = <$NonZeroU8 as crate::IStable>::CType;
const ID: u64 = $crate::report::gen_id(Self::REPORT);
const REPORT: &'static $crate::report::TypeReport = &$crate::report::TypeReport {
Expand Down
2 changes: 1 addition & 1 deletion stabby-abi/src/padding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ unsafe impl<Left: Unsigned, T: IStable> IStable for Padded<Left, T> {
>;
type HasExactlyOneNiche = Saturator;
type ContainsIndirections = T::ContainsIndirections;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = Tuple<<Left::Padding as IStable>::CType, T::CType>;
const REPORT: &'static report::TypeReport = T::REPORT;
const ID: u64 = crate::report::gen_id(Self::REPORT);
Expand Down
2 changes: 1 addition & 1 deletion stabby-abi/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ where
<<Ok as IDeterminantProvider<Err>>::NicheExporter as IStable>::ForbiddenValues;
type UnusedBits = <<Tuple<Determinant<Ok, Err>, <Self::Align as Alignment>::AsUint> as IStable>::UnusedBits as IBitMask>::BitOr<<<<Ok as IDeterminantProvider<Err>>::NicheExporter as IStable>::UnusedBits as IBitMask>::Shift<<<Determinant<Ok, Err> as IStable>::Size as Unsigned>::NextMultipleOf<Self::Align>>>;
type HasExactlyOneNiche = B0;
#[cfg(feature = "ctypes")]
#[cfg(feature = "experimental-ctypes")]
type CType = <Storage<<Self as IStable>::Size, <Self as IStable>::Align> as IStable>::CType;
const REPORT: &'static crate::report::TypeReport = &crate::report::TypeReport {
name: Str::new("Result"),
Expand Down
Loading

0 comments on commit e3d761a

Please sign in to comment.