Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roll nightly toolchain #846

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,16 @@ jobs:
# Don't semver check zerocopy-derive; as a proc macro, it doesn't have
# an API that cargo-semver-checks can understand.
package: zerocopy
feature-group: all-features
# Don't test nightly features. The reason this doesn't work is that
# cargo-semver-checks works relative to the most recently-published
# stable release on crates.io. The pinned nightly toolchain may be
# incompatible with the unstable features on that published release, as
# nightly features may have changed since it was released. Luckily, we
# don't care about the API stability of these features anyway.
feature-group: only-explicit-features
features: __internal_use_only_features_that_work_on_stable
rust-toolchain: ${{ env.ZC_TOOLCHAIN }}
if: matrix.crate == 'zerocopy' && matrix.features == '--all-features' && matrix.toolchain == 'nightly'
if: matrix.crate == 'zerocopy' && matrix.features == '--features __internal_use_only_features_that_work_on_stable' && matrix.toolchain == 'nightly'

kani:
runs-on: ubuntu-latest
Expand All @@ -269,7 +276,17 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: model-checking/kani-github-action@f838096619a707b0f6b2118cf435eaccfa33e51f # v1.1
with:
args: "--package zerocopy --all-features --output-format=terse --randomize-layout --memory-safety-checks --overflow-checks --undefined-function-checks --unwinding-checks"
# Use `--features __internal_use_only_features_that_work_on_stable`
# because the Kani GitHub Action uses its own pinned nightly
# toolchain. Sometimes, we make changes to our nightly features for
# more recent toolchains, and so our nightly features become
# incompatible with the toolchain that Kani uses. By only testing
# stable features, we ensure that this doesn't cause problems in CI.
#
# TODO(https://github.com/model-checking/kani-github-action/issues/56):
# Go back to testing all features once the Kani GitHub Action supports
# specifying a particular toolchain.
args: "--package zerocopy --features __internal_use_only_features_that_work_on_stable --output-format=terse --randomize-layout --memory-safety-checks --overflow-checks --undefined-function-checks --unwinding-checks"

check_fmt:
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[package]
edition = "2018"
name = "zerocopy"
version = "0.8.0-alpha.3"
version = "0.8.0-alpha.4"
authors = ["Joshua Liebow-Feeser <joshlf@google.com>"]
description = "Utilities for zero-copy parsing and serialization"
license = "BSD-2-Clause OR Apache-2.0 OR MIT"
Expand All @@ -31,7 +31,7 @@ rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"]
[package.metadata.ci]
# The versions of the stable and nightly compiler toolchains to use in CI.
pinned-stable = "1.75.0"
pinned-nightly = "nightly-2024-02-01"
pinned-nightly = "nightly-2024-02-06"

[package.metadata.playground]
features = ["__internal_use_only_features_that_work_on_stable"]
Expand All @@ -47,13 +47,13 @@ simd-nightly = ["simd"]
__internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd"]

