Skip to content

Commit

Permalink
Merge pull request #42 from rodrimati1992/0.9
Browse files Browse the repository at this point in the history
0.9
  • Loading branch information
rodrimati1992 authored Nov 21, 2020
2 parents 1dbb9a7 + 4adad25 commit 4fdd4ff
Show file tree
Hide file tree
Showing 252 changed files with 8,743 additions and 5,187 deletions.
54 changes: 47 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
language: rust

os:
- osx
- linux
- osx
- windows

matrix:
include:
# - rust: stable
- rust: beta
- rust: nightly
- rust: 1.34.0
- rust: 1.41.0
- rust: nightly
script:
- cd "${TRAVIS_BUILD_DIR}/abi_stable/"
- MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
- echo "Installing latest nightly with Miri"
- echo "$MIRI_NIGHTLY"
- rustup set profile minimal
- rustup default "$MIRI_NIGHTLY"
- rustup override set "$MIRI_NIGHTLY"
- rustup component add miri
- cargo miri setup
- env "MIRIFLAGS=-Zmiri-disable-isolation" cargo miri test --features testing

- cd "${TRAVIS_BUILD_DIR}"
- rm Cargo.lock
- cd "${TRAVIS_BUILD_DIR}/abi_stable/"
- cargo clean
- cargo update -Z minimal-versions
- cd "${TRAVIS_BUILD_DIR}/abi_stable/"
- cargo build

allow_failures:
- rust: nightly


script:

- rustup install beta
Expand All @@ -29,7 +52,13 @@ script:
- cd "${TRAVIS_BUILD_DIR}/examples/2_nonexhaustive/implementation/"
- cargo +beta build

- cd "${TRAVIS_BUILD_DIR}/testing/impl_0/"
- cd "${TRAVIS_BUILD_DIR}/testing/0/impl_0/"
- cargo +beta build

- cd "${TRAVIS_BUILD_DIR}/testing/1 - loading errors/impl_1/"
- cargo +beta build

- cd "${TRAVIS_BUILD_DIR}/testing/1 - loading errors/non_abi_stable_lib/"
- cargo +beta build

- cd "${TRAVIS_BUILD_DIR}/testing/version_compatibility/impl_0"
Expand All @@ -50,7 +79,13 @@ script:
- cd "${TRAVIS_BUILD_DIR}/examples/2_nonexhaustive/implementation/"
- cargo check

- cd "${TRAVIS_BUILD_DIR}/testing/impl_0/"
- cd "${TRAVIS_BUILD_DIR}/testing/0/impl_0/"
- cargo check

- cd "${TRAVIS_BUILD_DIR}/testing/1 - loading errors/impl_1/"
- cargo check

- cd "${TRAVIS_BUILD_DIR}/testing/1 - loading errors/non_abi_stable_lib/"
- cargo check

- cd "${TRAVIS_BUILD_DIR}/abi_stable"
Expand All @@ -60,7 +95,7 @@ script:
- cargo test

- cd "${TRAVIS_BUILD_DIR}/abi_stable"
- cargo test --features sabi_trait_examples
- cargo test --features "testing sabi_trait_examples"

- cd "${TRAVIS_BUILD_DIR}/examples/0_modules_and_interface_types/impl/"
- cargo test
Expand All @@ -74,8 +109,13 @@ script:
- cargo test
- cd "${TRAVIS_BUILD_DIR}/examples/2_nonexhaustive/user/"
- cargo run
- cd "${TRAVIS_BUILD_DIR}/testing/user_0/"
- cd "${TRAVIS_BUILD_DIR}/testing/0/user_0/"
- cargo run
- cd "${TRAVIS_BUILD_DIR}/testing/1 - loading errors/user_1/"
- env "RETURN=ok" cargo run
- env "RETURN=error" cargo run
- env "RETURN=panic" cargo run


