Skip to content

Latest commit

 

History

History
1110 lines (683 loc) · 40.7 KB

Changelog.md

File metadata and controls

1110 lines (683 loc) · 40.7 KB

This is the changelog,summarising changes in each version

Minor changes may be ommited, as well as improvements to documentation.

0.11

0.11.3

Added shallow_clone methods to DynTrait and RObject.

0.11.0

Bumped Minimum Supported Rust Version to 1.61.0, to use trait bounds in const fns.

Bumped edition to 2021.

Added abi_stable::traits::IntoOwned trait.

Breaking: made unsafe function pointers ABI incompatible with safe ones.

Defined the TLFunctionQualifiers type to be forward compatible with detecting more qualifiers on function pointers, like const.

Fixed these types to be covariant instead of invariant over their type parameters:

  • RVec
  • RHashMap
  • RBox
  • RArc

Rewrote RCow to make it covariant instead of invariant, changing how it's represented.

Added RCowVal, RCowStr, and RCowSlice type aliases to make RCow usable.

Now RCow only implements IntoReprRust/AsRef/Borrow for RCowVal, RCowSlice, and RCowStr.

Removed BorrowOwned trait.

Made the comparison traits accept RCows with different type arguments.

Added these conversion impls:

  • From<&'a RVec<T>> for RCowSlice<'a, T>
  • From<&'a Vec<T>> for RCowSlice<'a, T>

Made ImmutableRef a blanket implemented trait, with GetPointerKind<Kind = PK_Reference> as a supertrait.

Removed ImmutableRef::{Target, TARGET} associated items

Removed ImmutableRefOut type alias.

Changed many #[sabi(...)] attributes away from taking string literals for expressions and types:

  • From accessor_bound = "Foo" to accessor_bound = Foo
  • From accessible_if = "FOO" to accessible_if = FOO
  • From bound = "T: Bar" to bound(T: Bar) (container attribute)
  • From bound = "Bar" to bound = Bar (field attribute)
  • From extra_checks = "foo" to extra_checks = foo
  • From kind(Prefix(prefix_ref = "Foo")) to kind(Prefix(prefix_ref = Foo))
  • From kind(Prefix(prefix_fields = "Foo")) to kind(Prefix(prefix_fields = Foo))
  • From kind(WithNonExhaustive(align = "Foo")) to kind(WithNonExhaustive(align = Foo))
  • From kind(WithNonExhaustive(assert_nonexhaustive = "Foo")) to kind(WithNonExhaustive(assert_nonexhaustive = Foo))
  • From kind(WithNonExhaustive(assert_nonexhaustive("Foo", "Bar"))) to kind(WithNonExhaustive(assert_nonexhaustive(Foo, Bar)))
  • From kind(WithNonExhaustive(interface = "Foo")) to kind(WithNonExhaustive(interface = Foo))
  • From kind(WithNonExhaustive(size = "Foo")) to kind(WithNonExhaustive(size = Foo))
  • From missing_field(value = "foo") to missing_field(value = foo)
  • From missing_field(with = "foo") to missing_field(with = foo)
  • From phantom_field = "foo: Bar" to phantom_field(foo: Bar)
  • From phantom_type_param = "Bar" to phantom_type_param = Bar
  • From phantom_const_param = "BAR" to phantom_const_param = BAR
  • From prefix_bound = "T: Bar" to prefix_bound(T: Bar)
  • From prefix_bounds = "T: Bar, U: Baz" to prefix_bounds(T: Bar, U: Baz)
  • From refl(pub_getter = "foo") to refl(pub_getter = foo)
  • From rename = "foo" to rename = foo
  • From tag = "FOO" to tag = FOO
  • From unsafe_change_type = "Foo" to unsafe_change_type = Foo

Improved error messages of #[sabi(...)] helper attributes, needed to transition away from using string literals.

Added #[sabi(kind(Prefix(prefix_ref_docs = "")))] helper attribute, to replace docs of <DerivingType>_Ref type.

Turned test functions generated by the #[sabi(assert_nonexhaustive(..))] helper attribute into static assertions.

Made #[sabi(assert_nonexhaustive(..))] attribute implicit for non-generic enums

Added AlignerFor trait and GetAlignerFor type alias, to query the AlignTo* type for aligning some type to some required alignment constant.

Defined these aligner wrapper types

  • AlignTo256
  • AlignTo512
  • AlignTo1024
  • AlignTo2048
  • AlignTo4096
  • AlignTo8192
  • AlignTo16384
  • AlignTo32768

Removed InterfaceBound trait, replacing it in bounds with InterfaceType.

Added erased_types::RequiredTraits struct and erased_types::MakeRequiredTraits trait

Added abi_stable::type_level::impl_enum::Implementability bound to all InterfaceType associated types.

Added Implementability bound to ImplFrom_::Impl

Removed ImplTrait trait.

Changed DynTrait constructors to return Self, removed interface parameter.

Removed DynTrait constructors that took ImplType types, renamed from_any* constructors to take their place.

Removed DynTrait::downcast*impltype methods.