[dependencies]
zerocopy-derive = { version = "=0.8.0-alpha.3", path = "zerocopy-derive", optional = true }
zerocopy-derive = { version = "=0.8.0-alpha.4", 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.0-alpha.3", path = "zerocopy-derive" }
zerocopy-derive = { version = "=0.8.0-alpha.4", path = "zerocopy-derive" }

[dev-dependencies]
assert_matches = "1.5"
Expand All @@ -72,6 +72,6 @@ testutil = { path = "testutil" }
# CI test failures.
trybuild = { version = "=1.0.89", features = ["diff"] }
# In tests, unlike in production, zerocopy-derive is not optional
zerocopy-derive = { version = "=0.8.0-alpha.3", path = "zerocopy-derive" }
zerocopy-derive = { version = "=0.8.0-alpha.4", path = "zerocopy-derive" }
# TODO(#381) Remove this dependency once we have our own layout gadgets.
elain = "0.3.0"
13 changes: 12 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,18 @@
clippy::indexing_slicing,
))]
#![cfg_attr(not(test), no_std)]
#![cfg_attr(feature = "simd-nightly", feature(stdsimd))]
#![cfg_attr(
all(feature = "simd-nightly", any(target_arch = "x86", target_arch = "x86_64")),
feature(stdarch_x86_avx512)
)]
#![cfg_attr(
all(feature = "simd-nightly", target_arch = "arm"),
feature(stdarch_arm_dsp, stdarch_arm_neon_intrinsics)
)]
#![cfg_attr(
all(feature = "simd-nightly", any(target_arch = "powerpc", target_arch = "powerpc64")),
feature(stdarch_powerpc)
)]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![cfg_attr(
__INTERNAL_USE_ONLY_NIGHLTY_FEATURES_IN_TESTS,
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-nightly/transmute-mut-dst-unsized.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `MaxAlignsOf`
note: required by an implicit `Sized` bound in `MaxAlignsOf`
--> src/macro_util.rs
|
| pub union MaxAlignsOf<T, U> {
| ^ required by this bound in `MaxAlignsOf`
| ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf`
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -47,11 +47,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `transmute`
note: required by an implicit `Sized` bound in `transmute`
--> $RUST/core/src/intrinsics.rs
|
| pub fn transmute<Src, Dst>(src: Src) -> Dst;
| ^^^ required by this bound in `transmute`
| ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute`
= note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -61,9 +61,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `transmute_mut`
note: required by an implicit `Sized` bound in `transmute_mut`
--> src/macro_util.rs
|
| pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>(
| ^^^ required by this bound in `transmute_mut`
| ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut`
= note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)
24 changes: 12 additions & 12 deletions tests/ui-nightly/transmute-mut-src-dst-unsized.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `AlignOf`
note: required by an implicit `Sized` bound in `AlignOf`
--> src/macro_util.rs
|
| pub struct AlignOf<T> {
| ^ required by this bound in `AlignOf`
| ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf`
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -105,11 +105,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `MaxAlignsOf`
note: required by an implicit `Sized` bound in `MaxAlignsOf`
--> src/macro_util.rs
|
| pub union MaxAlignsOf<T, U> {
| ^ required by this bound in `MaxAlignsOf`
| ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf`
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -119,11 +119,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `AlignOf`
note: required by an implicit `Sized` bound in `AlignOf`
--> src/macro_util.rs
|
| pub struct AlignOf<T> {
| ^ required by this bound in `AlignOf`
| ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf`
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -144,11 +144,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `transmute`
note: required by an implicit `Sized` bound in `transmute`
--> $RUST/core/src/intrinsics.rs
|
| pub fn transmute<Src, Dst>(src: Src) -> Dst;
| ^^^ required by this bound in `transmute`
| ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute`
= note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -161,11 +161,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `transmute_mut`
note: required by an implicit `Sized` bound in `transmute_mut`
--> src/macro_util.rs
|
| pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>(
| ^^^ required by this bound in `transmute_mut`
| ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut`
= note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -175,9 +175,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `transmute_mut`
note: required by an implicit `Sized` bound in `transmute_mut`
--> src/macro_util.rs
|
| pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>(
| ^^^ required by this bound in `transmute_mut`
| ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut`
= note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)
16 changes: 8 additions & 8 deletions tests/ui-nightly/transmute-mut-src-unsized.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `AlignOf`
note: required by an implicit `Sized` bound in `AlignOf`
--> src/macro_util.rs
|
| pub struct AlignOf<T> {
| ^ required by this bound in `AlignOf`
| ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf`
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -88,11 +88,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `MaxAlignsOf`
note: required by an implicit `Sized` bound in `MaxAlignsOf`
--> src/macro_util.rs
|
| pub union MaxAlignsOf<T, U> {
| ^ required by this bound in `MaxAlignsOf`
| ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf`
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -102,11 +102,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `AlignOf`
note: required by an implicit `Sized` bound in `AlignOf`
--> src/macro_util.rs
|
| pub struct AlignOf<T> {
| ^ required by this bound in `AlignOf`
| ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf`
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -119,9 +119,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `transmute_mut`
note: required by an implicit `Sized` bound in `transmute_mut`
--> src/macro_util.rs
|
| pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>(
| ^^^ required by this bound in `transmute_mut`
| ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut`
= note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)
12 changes: 6 additions & 6 deletions tests/ui-nightly/transmute-ref-dst-unsized.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `MaxAlignsOf`
note: required by an implicit `Sized` bound in `MaxAlignsOf`
--> src/macro_util.rs
|
| pub union MaxAlignsOf<T, U> {
| ^ required by this bound in `MaxAlignsOf`
| ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf`
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -47,11 +47,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `transmute`
note: required by an implicit `Sized` bound in `transmute`
--> $RUST/core/src/intrinsics.rs
|
| pub fn transmute<Src, Dst>(src: Src) -> Dst;
| ^^^ required by this bound in `transmute`
| ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute`
= note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
Expand All @@ -61,9 +61,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `transmute_ref`
note: required by an implicit `Sized` bound in `transmute_ref`
--> src/macro_util.rs
|
| pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>(
| ^^^ required by this bound in `transmute_ref`
| ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref`
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info)