Skip to content

Commit

Permalink
Bumped patch release,updated layout for Cell and UnsafeCell due to ru…
Browse files Browse the repository at this point in the history
…stc bug.

Link to rust bug rust-lang/rust#68206
  • Loading branch information
rodrimati1992 committed Jan 17, 2020
1 parent 04bde8a commit 79d296e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
15 changes: 15 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>`,
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<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
Expand Down
2 changes: 1 addition & 1 deletion abi_stable/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "abi_stable"
version = "0.8.1"
version = "0.8.2"
authors = ["rodrimati1992 <[email protected]>"]
edition="2018"
license = "MIT/Apache-2.0"
Expand Down
18 changes: 11 additions & 7 deletions abi_stable/src/abi_stability/stable_abi_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
) => (
Expand All @@ -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(
Expand Down Expand Up @@ -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" }

/////////////

Expand Down

0 comments on commit 79d296e

Please sign in to comment.