Removed impl_get_type_info macro.

Added DynTrait::interface method to infer the InterfaceType type parameter.

Renamed SerializeImplType to SerializeType

Removed DynTraitBound trait and GetVWInterface type alias

Removed these fields from TypeInfo: module, package, package_version

Removed associated constants for constructing Implemented and Unimplemented marker types.

Removed DynTrait::from_const's vtable_for parameter.

Made abi_stable::erased_types::VTable_Ref public.

Changed how DynTrait's vtable is constructed to use a new MakeVTable trait, and implementing it on Vtable_Ref.

Removed VTableDT* structs

Removed PrefixRef::const_to_raw_ptr function (to_raw_ptr is a const function).

Removed PointsToPrefixFields, because trait bounds can now be written in const fns.

Removed PrefixRefTrait:PREFIX_FIELDS associated constant

Replaced PointsToPrefixFields parameter from LateStaticRef::from_prefixref with a T: PrefixRefTrait bound.

Removed prefix_type::GetWithMetadata by changing supertraits of PrefixRefTrait to an equivalent bound.

Removed PrefixMetadata, inlined its fields into WithMetadata_

Removed PrefixTypeTrait::METADATA associated constant

Replaced WithMetadata_::new's metadata parameter with T: PrefixTypeTrait<PrefixFields = P> bound

Removed metadata method from PrefixRef

Moved prefix_type::{BoolArray, BoolArrayIter} to new sabi_types::bitarray module, and renamed:

  • BoolArray to BitArray64.
  • BoolArrayIter to BitArray64Iter.

Added sabi_types::bitarray::BooleanEnum unsafe trait, with FALSE and TRUE associated consts, implemented it for bool, IsAccessible, and IsConditional.

Rewrote BitArray64's API, now all its getter/setter methods are const.

Removed BitArray64<IsAccessible> and BitArray64<IsConditional> impls, since they're unnecessary.

Moved field_accessibility and type_layout accessors from PrefixMetadata to WithMetadata_ and PrefixRef

Replaced ImmutableRefTarget parameter from abi_stable::sabi_types::LateStaticRef::from_custom with T: GetPointerKind<Kind = PK_Reference> bounds.

ErasedRootModuleConsts is now RootModuleConsts, replacing the old one that had a phantom M type parameter.

Added abi_stable::library::CheckTypeLayout enum

Changed LibHeader::from_constructor to take function pointer and CheckTypeLayout, and replaced RootModuleConsts<M> param with M: RootModule bound.

Changed GetUTID::UID's type from Constructor to function pointer.

Implemented Unpin unconditionally for RArc

Changed HashetObject to use the type's write_i* and write_u* methods. Both write_i128 and write_u128 still delegate their implementation to write.

Added Default impls for RRwLock/RMutex.

Added ROption::{ok_or, ok_or_else} methods

Added comparison trait impls between RVec<T> and &mut [T]

Added From conversions from &[T] and &mut [T] for RVec<T>

Added Extend<&'a T> impl for RVec<T>

Made Send and Sync unimplemented by default in #[sabi(impl_InterfaceType(...))] helper attribute

Added RTuple*::from_tuple methods.

Added free const fn equivalents of the ImmutableRef trait in the pointer_trait::immutable_ref module.

Made these functions const, conditional on the "rust_1_64" feature:

  • RSliceMut::{as_slice, into_slice}
  • RSlice::as_slice
  • RStr::as_str
  • RString::as_str
  • RVec::as_slice
  • RCow::as_str
  • RCow::as_slice

Added these const functions, which require the "rust_1_64" feature:

  • NulStr::const_to_str
  • NulStr::const_to_str_with_nul

Made these functions unconditionally const:

  • DynTrait::{sabi_as_vtable, sabi_extra_value}
  • LibHeader::{layout, root_mod_consts, version_strings}
  • MovePtr::{from_rmut, from_raw, into_raw, transmute}
  • NonExhaustive::{get_discriminant, transmute_enum, transmute_enum_ref}
  • NonExhaustive constructors
  • ParseVersionError::{new, version_strings}
  • PrefixRef::{prefix, to_raw_ptr}
  • RCmpOrdering::to_ordering
  • RCow::{is_borrowed, is_owned}
  • RMut::{from_raw, as_ptr, into_raw, transmute_into_raw, transmute, as_rref, into_rref}
  • RMut::{get, get_copy, into_ref}
  • RObject::sabi_et_vtable
  • ROption::{as_ref, copied, is_rsome, is_rnone, is_some, is_none}
  • RRef::{get, get_copy, transmute_into_ref}
  • RResult::{as_ref, is_rok, is_ok, is_rerr, is_err}
  • RawValueBox::from_rstring_unchecked
  • RawValueRef::{from_str_unchecked, from_rstr_unchecked, get_rstr}
  • StaticRef::get
  • VersionNumber::{is_compatible, is_loosely_compatible}
  • utils::transmute_reference
  • many abi_stable::type_layout functions

Defined these new const functions

  • RCmpOdering::from_ordering
  • RCow::{from_str, from_slice}

