Skip to content

Commit

Permalink
Better diagnostics (#88)
Browse files Browse the repository at this point in the history
better diagnostics
lift some dependencies
  • Loading branch information
avl authored Oct 27, 2024
1 parent f1d2716 commit 7612fa9
Show file tree
Hide file tree
Showing 13 changed files with 170 additions and 112 deletions.
71 changes: 24 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ See the docs for more information, including schema-versioning: https://docs.rs/

# Changelog

## 0.18.2

Better diagnostics for async functions with reference parameters.
Also, upgrading some dependencies.

## 0.18.1

Minor improvements to documentation.
Expand All @@ -88,7 +93,7 @@ Minor improvements to documentation.
WARNING! When it comes to savefile-abi calls, 0.18.x is not fully binary compatible with 0.17.x. For
regular data serialization, there should be no incompatibility.

The major new feature in 0.18.1 is the support for returning boxed futures in SavefileAbi, and support
The major new feature in 0.18 is the support for returning boxed futures in SavefileAbi, and support
for the #[async_trait] attribute macro.

This allows exposing async API:s more easily using SavefileAbi.
Expand Down
6 changes: 3 additions & 3 deletions compile_tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion savefile-abi-min-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ savefile-abi = { path = "../savefile-abi" }
savefile-derive = {path = "../savefile-derive"}
tokio = { version = "1.40", features=["macros", "rt-multi-thread", "time"] }
tokio-util="0.7"
async-trait = "0.1"
async-trait = "=0.1.83"
8 changes: 4 additions & 4 deletions savefile-abi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "savefile-abi"
version = "0.18.1"
version = "0.18.2"
edition = "2021"
authors = ["Anders Musikka <[email protected]>"]
documentation = "https://docs.rs/savefile-abi/"
Expand All @@ -17,8 +17,8 @@ keywords = ["dylib", "dlopen", "ffi"]
license = "MIT/Apache-2.0"

[dependencies]
savefile = { path="../savefile", version = "=0.18.1" }
savefile-derive = { path="../savefile-derive", version = "=0.18.1" }
savefile = { path="../savefile", version = "=0.18.2" }
savefile-derive = { path="../savefile-derive", version = "=0.18.2" }
byteorder = "1.4"
libloading = "0.8"

Expand All @@ -31,4 +31,4 @@ rust1_78=[]
async-trait = "0.1"

[build-dependencies]
rustc_version="0.2"
rustc_version="0.4"
13 changes: 8 additions & 5 deletions savefile-abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,14 @@ impl TraitObject {
}
}
/// Convert the given fat pointer to a TraitObject instance.
#[inline]
pub fn new_from_ptr<T: ?Sized>(raw: *const T) -> TraitObject {
assert_eq!(
debug_assert_eq!(
std::mem::size_of::<*const T>(),
16,
"TraitObject::new_from_ptr() must only be used with dyn trait, not any other kind of trait"
);
assert_eq!(std::mem::size_of::<TraitObject>(), 16);
debug_assert_eq!(std::mem::size_of::<TraitObject>(), 16);

let mut trait_object = TraitObject::zero();

Expand All @@ -625,14 +626,15 @@ impl TraitObject {
}
/// Note: This only works for boxed dyn Trait.
/// T must be `dyn SomeTrait`.
#[inline]
pub fn new<T: ?Sized>(input: Box<T>) -> TraitObject {
let raw = Box::into_raw(input);
assert_eq!(
debug_assert_eq!(
std::mem::size_of::<*mut T>(),
16,
"TraitObject::new() must only be used with Boxed dyn trait, not any other kind of Box"
);
assert_eq!(std::mem::size_of::<TraitObject>(), 16);
debug_assert_eq!(std::mem::size_of::<TraitObject>(), 16);

let mut trait_object = TraitObject::zero();

Expand Down Expand Up @@ -724,8 +726,9 @@ impl PackagedTraitObject {
/// T must implement AbiExportable, which means it has an ::ABI_ENTRY associated
/// type that gives the entry point.
/// Note, we use `*const T` here even for mutable cases, but it doesn't matter
/// since it's never used, it's just cast to other stuff and then finally
/// since it's never dereferenced, it's just cast to other stuff and then finally
/// back to the right type.
#[inline]
pub fn new_from_ptr<T>(r: *const T) -> PackagedTraitObject
where
T: AbiExportable + ?Sized,
Expand Down
2 changes: 1 addition & 1 deletion savefile-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "savefile-derive"
version = "0.18.1"
version = "0.18.2"
authors = ["Anders Musikka <[email protected]>"]
repository = "https://github.com/avl/savefile"
rust-version = "1.74"
Expand Down
Loading

0 comments on commit 7612fa9

Please sign in to comment.