diff --git a/Changelog.md b/Changelog.md index 57952e02..5542e900 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,21 @@ This is the changelog,summarising changes in each version(some minor changes may # 0.8 +### 0.8.2 + +Breaking Change(caused by soundness fix in rustc): + +[This unsoundness bug for all Cell-like std types](https://github.com/rust-lang/rust/issues/68206) 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`, +this will cause runtime errors when loading libraries containing either `*Cell` type wrapping a type with non-zero optimizations (including references,and`NonZero*` types), +and compile-time errors when putting `Option>` 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 diff --git a/abi_stable/Cargo.toml b/abi_stable/Cargo.toml index b154bf25..68568722 100644 --- a/abi_stable/Cargo.toml +++ b/abi_stable/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "abi_stable" -version = "0.8.1" +version = "0.8.2" authors = ["rodrimati1992 "] edition="2018" license = "MIT/Apache-2.0" diff --git a/abi_stable/src/abi_stability/stable_abi_trait.rs b/abi_stable/src/abi_stability/stable_abi_trait.rs index 4d1df617..44900e1e 100644 --- a/abi_stable/src/abi_stability/stable_abi_trait.rs +++ b/abi_stable/src/abi_stability/stable_abi_trait.rs @@ -1188,10 +1188,13 @@ mod rust_1_36_impls{ ///////////// -macro_rules! impl_sabi_for_transparent { +macro_rules! impl_sabi_for_newtype { + (@trans transparent)=>{ P::IsNonZeroType }; + (@trans C)=>{ False }; ( $type_constr:ident $(where[ $($where_clause:tt)* ])* , + $transparency:ident, $type_name:literal, $mod_path:expr ) => ( @@ -1208,7 +1211,7 @@ macro_rules! impl_sabi_for_transparent { $($($where_clause)*)* { type Kind=ValueKind; - type IsNonZeroType = P::IsNonZeroType; + type IsNonZeroType = impl_sabi_for_newtype!(@trans $transparency); const S_LAYOUT: &'static TypeLayout = { const MONO_TYPE_LAYOUT:&'static MonoTypeLayout=&MonoTypeLayout::new( @@ -1243,11 +1246,12 @@ macro_rules! impl_sabi_for_transparent { } -impl_sabi_for_transparent!{ Wrapping ,"Wrapping" ,"std::num" } -impl_sabi_for_transparent!{ Pin ,"Pin" ,"std::pin" } -impl_sabi_for_transparent!{ ManuallyDrop,"ManuallyDrop","std::mem" } -impl_sabi_for_transparent!{ Cell ,"Cell" ,"std::cell" } -impl_sabi_for_transparent!{ UnsafeCell ,"UnsafeCell" ,"std::cell" } +impl_sabi_for_newtype!{ Wrapping ,transparent,"Wrapping" ,"std::num" } +impl_sabi_for_newtype!{ Pin ,transparent,"Pin" ,"std::pin" } +impl_sabi_for_newtype!{ ManuallyDrop,transparent,"ManuallyDrop","std::mem" } + +impl_sabi_for_newtype!{ Cell ,C,"Cell" ,"std::cell" } +impl_sabi_for_newtype!{ UnsafeCell ,C,"UnsafeCell" ,"std::cell" } /////////////