Changed abi_stable::utils::ref_as_nonnull to allow !Sized types

Fixed bug where #[sabi_trait]-generated trait methods with &'a self(where 'a is a parameter of the trait) could be called when the equivalent Rust trait object could not.

Fixed #[sabi_trait] eating trait documentation 👀

Changed #[sabi_trait]-generated docs to link to more referenced items.

Replaced vtable_for parameter of from_const constructor of #[sabi_trait]-generated trait objects with trait bounds.

Removed these #[sabi_trait]-generated items:

  • _Bounds trait: moving the lifetime supertraits to the #[sabi_trait]-annotated trait
  • _MV struct

Made abi_stable::nonexhaustive_enum::GetVTable not have GetEnumInfo as its supertrait

Added InterfaceType supertrait for SerializeEnum and DeserializeEnum

Changed SerializeEnum to take the enum as the parameter, changed from taking NonExhaustive as the parameter.

Renamed abi_stable::nonexhaustive_enum::assert_nonexhaustive function to assert_correct_default_storage.

Added abi_stable::nonexhaustive_enum::assert_correct_storage const function.

Replaced GetEnumInfo::discriminants function with DISCRIMINANTS associated constant.

Renamed GetNonExhaustive to NonExhaustiveMarker

Renamed NonExhaustiveMarker::NonExhaustive assoc type to Marker

Removed DiscrEnumInfo

Removed GetTypeLayoutCtor and TypeLayoutCtor type alias

Removed UNSAFE_EXTERN_FN_LAYOUT and EXTERN_FN_LAYOUT

Replaced ConstGeneric::new's vtable_for parameter with T: StableAbi + Eq + PartialEq + Debug + Send + Sync + 'static bound

Made abi_stable::abi_stability::const_generics private, exporting ConstGeneric in abi_stable::abi_stability::ConstGeneric.

Replaced all uses of TypeLayoutCtor whenever possible with function pointers, using Constructor<&'static TypeLayout'> in types that impl Debug/PartialEq

Made all structs in abi_stable::inline_storage::alignment implement Debug, StableAbi, PartialEq, Eq, Copy, and Clone

Added Eq derive for these types:

  • abi_stable::pointer_trait::CallReferentDrop
  • abi_stable::sabi_types::NulStrError
  • abi_stable::sabi_types::version::ParseVersionError
  • abi_stable::type_layout::{ItemInfo, TLDiscriminant}

Added (mistakenly missing) safety docs to TypeChecker, ImmutableRef traits.

Removed type_identity macro, it became unnecessary for its original use.

Removed nul_str macro

Removed std::library::mangled_root_module_loader_name function.

Minor changes to type layout types:

  • Added F32 and F64 variants to TLPrimitive
  • Removed len field from TLPrimitive::Array

Added const_panic = "0.2" dependency, to have formatted const panics.

Removed once_cell dependency, previously it was only a dependency to keep abi_stable's MSRV to 1.46.0.

Bumped parking_lot public dependency to 0.12.0

Removed all rust_* features up to 1.61.0, making items that require 1.61.0 unconditional

Added "rust_1_64" feature for items that requires that version.

0.10

0.10.5

Fixed warnings since 1.64.0 (which will be errors in the future) in generated code for sabi_trait.

Fixed warnings about unused values.

Restricted version of once_cell dependency to ">=1.0.0, <1.10.0"

Added RVec::append method.

0.10.4

Fixed compatibility with the nightly compiler.

Added StableAbi impl for core::ffi::c_void.

Added ROption::as_deref method.

0.10.3

Bumped Minimum Supported Rust Version to 1.46.0 because fixing support for Rust nightly caused Internal Compiler Errors in older Rust versions.

Added StableAbi impls for f32 and f64.

Fixed error in StableAbi derive caused by using the derive inside a function with the proc_macro_derive_resolution_fallback lint enabled (deny-by-default in nightly).

Deprecated abi_stable::library::mangled_root_module_loader_name function.

Superceeded the mangled_root_module_loader_name function (and uses of it) with these abi_stable::library constants:

  • ROOT_MODULE_LOADER_NAME
  • ROOT_MODULE_LOADER_NAME_WITH_NUL
  • ROOT_MODULE_LOADER_NAME_NULSTR

Added NulStr::{as_ptr, try_from_str} associated functions.

Added ǸulStrError, returned by NulStr::try_from_str

Added PartialEq impls for comparing str and NulStr in both directions.

Added Default, PartialOrd, and Ord impls for NulStr.

Made NulStr::from_str safe, by not requiring no internal nul bytes.

Deprecated nul_str macro.

Added nulstr and nulstr_trunc macros.

Added "rust_latest_stable" feature.

Added LibHeader::ensure_layout method.

Fixed StaticRef::as_prefix doc example.

Added for_examples::PhantModule struct

Added RHashMap::{keys, values} methods for iterating over the map, which return the Keys and Values iterators respectively.

Added Index and IndexMut impls for RSliceMut and RVec

Added Index impl for RSlice