- cd "${TRAVIS_BUILD_DIR}/testing/version_compatibility/user_0"
- cargo run
- cargo run --features run
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ members=[
"examples/2_nonexhaustive/interface",
"examples/2_nonexhaustive/implementation",
"examples/2_nonexhaustive/user",
"testing/impl_0",
"testing/interface_0",
"testing/user_0",
"testing/0/impl_0",
"testing/0/interface_0",
"testing/0/user_0",
"testing/1 - loading errors/impl_1",
"testing/1 - loading errors/non_abi_stable_lib",
"testing/1 - loading errors/interface_1",
"testing/1 - loading errors/user_1",
"testing/version_compatibility/interface",
"testing/version_compatibility/impl_0",
"testing/version_compatibility/user_0",
Expand Down
140 changes: 138 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,141 @@
This is the changelog,summarising changes in each version(some minor changes may be ommited).

# 0.9

# 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 `Option`s 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`](https://github.com/rust-lang/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
Expand Down Expand Up @@ -28,9 +164,9 @@ 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 `RBoxError::from_debug` for constructing an `RBoxError` from `Debug + !Display` types.

Added impls of StableAbi for PhantomData of tuples.
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
Expand Down
50 changes: 25 additions & 25 deletions 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.4"
version = "0.9.0"
authors = ["rodrimati1992 <rodrimatt1985@gmail.com>"]
edition="2018"
license = "MIT/Apache-2.0"
Expand All @@ -24,11 +24,7 @@ travis-ci = { repository = "rodrimati1992/abi_stable_crates/" }
[features]
default = ["channels","serde_json"]

rust_1_36=[]

rust_1_38=["rust_1_36"]

rust_1_39=["rust_1_38","abi_stable_derive/rust_1_39"]
rust_1_42=[]

# Enables stuff that requires const generics,use this once const generics are stabilized.
const_params=[]
Expand All @@ -42,37 +38,41 @@ all_nightly=[
nightly_const_params=[]

# Test features,only used internally.
only_new_tests=[]
testing=[]
only_new_tests=["testing"]
sabi_trait_examples=[]
nonexhaustive_examples=[]

channels=["crossbeam-channel"]


[dependencies]
abi_stable_derive= {version="0.8.4",path="../abi_stable_derive"}
abi_stable_shared= {version="0.8.0",path="../abi_stable_shared"}
serde = { version = "1.0.98", features = ["derive"] }
serde_derive = "1.0.98"
libloading = "0.5.2"
parking_lot = "0.9.0"
lock_api = "0.3.1"
generational-arena = "0.2.2"
crossbeam-channel = { version = "0.3.9", optional = true }
serde_json = { version = "1.0.40", features = ["raw_value"], optional = true }
abi_stable_derive= {version="0.9.0",path="../abi_stable_derive"}
abi_stable_shared= {version="0.9.0",path="../abi_stable_shared"}
serde = { version = "1.0.117", features = ["derive"] }
repr_offset = { version = "0.1.1", default_features = false }
serde_derive = "1.0.117"
libloading = "0.6.4"
parking_lot = "0.11.0"
lock_api = "0.4.1"
generational-arena = "0.2.8"
crossbeam-channel = { version = "0.5.0", optional = true }
serde_json = { version = "1.0.59", features = ["raw_value"], optional = true }

[dependencies.core_extensions]
default_features=false
features=["std"]
version="0.1.8"
version= "0.1.18"

[dev-dependencies]
bincode = "1.1.4"
crossbeam-utils = "0.6.6"
serde_json = { version = "1.0.40", features = ["raw_value"] }
rand = "0.7.0"
criterion = "0.2.11"
fnv = "1.0.6"
bincode = "1.3.1"
crossbeam-utils = "0.8.0"
serde_json = { version = "1.0.59", features = ["raw_value"] }
rand = "0.7.3"
criterion = "0.3.3"
hashbrown = "0.9.1"
fnv = "1.0.7"


[build-dependencies]
rustc_version = "0.2"
rustc_version = "0.2.3"
12 changes: 3 additions & 9 deletions abi_stable/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ fn main() {

let rver = rustc_version::version().unwrap();

if Version::new(1, 36, 0) <= rver {
println!("cargo:rustc-cfg=feature=\"rust_1_36\"");
}
if Version::new(1, 38, 0) <= rver {
println!("cargo:rustc-cfg=feature=\"rust_1_38\"");
}
if Version::new(1, 39, 0) <= rver {
println!("cargo:rustc-cfg=feature=\"rust_1_39\"");
if Version::new(1, 42, 0) <= rver {
println!("cargo:rustc-cfg=rust_1_42");
}

let channel=rustc_version::version_meta().unwrap().channel;
if let Channel::Nightly=channel {
println!("cargo:rustc-cfg=feature=\"nightly_rust\"");
}

}
10 changes: 4 additions & 6 deletions abi_stable/src/abi_stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
types and traits related to abi stability.
*/

pub(crate) mod abi_checking;
#[doc(hidden)]
pub mod abi_checking;
pub mod const_generics;
pub mod extra_checks;
pub mod get_static_equivalent;
pub mod stable_abi_trait;


mod layout_tests;

pub use self::{
abi_checking::exported_check_layout_compatibility as check_layout_compatibility,
const_generics::{ConstGeneric,GetConstGenericVTable},
const_generics::{ConstGeneric,ConstGenericVTableFor},
get_static_equivalent::{GetStaticEquivalent_,GetStaticEquivalent},
stable_abi_trait::{StableAbi,SharedStableAbi,AbiConsts,TypeLayoutCtor,GetTypeLayoutCtor},
stable_abi_trait::{StableAbi,PrefixStableAbi,AbiConsts,TypeLayoutCtor,GetTypeLayoutCtor},
};

#[doc(no_inline)]
Expand Down
Loading

0 comments on commit 4fdd4ff

Please sign in to comment.