Skip to content

Commit 37e628f

Browse files
committed
Bumps bincode to 2.0.1
1 parent cc46a3b commit 37e628f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static_assertions = "1"
3535
serde = { version = "1", optional = true }
3636
arbitrary = { version = "1", optional = true }
3737
proptest = { version = "1", optional = true }
38-
bincode = { version = "2.0.0-rc.3", features=["alloc"], optional = true }
38+
bincode = { version = "2.0.1", features=["alloc"], optional = true }
3939

4040
[dev-dependencies]
4141
proptest = "1"

build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
use version_check as rustc;
66

77
fn main() {
8+
println!("cargo:rustc-check-cfg=cfg(needs_allocator_feature)");
9+
println!("cargo:rustc-check-cfg=cfg(has_allocator)");
10+
811
let ac = autocfg::new();
912
let has_feature = Some(true) == rustc::supports_feature("allocator_api");
10-
let has_api = ac.probe_trait("alloc::alloc::Allocator");
13+
let has_api = ac.probe_trait("core::alloc::GlobalAlloc");
1114
if has_feature || has_api {
1215
autocfg::emit("has_allocator");
1316
}

src/bincode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ impl<T: SmartStringMode> Encode for SmartString<T> {
2020
}
2121
}
2222

23-
impl<T: SmartStringMode> Decode for SmartString<T> {
24-
fn decode<D: Decoder>(decoder: &mut D) -> Result<Self, DecodeError> {
25-
let bytes = <Vec<u8> as Decode>::decode(decoder)?;
23+
impl<Context, T: SmartStringMode> Decode<Context> for SmartString<T> {
24+
fn decode<D: Decoder<Context = Context>>(decoder: &mut D) -> Result<Self, DecodeError> {
25+
let bytes: Vec<u8> = <Vec<u8> as Decode<Context>>::decode(decoder)?;
2626
let string = String::from_utf8(bytes).map_err(|e| DecodeError::Utf8 {
2727
inner: e.utf8_error(),
2828
})?;

0 commit comments

Comments
 (0)