Skip to content

Commit

Permalink
Fix issues preventing test suite from passing
Browse files Browse the repository at this point in the history
  • Loading branch information
djkoloski committed Mar 31, 2023
1 parent 1909e6a commit 9e19336
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 30 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ default-members = [
"rkyv_test",
"rkyv_typename",
]

[workspace.package]
version = "0.7.40"
authors = ["David Koloski <[email protected]>"]
Expand All @@ -22,9 +23,9 @@ documentation = "https://docs.rs/rkyv"
repository = "https://github.com/rkyv/rkyv"

[workspace.dependencies]
bytecheck = "0.6.10"
bytecheck = { version = "=0.6.10", default-features = false }
proc-macro2 = "1.0"
ptr_meta = "~0.1.3"
ptr_meta = { version = "~0.1.3", default-features = false }
quote = "1.0"
syn = "1.0"
wasm-bindgen-test = "0.3"
6 changes: 6 additions & 0 deletions release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@

# Copy-paste version

Remember to use tree borrows instead of stacked borrows:

```sh
$env:MIRIFLAGS="-Zmiri-disable-stacked-borrows -Zmiri-tree-borrows"
```

```sh
cargo test --no-default-features --features "size_32" >> results.txt
cargo test --no-default-features --features "size_32 alloc" >> results.txt
Expand Down
4 changes: 2 additions & 2 deletions rkyv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ repository.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bytecheck = { workspace = true, optional = true, default-features = false }
bytecheck = { workspace = true, optional = true }
hashbrown = { version = "0.12", optional = true }
ptr_meta = { workspace = true, default-features = false }
rend = { version = "0.4", optional = true, default-features = false }
rkyv_derive = { path = "../rkyv_derive" }
rkyv_derive = { version = "0.7.41", path = "../rkyv_derive" }
seahash = "4.0"

# Support for various common crates. These are primarily to get users off the ground and build some
Expand Down
15 changes: 15 additions & 0 deletions rkyv/src/impls/alloc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{
string::{ArchivedString, StringResolver},
Archive, Deserialize, DeserializeUnsized, Fallible, Serialize, SerializeUnsized,
};
use ::core::cmp::Ordering;
#[cfg(not(feature = "std"))]
use ::alloc::string::{String, ToString};

Expand Down Expand Up @@ -48,3 +49,17 @@ impl PartialEq<ArchivedString> for String {
PartialEq::eq(other.as_str(), self.as_str())
}
}

impl PartialOrd<ArchivedString> for String {
#[inline]
fn partial_cmp(&self, other: &ArchivedString) -> Option<Ordering> {
self.as_str().partial_cmp(other.as_str())
}
}

impl PartialOrd<String> for ArchivedString {
#[inline]
fn partial_cmp(&self, other: &String) -> Option<Ordering> {
self.as_str().partial_cmp(other.as_str())
}
}
14 changes: 0 additions & 14 deletions rkyv/src/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,6 @@ impl PartialOrd<ArchivedString> for str {
}
}

impl PartialOrd<ArchivedString> for String {
#[inline]
fn partial_cmp(&self, other: &ArchivedString) -> Option<cmp::Ordering> {
self.as_str().partial_cmp(other.as_str())
}
}

impl PartialOrd<String> for ArchivedString {
#[inline]
fn partial_cmp(&self, other: &String) -> Option<cmp::Ordering> {
self.as_str().partial_cmp(other.as_str())
}
}

/// The resolver for `String`.
pub struct StringResolver {
pos: usize,
Expand Down
2 changes: 1 addition & 1 deletion rkyv_bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository.workspace = true

[dependencies]
bincode = "1.3"
bytecheck.workspace = true
bytecheck = { workspace = true, optional = true }
criterion = "0.3"
rand = "0.8"
rand_pcg = "0.3"
Expand Down
6 changes: 3 additions & 3 deletions rkyv_dyn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ bytecheck = { workspace = true, optional = true }
inventory = "0.1"
lazy_static = "1.4"
ptr_meta.workspace = true
rkyv = { path = "../rkyv", default-features = false }
rkyv_dyn_derive = { path = "../rkyv_dyn_derive" }
rkyv_typename = { path = "../rkyv_typename" }
rkyv = { version = "0.7.41", path = "../rkyv", default-features = false }
rkyv_dyn_derive = { version = "0.7.41", path = "../rkyv_dyn_derive" }
rkyv_typename = { version = "0.7.41", path = "../rkyv_typename" }

[features]
default = ["rkyv/size_32", "rkyv/std"]
Expand Down
2 changes: 1 addition & 1 deletion rkyv_dyn_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bytecheck = { workspace = true, optional = true }
bytecheck = { workspace = true, features = ["std"], optional = true }
ptr_meta.workspace = true
rkyv = { path = "../rkyv", default-features = false }
rkyv_dyn = { path = "../rkyv_dyn", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion rkyv_test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(not(feature = "std"), not(feature = "wasm")), no_std)]
#![cfg_attr(
feature = "arbitrary_enum_discriminant",
feature(arbitrary_enum_discriminant)
Expand Down
7 changes: 4 additions & 3 deletions rkyv_test/src/test_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1951,16 +1951,17 @@ mod tests {
};
let mut serializer = DefaultSerializer::default();
serializer.serialize_value(&value).unwrap();
let result = serializer.into_serializer().into_inner();
let archived = unsafe { archived_root::<Test>(result.as_slice()) };
let mut result = serializer.into_serializer().into_inner();
let bytes = unsafe { Pin::new_unchecked(result.as_mut_slice()) };
let archived = unsafe { archived_root_mut::<Test>(bytes) };

unsafe {
assert_eq!(*archived.inner.get(), 100);
*archived.inner.get() = to_archived!(42u32);
assert_eq!(*archived.inner.get(), 42);
}

let deserialized: Test = archived
let deserialized: Test = (&*archived)
.deserialize(&mut DefaultDeserializer::default())
.unwrap();
unsafe {
Expand Down
4 changes: 2 additions & 2 deletions rkyv_typename/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "rkyv_typename"
version = "0.7.33"
description = "Customizable naming for types"
keywords = ["archive", "rkyv", "serialization", "zero-copy", "no_std"]
categories = ["encoding", "no-std"]
readme = "crates-io.md"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
Expand All @@ -13,7 +13,7 @@ repository.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rkyv_typename_derive = { path = "../rkyv_typename_derive" }
rkyv_typename_derive = { version = "0.7.41", path = "../rkyv_typename_derive" }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion rkyv_typename_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rkyv_typename_derive"
version = "0.7.33"
description = "Derive macro for rkyv_typename"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
Expand Down

0 comments on commit 9e19336

Please sign in to comment.