Changed these methods to use R: RangeBounds<usize> instead of [T]: Index<I, Output = [T]> or Index<I, Output = [T]>:

  • RVec::slice
  • RVec::slice_mut
  • RVec::drain

Replaced all Into implementations converting from abi_stable types with From impls converting in the same direction.

Rewrote staticref macro to support more cases of static promotion, this breaks non-inherent-impl uses of the macro(it was documented that this breaking change could happen).

Made libraries loaded with RootModule never be unloaded, previously they were unloaded when the type layout of the root module isn't compatible (this was possibly unsound?).

Formatted documentation examples (all doc examples up to sabi_types were formatted with rustfmt, every one from std_types up to the last module were manually formatted).

Added dependency on paste 1.0

Enabled the "macro_utils" feature of core_extensions

0.10.1

Fixed support for building in ARM, from this pull request: #50 (if this causes other problems with ARM please create an issue!)

0.10.0

Fixed soundness of the code under the Stacked Borrows model, by replacing uses of type-erased & and &muts in trait objects and vtables with RRef and RMut.

Added AsPtr and AsMutPtr traits. implemented for all erasable pointer types.

Reexported crate::erased_types::InterfaceBound in root module

Unimplemented Deref for RRef

Unimplemented Deref and DerefMut for RMut

Replaced all Deref and DerefMut bounds in trait object types with GetPointerKind/AsPtr/AsMutPtr.

Removed RRef::transmute which turns RRef<'a, T> into RRef<'b, U>

Renamed RRef:

  • get_raw: to as_ptr
  • transmute_ref: to transmute
  • cast_into_raw: to transmute_into_raw

Added these RRef methods:

  • get_copy
  • transmute_into_ref

Renamed RMut:

  • get: to into_ref,
  • get_mut: to into_mut,
  • into_raw: to into_raw_mut,
  • cast_into_raw: to transmute_into_raw,

Added these RMut methods:

  • get: this only borrows the RMut
  • get_copy: this only borrows the RMut
  • get_mut: this only borrows the RMut
  • as_ptr
  • as_mut_ptr
  • into_raw
  • transmute
  • transmute_into_raw
  • transmute_into_mut
  • as_rref

Added these functions to MovePtr:

  • from_raw
  • from_rmut
  • transmute

Changes to GetPointerKind:

  • Removed Deref supertrait
  • Added PtrTarget associated type for the same purpose as Deref::Target

Changes to CanTransmuteElement:

  • Added transmute_element_ method
  • Changed impls for references to return RRef and RMut
  • Changed TransmutedPtr bound to AsPtr<PtrTarget = T>

Added these InterfaceTypes in abi_stable::erased_types::interfaces

  • DEIteratorCloneInterface
  • DebugDefEqInterface

Added these #[sabi_trait] pub traits in in abi_stable::erased_types::doc_examples:

  • Doer
  • Action: used in examples of shared inherent functions of #[sabi_trait] trait objects.

Moved docs for proc macros from abi_stable::docs to the item docs.

Added abi_stable::docs::sabi_trait_inherent with documentation for the shared methods of #[sabi_trait] trait objects. This module is linked in generated code to avoid generating too much code.

Added many impls to compare between std and/or abi_stable types in both directions to:

  • RVec
  • RSlice
  • RSliceMut
  • RStr
  • RString
  • RCow

Added the abi_stable::utils::{manuallydrop_as_rmut, manuallydrop_as_raw_mut} utility functions.

Renamed abi_stable::type_level::unerasability module to downcasting, moving it to a separate file.

Renamed TU_Opaque to TD_Opaque and TU_Unerase to TD_CanDowncast.

Renamed IsImplemented trait to Implementability and its VALUE associated constant to IS_IMPLD.

Renamed all *unerase* methods to *downcast*.

Made with_move_ptr and in_move_ptr panic-safe by using guard types that deallocate the pointer on drop (even if a panic happens in the passed-in closure).

Fixed the potential soundness bug where pointers to serde_json::RawValue could change the order of the length and data pointers when transmuted to point to str.

Fixed unsoundness in, discovered by passing -Zmiri-track-raw-pointers flag to miri:

  • MovePtr::into_box: which did zero-sized allocations for zero sized types.
  • NonExhaustive::serialize: which was creating a reference which is only valid for the ScratchSpace field, but the entire NonExhaustive needed to be accessed.
  • ROnce
  • NonExhaustive::serialize_into_proxy
  • RBox::get_move_ptr
  • RString::insert
  • RString::remove
  • RString::retain
  • RVec::drain
  • RVec::retain
  • RVec::truncate

Added "rust_1_51" feature to enable const generics support.

Removed "nightly_const_params" and "all_nightly" features, since const generics have been stable for a while now.

Might not be UB, but fixed anyway:

  • RVec::as_mut_slice
  • <RVec as IntoIterator>::into_iter

Fixed unsoundness when loading library due to transmute from &'static AbiHeader to &'static LibHeader, by adding a AbiHeaderRef pointer, and loading it instead of &'static AbiHeader.

Moved the upgrade method from AbiHeader to AbiHeaderRef

