Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ jobs:
# which a particular feature is supported.
"no-zerocopy-simd-x86-avx12-1-89-0",
"no-zerocopy-core-error-1-81-0",
"no-zerocopy-diagnostic-on-unimplemented-1-78-0",
"no-zerocopy-generic-bounds-in-const-fn-1-61-0",
"no-zerocopy-target-has-atomics-1-60-0",
"no-zerocopy-aarch64-simd-1-59-0",
"no-zerocopy-aarch64-simd-be-1-87-0",
"no-zerocopy-panic-in-const-and-vec-try-reserve-1-57-0"
]
target: [
"i686-unknown-linux-gnu",
Expand Down Expand Up @@ -114,18 +109,8 @@ jobs:
features: "--all-features"
- toolchain: "no-zerocopy-core-error-1-81-0"
features: "--all-features"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
features: "--all-features"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
features: "--all-features"
- toolchain: "no-zerocopy-target-has-atomics-1-60-0"
features: "--all-features"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
features: "--all-features"
- toolchain: "no-zerocopy-aarch64-simd-be-1-87-0"
features: "--all-features"
- toolchain: "no-zerocopy-panic-in-const-and-vec-try-reserve-1-57-0"
features: "--all-features"
# Exclude any combination for the zerocopy-derive crate which
# uses zerocopy features.
- crate: "zerocopy-derive"
Expand All @@ -142,44 +127,12 @@ jobs:
toolchain: "no-zerocopy-simd-x86-avx12-1-89-0"
- crate: "zerocopy-derive"
toolchain: "no-zerocopy-core-error-1-81-0"
- crate: "zerocopy-derive"
toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
- crate: "zerocopy-derive"
toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
- crate: "zerocopy-derive"
toolchain: "no-zerocopy-target-has-atomics-1-60-0"
- crate: "zerocopy-derive"
toolchain: "no-zerocopy-aarch64-simd-1-59-0"
- crate: "zerocopy-derive"
toolchain: "no-zerocopy-aarch64-simd-be-1-87-0"
- crate: "zerocopy-derive"
toolchain: "no-zerocopy-panic-in-const-and-vec-try-reserve-1-57-0"
# Exclude stable/wasm since wasm is no longer provided via rustup on
# stable.
- toolchain: "stable"
target: "wasm32-unknown-unknown"
# Exclude non-aarch64 targets from the `no-zerocopy-aarch64-simd-1-59-0`
# toolchain.
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "i686-unknown-linux-gnu"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "x86_64-unknown-linux-gnu"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "arm-unknown-linux-gnueabi"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "powerpc-unknown-linux-gnu"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "powerpc64-unknown-linux-gnu"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "riscv64gc-unknown-linux-gnu"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "s390x-unknown-linux-gnu"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "x86_64-pc-windows-msvc"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "thumbv6m-none-eabi"
- toolchain: "no-zerocopy-aarch64-simd-1-59-0"
target: "wasm32-unknown-unknown"
# Exclude non-aarch64 targets from the `no-zerocopy-aarch64-simd-be-1-87-0`
# toolchain.
- toolchain: "no-zerocopy-aarch64-simd-be-1-87-0"
Expand Down Expand Up @@ -223,50 +176,6 @@ jobs:
target: "thumbv6m-none-eabi"
- toolchain: "no-zerocopy-core-error-1-81-0"
target: "wasm32-unknown-unknown"
# Exclude most targets from the
# `no-zerocopy-diagnostic-on-unimplemented-1-78-0` toolchain since the
# `no-zerocopy-diagnostic-on-unimplemented-1-78-0` feature is unrelated to
# compilation target. This only leaves i686 and x86_64 targets.
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "arm-unknown-linux-gnueabi"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "aarch64-unknown-linux-gnu"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "powerpc-unknown-linux-gnu"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "powerpc64-unknown-linux-gnu"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "riscv64gc-unknown-linux-gnu"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "s390x-unknown-linux-gnu"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "x86_64-pc-windows-msvc"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "thumbv6m-none-eabi"
- toolchain: "no-zerocopy-diagnostic-on-unimplemented-1-78-0"
target: "wasm32-unknown-unknown"
# Exclude most targets from the
# `no-zerocopy-generic-bounds-in-const-fn-1-61-0` toolchain since the
# `no-zerocopy-generic-bounds-in-const-fn-1-61-0` feature is unrelated to
# compilation target. This only leaves i686 and x86_64 targets.
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "arm-unknown-linux-gnueabi"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "aarch64-unknown-linux-gnu"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "powerpc-unknown-linux-gnu"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "powerpc64-unknown-linux-gnu"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "riscv64gc-unknown-linux-gnu"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "s390x-unknown-linux-gnu"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "x86_64-pc-windows-msvc"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "thumbv6m-none-eabi"
- toolchain: "no-zerocopy-generic-bounds-in-const-fn-1-61-0"
target: "wasm32-unknown-unknown"
# Exclude `thumbv6m-none-eabi` combined with any feature that implies
# the `std` feature since `thumbv6m-none-eabi` does not include a
# pre-compiled std.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

39 changes: 14 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[package]
edition = "2021"
name = "zerocopy"
version = "0.8.48"
version = "0.9.0-alpha.1"
authors = [
"Joshua Liebow-Feeser <joshlf@google.com>",
"Jack Wrenn <jswrenn@amazon.com>",
Expand All @@ -31,7 +31,8 @@ categories = [
keywords = ["cast", "convert", "transmute", "transmutation", "type-punning"]
license = "BSD-2-Clause OR Apache-2.0 OR MIT"
repository = "https://github.com/google/zerocopy"
rust-version = "1.56.0"
# WARNING: Consult with the Rust for Linux project before increasing.
rust-version = "1.78.0"

exclude = [".*"]

Expand Down Expand Up @@ -64,43 +65,31 @@ no-zerocopy-simd-x86-avx12-1-89-0 = "1.89.0"
# From 1.81.0, Rust supports the `core::error::Error` trait.
no-zerocopy-core-error-1-81-0 = "1.81.0"

# From 1.78.0, Rust supports the `#[diagnostic::on_unimplemented]` attribute.
no-zerocopy-diagnostic-on-unimplemented-1-78-0 = "1.78.0"

# From 1.61.0, Rust supports generic types with trait bounds in `const fn`.
no-zerocopy-generic-bounds-in-const-fn-1-61-0 = "1.61.0"

# From 1.60.0, Rust supports `cfg(target_has_atomics)`, which allows us to
# detect whether a target supports particular sets of atomics.
no-zerocopy-target-has-atomics-1-60-0 = "1.60.0"

# When the "simd" feature is enabled, include SIMD types from the
# `core::arch::aarch64` module, which was stabilized in 1.59.0. On earlier Rust
# versions, these types require the "simd-nightly" feature.
no-zerocopy-aarch64-simd-1-59-0 = "1.59.0"

# Include SIMD types from `core::arch::aarch64` on big endian targets. Prior to
# 1.87.0 (https://github.com/rust-lang/rust/pull/136831) the types were only
# correct on little endian and backed off from stable in a breaking change.
no-zerocopy-aarch64-simd-be-1-87-0 = "1.87.0"

# Permit panicking in `const fn`s and calling `Vec::try_reserve`.
no-zerocopy-panic-in-const-and-vec-try-reserve-1-57-0 = "1.57.0"

[package.metadata.ci]
# The versions of the stable and nightly compiler toolchains to use in CI.
pinned-stable = "1.93.1"
pinned-nightly = "nightly-2026-01-25"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition", "--extend-css", "rustdoc/style.css"]
rustdoc-args = [
"--cfg",
"doc_cfg",
"--generate-link-to-definition",
"--extend-css",
"rustdoc/style.css",
]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"i686-unknown-linux-gnu",
"i686-pc-windows-msvc"
"i686-pc-windows-msvc",
]

[package.metadata.playground]
Expand All @@ -124,13 +113,13 @@ __internal_use_only_features_that_work_on_stable = [
]

[dependencies]
zerocopy-derive = { version = "=0.8.48", path = "zerocopy-derive", optional = true }
zerocopy-derive = { version = "=0.9.0-alpha.1", path = "zerocopy-derive", optional = true }

# The "associated proc macro pattern" ensures that the versions of zerocopy and
# zerocopy-derive remain equal, even if the 'derive' feature isn't used.
# See: https://github.com/matklad/macro-dep-test
[target.'cfg(any())'.dependencies]
zerocopy-derive = { version = "=0.8.48", path = "zerocopy-derive" }
zerocopy-derive = { version = "=0.9.0-alpha.1", path = "zerocopy-derive" }

[dev-dependencies]
# FIXME(#381) Remove this dependency once we have our own layout gadgets.
Expand All @@ -142,4 +131,4 @@ rustversion = "1.0"
static_assertions = "1.1"
testutil = { path = "testutil" }
# In tests, unlike in production, zerocopy-derive is not optional
zerocopy-derive = { version = "=0.8.48", path = "zerocopy-derive" }
zerocopy-derive = { version = "=0.9.0-alpha.1", path = "zerocopy-derive" }
23 changes: 19 additions & 4 deletions POLICIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,36 @@ documented guarantees do not hold.

## MSRV

TL;DR:
- 0.8 is our long-term stability (LTS) release train. On 0.8, we consider MSRV bumps to be breaking changes.
- On 0.9, we do *not* consider MSRV bumps to be breaking changes.

### 0.8

<!-- Our policy used to be simply that MSRV was a breaking change in all
circumstances. This implicitly relied on syn having the same MSRV policy, which
it does not. See #1085 and #1088. -->

*This section only applies to the 0.8 version train.*

Without the `derive` feature enabled, zerocopy's minimum supported Rust version
(MSRV) is encoded the `package.rust-version` field in its `Cargo.toml` file. For
zerocopy, we consider an increase in MSRV to be a semver-breaking change, and
will only increase our MSRV during semver-breaking version changes (e.g., 0.1 ->
0.2, 1.0 -> 2.0, etc).
zerocopy, we consider an increase in MSRV to be a semver-breaking change. We
will not bump our MSRV on the 0.8 version train.

For zerocopy with the `derive` feature enabled, and for the zerocopy-derive
crate, we inherit the maximum MSRV any of our dependencies. As of this writing
(2024-10-03), at least one dependency (syn) does *not* consider MSRV increases
to be semver-breaking changes. Thus, using the `derive` feature may result in
the effective MSRV increasing within a semver version train.
the effective MSRV increasing within 0.8.

### 0.9

*This section only applies to the 0.9 version train.*

0.9 has no official MSRV policy. We do not consider MSRV bumps to be breaking
changes. We may adopt *some* MSRV policy in the future, but we make no
guarantees about what it will be.

## Yanking

Expand Down
8 changes: 4 additions & 4 deletions agent_docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This is equivalent to:
`cargo +1.2.3 <command> [args]`

...where `1.2.3` is the toolchain version named by `<toolchain>` (e.g., `msrv` ->
`1.56.0`).
`1.78.0`).

### Toolchains

Expand All @@ -47,12 +47,12 @@ The `<toolchain>` argument is mandatory:

## MSRV (Minimum Supported Rust Version)

The MSRV is **1.56.0**.
The MSRV is **1.78.0**.

- **Do NOT** use features stabilized after 1.56.0 unless version-gated.
- **Do NOT** use features stabilized after 1.78.0 unless version-gated.
- **Requirement:** Ask for user approval before introducing new version-gated
behavior.
- **Verify**: Ensure code compiles on 1.56.0 (`./cargo.sh +msrv ...`).
- **Verify**: Ensure code compiles on 1.78.0 (`./cargo.sh +msrv ...`).

### Version Gating Convention

Expand Down
12 changes: 6 additions & 6 deletions src/byteorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,8 @@ mod tests {
/// themselves. This method is like `assert_eq!`, but it treats NaN
/// values as equal.
fn assert_eq_or_nan(self, other: Self) {
let slf = (!self.is_nan()).then(|| self);
let other = (!other.is_nan()).then(|| other);
let slf = (!self.is_nan()).then_some(self);
let other = (!other.is_nan()).then_some(other);
assert_eq!(slf, other);
}
}
Expand Down Expand Up @@ -1090,8 +1090,8 @@ mod tests {
/// themselves. This method is like `assert_eq!`, but it treats NaN
/// values as equal.
fn assert_eq_or_nan(self, other: Self) {
let slf = (!self.get().is_nan()).then(|| self);
let other = (!other.get().is_nan()).then(|| other);
let slf = (!self.get().is_nan()).then_some(self);
let other = (!other.get().is_nan()).then_some(other);
assert_eq!(slf, other);
}
}
Expand Down Expand Up @@ -1401,7 +1401,7 @@ mod tests {
let t_t_res = val_or_none(t_t_res);
let t_n_res = val_or_none(t_n_res);
let n_t_res = val_or_none(n_t_res);
let n_n_res = (!T::Native::is_nan(n_n_res)).then(|| n_n_res);
let n_n_res = (!T::Native::is_nan(n_n_res)).then_some(n_n_res);
assert_eq!(t_t_res, n_n_res);
assert_eq!(t_n_res, n_n_res);
assert_eq!(n_t_res, n_n_res);
Expand All @@ -1419,7 +1419,7 @@ mod tests {
// NaN as `None` so they can still be compared.
let t_t_res = val_or_none(t_t_res);
let t_n_res = val_or_none(t_n_res);
let n_t_res = (!T::Native::is_nan(n_t_res)).then(|| n_t_res);
let n_t_res = (!T::Native::is_nan(n_t_res)).then_some(n_t_res);
assert_eq!(t_t_res, n_n_res);
assert_eq!(t_n_res, n_n_res);
assert_eq!(n_t_res, n_n_res);
Expand Down
18 changes: 7 additions & 11 deletions src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,12 @@ const _: () = unsafe {
unsafe_impl_for_power_set!(A, B, C, D, E, F, G, H, I, J, K, L -> M => Immutable for opt_unsafe_extern_c_fn!(...));
};

#[cfg(all(
not(no_zerocopy_target_has_atomics_1_60_0),
any(
target_has_atomic = "8",
target_has_atomic = "16",
target_has_atomic = "32",
target_has_atomic = "64",
target_has_atomic = "ptr"
)
#[cfg(any(
target_has_atomic = "8",
target_has_atomic = "16",
target_has_atomic = "32",
target_has_atomic = "64",
target_has_atomic = "ptr"
))]
#[cfg_attr(doc_cfg, doc(cfg(rust = "1.60.0")))]
mod atomics {
Expand Down Expand Up @@ -1354,7 +1351,6 @@ mod simd {
// Rust 1.87. (Context in https://github.com/rust-lang/stdarch/issues/1484). Support is
// split in two different version ranges on top of the base configuration, requiring either
// little endian or the more recent version to be detected as well.
#[cfg(not(no_zerocopy_aarch64_simd_1_59_0))]
simd_arch_mod!(
#[cfg(all(
target_arch = "aarch64",
Expand Down Expand Up @@ -2371,7 +2367,7 @@ mod tests {
vector_signed_long,
vector_unsigned_long
);
#[cfg(all(target_arch = "aarch64", not(no_zerocopy_aarch64_simd_1_59_0)))]
#[cfg(target_arch = "aarch64")]
#[rustfmt::skip]
test_simd_arch_mod!(
aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
Expand Down
2 changes: 1 addition & 1 deletion src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ mod tests {
layout(size_info, align).validate_cast_and_convert_metadata(addr, bytes_len, cast_type)
}).map_err(|d| {
let msg = d.downcast::<&'static str>().ok().map(|s| *s.as_ref());
assert!(msg.is_some() || cfg!(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0), "non-string panic messages are not permitted when usage of panic in const fn is enabled");
assert!(msg.is_some(), "non-string panic messages are not permitted when usage of panic in const fn is enabled");
msg
});
std::panic::set_hook(previous_hook);
Expand Down
Loading
Loading