Skip to content

Commit 0bee231

Browse files
authored
Remove deprecated FromBytes::(mut_)slice_from items (#1923)
These are causing PMEs in the presence of `-C link-dead-code`, which casues them to be monomorphized for `Self = ()`, thus producing the problematic ZSTy DST `[()]`. Also bumps version to 0.8.6. Ref rust-lang/rust#131793 Fixes #1867
1 parent c5fb5aa commit 0bee231

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
[package]
1616
edition = "2021"
1717
name = "zerocopy"
18-
version = "0.8.5"
18+
version = "0.8.6"
1919
authors = ["Joshua Liebow-Feeser <joshlf@google.com>"]
2020
description = "Zerocopy makes zero-cost memory manipulation effortless. We write \"unsafe\" so you don't have to."
2121
categories = ["embedded", "encoding", "no-std::no-alloc", "parsing", "rust-patterns"]
@@ -77,13 +77,13 @@ std = ["alloc"]
7777
__internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd", "std"]
7878

7979
[dependencies]
80-
zerocopy-derive = { version = "=0.8.5", path = "zerocopy-derive", optional = true }
80+
zerocopy-derive = { version = "=0.8.6", path = "zerocopy-derive", optional = true }
8181

8282
# The "associated proc macro pattern" ensures that the versions of zerocopy and
8383
# zerocopy-derive remain equal, even if the 'derive' feature isn't used.
8484
# See: https://github.com/matklad/macro-dep-test
8585
[target.'cfg(any())'.dependencies]
86-
zerocopy-derive = { version = "=0.8.5", path = "zerocopy-derive" }
86+
zerocopy-derive = { version = "=0.8.6", path = "zerocopy-derive" }
8787

8888
[dev-dependencies]
8989
itertools = "0.11"
@@ -97,6 +97,6 @@ testutil = { path = "testutil" }
9797
# CI test failures.
9898
trybuild = { version = "=1.0.89", features = ["diff"] }
9999
# In tests, unlike in production, zerocopy-derive is not optional
100-
zerocopy-derive = { version = "=0.8.5", path = "zerocopy-derive" }
100+
zerocopy-derive = { version = "=0.8.6", path = "zerocopy-derive" }
101101
# TODO(#381) Remove this dependency once we have our own layout gadgets.
102102
elain = "0.3.0"

src/lib.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4544,17 +4544,6 @@ pub unsafe trait FromBytes: FromZeros {
45444544
Self::mut_from_bytes(source).ok()
45454545
}
45464546

4547-
#[deprecated(since = "0.8.0", note = "`FromBytes::ref_from_bytes` now supports slices")]
4548-
#[doc(hidden)]
4549-
#[must_use = "has no side effects"]
4550-
#[inline(always)]
4551-
fn slice_from(source: &[u8]) -> Option<&[Self]>
4552-
where
4553-
Self: Sized + Immutable,
4554-
{
4555-
<[Self]>::ref_from_bytes(source).ok()
4556-
}
4557-
45584547
#[deprecated(since = "0.8.0", note = "renamed to `FromBytes::ref_from_prefix_with_elems`")]
45594548
#[doc(hidden)]
45604549
#[must_use = "has no side effects"]
@@ -4577,17 +4566,6 @@ pub unsafe trait FromBytes: FromZeros {
45774566
<[Self]>::ref_from_suffix_with_elems(source, count).ok()
45784567
}
45794568

4580-
#[deprecated(since = "0.8.0", note = "`FromBytes::mut_from_bytes` now supports slices")]
4581-
#[must_use = "has no side effects"]
4582-
#[doc(hidden)]
4583-
#[inline(always)]
4584-
fn mut_slice_from(source: &mut [u8]) -> Option<&mut [Self]>
4585-
where
4586-
Self: Sized + IntoBytes,
4587-
{
4588-
<[Self]>::mut_from_bytes(source).ok()
4589-
}
4590-
45914569
#[deprecated(since = "0.8.0", note = "renamed to `FromBytes::mut_from_prefix_with_elems`")]
45924570
#[doc(hidden)]
45934571
#[must_use = "has no side effects"]

zerocopy-derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[package]
1010
edition = "2021"
1111
name = "zerocopy-derive"
12-
version = "0.8.5"
12+
version = "0.8.6"
1313
authors = ["Joshua Liebow-Feeser <joshlf@google.com>"]
1414
description = "Custom derive for traits from the zerocopy crate"
1515
license = "BSD-2-Clause OR Apache-2.0 OR MIT"

0 commit comments

Comments
 (0)