Bumped dependency versions(only listing the braking ones):

  • core_extensions: 1.4
  • libloading: 0.7
  • repr_offset: 0.2

0.9

0.9.2

Added impls of StableAbi for arrays of all sizes, conditional on the "const_params" feature.

Made abi_stable more resilient to changes in how static promotion works.

Documented that staticref only supports declaring inherent associated constants, but doesn't stop compiling anywhere else yet.

Moved continuous integration testing to github.

0.9.1

Fixed a memory safety bug in RString::retain and RVec::retain.

0.9.0

Rewrote how prefix types work. now they aren't by reference, they use static-reference-like types generated for each prefix type (those types have a _Ref suffix by default).

Flattened many module hierarchies in abi_stable, leaving many of those items only exposed where they used to be reexported.

Now #[repr(C, packed)] prefix types are forbidden.

Added a PrefixRef pointer type, which is what the *_Ref types wrap, used as the pointer to the prefix of every prefix type.

Now the #[sabi(kind(Prefix))] takes two optional arguments, prefix_ref and prefix_fields, defaulting to prefix_ref = "<DerivingType>_Ref" and prefix_fields = "<DerivingType>_Fields".

Made the root_module_loader function(declared with the #[export_root_module] attribute) be able to return anything that implements the new IntoRootModuleResult trait, including Result<_, RBoxError_>.

Declared the RootModuleError type and LibraryError::RootModule variant for the errors returned by root module loaders.

Defined the abi_stable::library::development_utils module with helper items for use while developing a dynamic library.

Made Constructor, MovePtr, RRef, NulStr, and StaticRef use NonNull instead of a raw pointer, this allows Options wrapping them to be ffi-safe.

Split off SharedStableAbi trait from StableAbi, now there's PrefixStableAbi and StableAbi, both of which only have GetStaticEquivalent_ in common.

Renamed WithMetadataFor to PrefixMedata, and added accessors for its fields.

Removed PrefixTypeTrait::into_with_metadata method,added PrefixFields and PrefixRef assoc types.

Added staticref macro for declaring StaticRef consts,added StaticRef::leak_value constructor.

Added ImmutableRef marker trait for reference-like types.

Made LateStaticRef generic over the pointer it wraps, using the ImmutableRef trait.

Renamed LateStaticRef::<&T>::initialized to from_ref.

Added the LateStaticRef::<PrefixRef<P>>::from_prefixref constructor.

Added PrefixRefTrait trait for ffi-safe pointers to prefixes.

Added the PointsToPrefixFields marker type, and PrefixRefTrait::PREFIX_FIELDS associated constant to construct it, this type is required for calling LateStaticRef::from_prefixref.

Made RootModule trait have an additional PrefixRefTrait supertrait.

Added the abi_stable::for_examples module, with types used in documentation examples.

Added Send + Sync supertraits to TypeChecker and ExtraChecks

Defined the RMut type to rewrite how #[sabi_trait] passes the method receiver.

Added sabi_as_rref and sabi_as_rmut methods to RObject and DynTrait to get RRef and RMut to the wrapped value.

Made abi_stable testable with miri

Bumped the minimum supported Rust version to 1.41.0.

Updated these public dependencies:

  • core_extensions to "0.1.18"
  • libloading to "0.6.4"
  • parking_lot to "0.11.0"
  • lock_api to "0.4.1"
  • crossbeam-channel to "0.5.0"
  • serde and serde_derive to "1.0.117"

Fixed the lack of # Unsafe docs for some unsafe traits.

Made (small) improvements to all of the documentation.

Added docs to the module that #[sabi_trait] generates, and hid methods in *_MV types (they were not supposed to be public).

Added generated docs for nonexhaustive enums, unhid the generated items, and made the generated constructors #[doc(hidden)} when the variants are.

Removed parameters of assert_nonexhaustive, using std::any::type_name internally instead.

Hid nonexhaustive_enum::GetVTable::VTABLE_REF

Added support for pinning RBox.

Added std::iter::*,Future,Hasher,Error,std::io::*, and std::fmt::Pointer impls for RBox.

Changed impl_get_type_info macro to take a :ty parameter.

Made the fields in InlineStorage types public.

Added associated constants to construct some types in abi_stable::marker_type.

Fixed handling of unsafe trait in #[sabi_trait], before this the unsafe was removed in the generated code.

Fixed an unsoundness bug where LateStaticRef<T> implemented Send + Sync even if T didn't.

Fixed an unsoundness bug where the RBpxErrpr returned from checking the layout of a library could contain references into the unloaded library, by using a new RBorError_::to_formatted_error method to stringify the error.

Changed RBox::{from_fmt, from_debug, to_formatted_error} to take references.

Added check to the declare_root_module_statics macro to safeguard against passing Self.

Fixed(?) the variance of type parameters in #[sabi_trait] generated trait object to be covariant.

Fixed RMutex::get_mut, which caused a memory leak.

Fixed RRwLock::get_mut, which caused a memory leak.

Fixed exporting of abi_stable::prefix_type::BoolArrayIter, before this it was not shown in the docs.

Made MovePtr<T> implement Send and/or Sync when T does.

Added RSliceMut::as_mut_ptr method

Removed the RSliceMut::into_slice_mut method (it was marked for deprecation)

Implemented Send and Sync for the RString and RVec iterators.

Made prefix_type::panic_on_missing_field_val private

Made TagErrorVariant private.

0.8

0.8.3

  • Fixed compilation error in the as_derive_utils crate (a "private" dependency of abi_stable_derive), caused by a single lifetimes error in the nightly and beta channels.

  • Removed the unused skeptic build dependency of abi_stable, since it was unused, and prevented compilation in Rust 1.34.0

0.8.2

Breaking Change(caused by soundness fix in rustc):

This unsoundness bug for all Cell-like std types is going to be solved by making UnsafeCell not propagate niches.

In preparation for this change,this library will not propagate niches from T into *Cell<T>, this will cause runtime errors when loading libraries containing either *Cell type wrapping a type with non-zero optimizations (including references,andNonZero* types), and compile-time errors when putting Option<Cell<NonZero>> in ffi boundaries.

Dynamic libraries built on a previous patch release might have to be built from scratch, if they contain the previously mentioned types in their API.

0.8.0

Added checks when loading dynamic libraries to ensure that Rust doesn't change how it represents zero-sized types in the "C" ABI. This means that in some rare cases,it won't be possible to link dynamic libraries across a certain Rust version because it changed how it represents zero-sized types in the "C" abi.

Added RBoxError::from_debug for constructing an RBoxError from Debug + !Display types.

Added impls of StableAbi for PhantomData of tuples.

Added the abi_stable::marker_type::NonOwningPhantom marker type, which is a more convenient way to have a PhantomData<extern "C"fn()->PhantomData<T>> field PhantomData is returned from the function because of special case support for PhantomData of tuples (eg:PhantomData<(Foo,Bar)>) (tuples don't have a stable abi,but because this is a 1-aligned zero sized type, it doesn't matter).

Fixed potential soundness bug by replacing PhantomData<extern "C" fn( $types )> fields with NonOwningPhantom<$types>.

0.7

0.7.4

Added guidelines for how dynamic libraries can be evolved.

Made version checking for types looser,so that types are cómpatible so long as it's the in the same x.*,* or 0.y.* version (ignoring *).

Added functions to load the AbiHeader of a dynamic library, and to upgrade it to a LibHeader.

Added version_compatibility crates to test that pull-requests to abi_stable don't change the layout of types in an incompatible way.

0.7.3

This version constifies many functions,with some mentioned as requiring Rust 1.39 to be const.

These are the constified functions:

abi_stable::std_types::{
    RSlice::from_ref,
    RSlice::from_slice, //from Rust 1.39 onwards

    RSliceMut::{as_ptr, into_mut_ptr},

    RStr::from_str, //from Rust 1.39 onwards
    RStr::{as_rslice, is_empty},

    RString::{as_ptr, as_rstr, from_utf8_unchecked, new},

    RVec::{as_ptr, as_rslice, is_empty, new},
}

Now rstr!() won't require a literal argument from Rust 1.39 onwards, it can be any &str.

0.7.2

Bug fix:

This fixes the version number for abi_stable that is stored in dynamic libraries to always be the same as abi_stable. Before this fix the version number was 0.6 which means that you'll have to recompile dynamic libraries of previous patch versions(the 0.7.0 and 0.7.1 versions are yanked because of this).

0.7.0

  • Added const fn constructor functions for #[sabi_trait] generated trait objects/DynTrait/RObject.

  • Added RRef<'a,T> type,as a workaround to allow transmuting &T to &().

  • Added StableAbi attributes: #[sabi(bounds=""]:for adding multiple bounds to the StableAbi impl. #[sabi(prefix_bounds=""]:for adding multiple bounds to the PrefixTypeTrait impl. #[sabi(sabi_opaque_fields]: To treat a field as opaque while still requiring it to impl StableAbi. #[sabi(sabi_opaque_fields]: To treat every field as opaque while still requiring them to impl StableAbi. #[sabi(shared_stableabi())]: replaces the default T:StableAbi bound with T:SharedStableAbi #[sabi(phantom_const_param="<expr>")] : This adds <expr> as a virtual const parameter, that is checked for equality like every other const parameter.

  • Added ConstGeneric,to have proper const-generics support, this allows any type that implements Eq+Debug+StableAbi+'static to be used as a const-parameter.

  • Added macros for constructing RVec/Tuple0-4/RStr/RSlice/NulStr

  • Added NulStr,a nul terminated utf8 string slice.

  • Rewrote how type layout constants are represented to be significantly smaller. Most of the optimizations are described in the ffdd68fef8d445d7d91972b0d751db80df887ec4 commit (there were some tweaks after that commit,but it's mostly correct).

  • Now #[sabi_trait]trait Trait:'static{} allows the trait object to be constructed from a non-'static reference to a 'static type, removing lifetime supertraits from Trait in the generated code. Now generates a Trait_Bound trait with all the supertraits(including lifetimes).

  • Renamed #[sabi(field_bound="")] to #[sabi(accessor_bound="")], because it only adds a bound to the accessor methods of prefix types.

  • Merged the abi_stable_derive_lib crate into the abi_stable_derive crate.

  • Changed error reporting in proc macros to report as many errors as possible, pointing at what the cause of the error is.

  • Added reborrowing support to #[sabi_trait] generated trait objects.

  • Changed TypeInfo to use std::any::type_name to print the type in error messages from 1.38 onwards.

  • Renamed DynTrait/RObject unerasure methods for the common case.

  • Split TransmuteElement into the CanTransmuteElement marker trait and the TransmuteElement extension trait

  • Now forbidding type macros,they will be allowed once referenced lifetime can be detected inside macro invocations.

  • Added Debug and Display support in RObject.

  • Added a way to add extra checks to type layouts at load time with #[sabi(extra_checks="")],passing a type that implements ExtraChecks. Replaced uses of #[sabi(tag="...")] by DynTrait/RObject/NonExhaustive.

  • Made it possible to borrow from self in SerializeProxyType.

0.6

0.6.3

  • Added documentation examples to virtually every type/method in abi_stable::{external_types,sabi_types,std_types}

  • Added a few methods/associated functions because examples made it obvious that they were necessary.

  • Changed RBoxError_ downcast methods to downcast through a Box<dyn Error+ ... > if it wraps one.

    This involves a tiny breaking change where downcast now requires std::error::Error to be implemented by the error being downcasted. This breaking change should not be a problem, since RBoxError::{new,from_box,from} requires that the type implements the Error trait, meaning that one can only sensibly downcast to types that implement the trait

  • Added ROnce::NEW associated constant as a workaround for a compiler bug

  • Added abi_stable::inline_storage::alignment::AlignToUsize

0.6.2

  • Added the #[derive(GetStaticEquivalent)] derive macro.

  • Added #[sabi(impl_InterfaceType())] helper attribute to #[derive(StableAbi)] and #[derive(GetStaticEquivalent)].

  • Replaced most uses of impl_InterfaceType!{} with the helper attribute.

  • Added comments explaining abi_stable concepts in examples.

0.6.0

  • Implemented nonexhastive enum derivation and NonExhaustive wrapper type, with documentation on how to use them, and an extra set of example crates in "examples/2_nonexhaustive/*".

  • Rewrote a lot of the code generated by #[sabi_trait]:

    • It now generates a struct Trait_TO instead of a type alias, wrapping the underlying implementation (DynTrait or RObject).

    • Transformed the constructors into associated functions of Trait_TO, adding the Trait_TO::from_sabi to wrap the underlying implementation.

    • Added impls delegating the supertraits to the underlying implementation.

    • Automatically add supertraits of supertraits.

    • Fixed support for Iterator/DoubleEndedIterator, parsing the supertrait bound to detect the Iterator Item type.

    • Replaced Trait_Marker with Trait_Interface<'a,'b,A,B,AssocTypeA,AssocTypeB >.

    • Added erasability:Erasability parameter to constructor functions, to pass TU_Unerasable and TU_Opaque by value(instead of as a type parameter).

  • Added #[StableAbi] attributes:

    • #[sabi(phantom_field="name:type")]

    • #[sabi(phantom_type_param="type")]

    • #[sabi(not_stableabi())]:to accept type parameters that only implement GetStaticEquivalent_

    • #[sabi(unsafe_change_type="SomeType")]:to change the type of the field in the type layout constant.

  • Added #[unsafe_no_layout_constant] attribute to #[export_root_module], to have a abi_stable dynamic library without storing the type layout of the root module.

  • Changed (de)serialization of DynTrait/nonexhaustive enums to use proxy types, an intermediate type that the type is converted from/to in between (de)serializing.

  • Removed where clause in DynTrait type definition. Removed 'borr and IteratorItem associated type from InterfaceBound. Changed IteratorItemOrDefault to get the Iterator Item type of a particular InterfaceType.

  • Allow reborrowed DynTrait to be unerasable in more situations.

  • Added std::error::Error support for DynTrait and #[sabi_trait] traits.

  • Added ffi-safe equivalent of serde_json::value::RawValue, mostly for use as a (de)serialization proxy type.

  • Added GetStaticEquivalent_ to get the 'static equivalent of a type for type checking.

  • Fixed runtime type checking soundness bugs:

    • where using #[sabi(unconstrained())] would cause the type parameter to be ignored when computing the UTypeId for the type. Renamed the attribute to #[sabi(unsafe_unconstrained())].

    • where non-StableAbi fields were treated as opaque, even though the #[sabi(unsafe_opaque_field)] attribute wasn't applied to them.

    • where checking prefix types against the global view didn't return an error when nested fields had errors.

  • Made LibHeader safely usable by reference,required making changes to make it thread safe (it didn't need to be before).

  • Removed bounds from unconditional accessors in prefix_structs.

  • Improved how type layout errors are Displayed,making them significantly more specific, where previously it printed the entire type layout(it could overflow the terminal buffer).

  • Moved abi_stability::type_layout to root module,with abi_stability::tagging inside.

  • Replaced the True/False in InterfaceType associated types with Implemented<Trait> and Unimplemented<Trait>,to improve compile-time error messages.

  • Added #[sabi_extern_fn] attribute,to replace many uses of extern fn foo(){ extern_fn_panic_handling!{} }

  • Removed suffix from RCmpOrdering variants.

  • Moved InlineStorage from sabi_types::rsmallbox to its own top-level module.

  • Added Spans (the region of code tokens come from) to most generated code, to improve error messages from within macro generated code.

0.5

  • Added MovePtr type and OwnedPointer trait,mostly for #[sabi_trait].

  • Implemented #[sabi_trait] attribute for generating ffi-safe trait objects from a trait definition.

  • Implemented RObject,the default backend type of #[sabi_trait].

  • Made generated type layout constants significantly smaller(in the binary), by changing representation of fields and functions to structs of arrays(approximately).

  • Added unchecked versions of library loading methods in LibHeader.

  • Moved example crates to their own numbered subfolders.

  • Added #[sabi_trait] example crate,which implement a basic plugin system.

  • Moved some top-level abi_stable modules (ignored_wrapper,late_static_ref,return_value_equality,version) to sabi_types.

0.4

  • Added basic module reflection,changing a few details of how layout is represented.

  • Created the sabi_extract tool that converts the module structure of an abi_stable dynamic library to json.

  • Streamlined how modules are exported, removing the need to specify the LOADER_FN in the RootModule trait, as well as constructing the module using the RootModule::load_* functions.

  • Changed how the root module is accessed after it's loaded, using the <RootMod as RootModule>::get_module function.

  • Added fn root_module_statics to declare the statics associated with a RootModule, as well as the declare_root_module_statics macro to implement it.

  • Changed RootModule::raw_library_ref to RootModule::get_raw_library , returning the already loaded RawLibrary instead of allowing the user to initialize it themselves.

  • Changed how all libraries are loaded so that the abi_stable version they use can be checked,mentioning the abi_stable version in the returned error.

  • Renamed Library to RawLibrary.

  • Now the RawLibrary is unloaded after layout checking fails, leaking it if layout checking passes instead of doing so when it's loaded.

  • Added #[sabi(refl(pub_getter=" function_name "))] attribute for code generation (using the layout constant for a type), to determine how to access private fields(otherwise they're inaccesible).

  • Renamed export_sabi_module to export_root_module.

  • Added RMutex/RRwLock/ROnce,wrapping parking_lot types.

  • Added ffi-safe wrappers for crossbeam channels.

  • Added support for #[repr()],for enums.

  • Added checking of enum discriminants(supports all integer types up to u64/i64).

  • Renamed LazyStaticRef to LateStaticRef,made if ffi-safe.

0.3

  • Dropped support for 1.33 (no requiring 1.34) due to an ICE caused by associated types in associated constants.

  • Renamed VirtualWrapper to DynTrait,moving I:InterfaceType to second type parameter.

  • Added tags,a dynamically typed data structure used when checking the layout of types at runtime.

  • DynTrait can now be constructed from non-'static types, using DynTrait::from_borrowìng_*.

  • Added conditional accessors to prefix-types, allowing those fields to have any type if disabled (so long as they don't change in size/alignment)

  • Added these conditional traits to DynTrait:

    • Send
    • Sync.
    • Iterator
    • DoubleEndedIterator
    • std::fmt::Write
    • std::io::{Write,Seek,Read,BufRead}
  • Improved documentation of DynTrait,including multiple examples, and how to make a pointer compatible with it.

  • Improved the std_types error types, to be almost the same as the ones in the standard library.

  • Added reborrowing to DynTrait, going from DynTrait<'a,P<()>,I> to DynTrait<'a,&(),I>/DynTrait<'a,&mut (),I> .

  • Added impl_InterfaceType macro to implement InterfaceType, emulating default associated types.

  • Changed RCow to be closer to its standard library equivalent.

  • Added methods/documentation to ROption/RResult.

  • Added RHashMap,with an API very close to the standard HashMap.

0.2

  • Added SharedStableAbi trait to implement prefix-types (vtables and modules).

  • Added a "StaticEquivalent:'static" associated type to StableAbi/SharedStableAbi to construct a type-id from any type,for checking their layout only once

  • Added impl_InterfaceType macro for implementing InterfaceType with default associated types.

  • Tightened safety around phantom type parameters, requiring every type to appear in the layout constant of the type.

  • Implemented prefix-types,for extensible vtables/modules, along with rewriting existing VTables and modules to use them.

  • Implemented private multi-key map for layout checking (it's not public purely for documentation reasons).

  • Moved example crates to example folder

  • Replaced LibraryTrait/ModuleTrait with RootModule trait, only allowing the root module to be exported.

  • Improved example 0,adding a readme, and an example of serializing/deserializing json commands.

  • Added documentation for interactions the library has with unsafe code/ how to write unsafe code that uses the library.

  • Many small changes to documentation.