diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d38940c447..74df14c0a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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", @@ -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" @@ -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" @@ -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. diff --git a/Cargo.lock b/Cargo.lock index 8b2dad5b3e..f32c91a977 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -412,7 +412,7 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "zerocopy" -version = "0.8.48" +version = "0.9.0-alpha.1" dependencies = [ "elain", "itertools", @@ -426,7 +426,7 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.48" +version = "0.9.0-alpha.1" dependencies = [ "dissimilar", "prettyplease", diff --git a/Cargo.toml b/Cargo.toml index 90904f93c7..b4f7abdfd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ [package] edition = "2021" name = "zerocopy" -version = "0.8.48" +version = "0.9.0-alpha.1" authors = [ "Joshua Liebow-Feeser ", "Jack Wrenn ", @@ -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 = [".*"] @@ -64,29 +65,11 @@ 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" @@ -94,13 +77,19 @@ 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] @@ -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. @@ -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" } diff --git a/POLICIES.md b/POLICIES.md index a05b3c35c7..599b4739d9 100644 --- a/POLICIES.md +++ b/POLICIES.md @@ -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 + +*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 diff --git a/agent_docs/development.md b/agent_docs/development.md index e4cf61f900..a9dc51a5bf 100644 --- a/agent_docs/development.md +++ b/agent_docs/development.md @@ -33,7 +33,7 @@ This is equivalent to: `cargo +1.2.3 [args]` ...where `1.2.3` is the toolchain version named by `` (e.g., `msrv` -> -`1.56.0`). +`1.78.0`). ### Toolchains @@ -47,12 +47,12 @@ The `` 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 diff --git a/src/byteorder.rs b/src/byteorder.rs index 2575052034..be81aa8674 100644 --- a/src/byteorder.rs +++ b/src/byteorder.rs @@ -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); } } @@ -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); } } @@ -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); @@ -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); diff --git a/src/impls.rs b/src/impls.rs index 80538bfc8a..c8ace97399 100644 --- a/src/impls.rs +++ b/src/impls.rs @@ -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 { @@ -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", @@ -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, diff --git a/src/layout.rs b/src/layout.rs index 19ad5ca85f..72de754cb0 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -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); diff --git a/src/lib.rs b/src/lib.rs index 0c66144932..6bcaf6ac30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -740,10 +740,7 @@ use {FromZeros as FromZeroes, IntoBytes as AsBytes, Ref as LayoutVerified}; not(feature = "derive"), doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.KnownLayout.html"), )] -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented(note = "Consider adding `#[derive(KnownLayout)]` to `{Self}`") -)] +#[diagnostic::on_unimplemented(note = "Consider adding `#[derive(KnownLayout)]` to `{Self}`")] pub unsafe trait KnownLayout { // The `Self: Sized` bound makes it so that `KnownLayout` can still be // object safe. It's not currently object safe thanks to `const LAYOUT`, and @@ -1561,10 +1558,7 @@ pub use zerocopy_derive::Immutable; doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.Immutable.html"), doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.Immutable.html#analysis"), )] -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented(note = "Consider adding `#[derive(Immutable)]` to `{Self}`") -)] +#[diagnostic::on_unimplemented(note = "Consider adding `#[derive(Immutable)]` to `{Self}`")] pub unsafe trait Immutable { // The `Self: Sized` bound makes it so that `Immutable` is still object // safe. @@ -1731,10 +1725,7 @@ pub use zerocopy_derive::TryFromBytes; not(feature = "derive"), doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.TryFromBytes.html"), )] -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented(note = "Consider adding `#[derive(TryFromBytes)]` to `{Self}`") -)] +#[diagnostic::on_unimplemented(note = "Consider adding `#[derive(TryFromBytes)]` to `{Self}`")] pub unsafe trait TryFromBytes { // The `Self: Sized` bound makes it so that `TryFromBytes` is still object // safe. @@ -3453,10 +3444,7 @@ unsafe fn try_read_from( doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.FromZeros.html"), doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.FromZeros.html#analysis"), )] -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented(note = "Consider adding `#[derive(FromZeros)]` to `{Self}`") -)] +#[diagnostic::on_unimplemented(note = "Consider adding `#[derive(FromZeros)]` to `{Self}`")] pub unsafe trait FromZeros: TryFromBytes { // The `Self: Sized` bound makes it so that `FromZeros` is still object // safe. @@ -3758,7 +3746,6 @@ pub unsafe trait FromZeros: TryFromBytes { bench = "extend_vec_zeroed", format = "coco_static_size", )] - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[cfg(feature = "alloc")] #[cfg_attr(doc_cfg, doc(cfg(all(rust = "1.57.0", feature = "alloc"))))] #[inline(always)] @@ -3783,7 +3770,6 @@ pub unsafe trait FromZeros: TryFromBytes { bench = "insert_vec_zeroed", format = "coco_static_size", )] - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[cfg(feature = "alloc")] #[cfg_attr(doc_cfg, doc(cfg(all(rust = "1.57.0", feature = "alloc"))))] #[inline] @@ -4039,10 +4025,7 @@ pub use zerocopy_derive::FromBytes; doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.FromBytes.html"), doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.FromBytes.html#analysis"), )] -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented(note = "Consider adding `#[derive(FromBytes)]` to `{Self}`") -)] +#[diagnostic::on_unimplemented(note = "Consider adding `#[derive(FromBytes)]` to `{Self}`")] pub unsafe trait FromBytes: FromZeros { // The `Self: Sized` bound makes it so that `FromBytes` is still object // safe. @@ -5672,10 +5655,7 @@ pub use zerocopy_derive::IntoBytes; doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.IntoBytes.html"), doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.IntoBytes.html#analysis"), )] -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented(note = "Consider adding `#[derive(IntoBytes)]` to `{Self}`") -)] +#[diagnostic::on_unimplemented(note = "Consider adding `#[derive(IntoBytes)]` to `{Self}`")] pub unsafe trait IntoBytes { // The `Self: Sized` bound makes it so that this function doesn't prevent // `IntoBytes` from being object safe. Note that other `IntoBytes` methods @@ -6312,10 +6292,7 @@ pub use zerocopy_derive::Unaligned; doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.Unaligned.html"), doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.Unaligned.html#analysis"), )] -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented(note = "Consider adding `#[derive(Unaligned)]` to `{Self}`") -)] +#[diagnostic::on_unimplemented(note = "Consider adding `#[derive(Unaligned)]` to `{Self}`")] pub unsafe trait Unaligned { // The `Self: Sized` bound makes it so that `Unaligned` is still object // safe. @@ -6416,13 +6393,11 @@ pub use zerocopy_derive::SplitAt; #[cfg(feature = "alloc")] #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))] -#[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] mod alloc_support { use super::*; /// Extends a `Vec` by pushing `additional` new items onto the end of the /// vector. The new items are initialized with zeros. - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[doc(hidden)] #[deprecated(since = "0.8.0", note = "moved to `FromZeros`")] #[inline(always)] @@ -6439,7 +6414,6 @@ mod alloc_support { /// # Panics /// /// Panics if `position > v.len()`. - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[doc(hidden)] #[deprecated(since = "0.8.0", note = "moved to `FromZeros`")] #[inline(always)] @@ -6453,7 +6427,6 @@ mod alloc_support { } #[cfg(feature = "alloc")] -#[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[doc(hidden)] pub use alloc_support::*; @@ -6610,7 +6583,7 @@ mod tests { assert_eq!(::LAYOUT, sized_layout(64, 64)); // ...with `packed`: - #[allow(dead_code)] + #[allow(dead_code, clippy::repr_packed_without_abi)] #[derive(KnownLayout)] #[repr(packed)] struct KL01Packed(NotKnownLayout, NotKnownLayout); @@ -6621,7 +6594,7 @@ mod tests { assert_eq!(::LAYOUT, sized_layout(1, 6)); // ...with `packed(N)`: - #[allow(dead_code)] + #[allow(dead_code, clippy::repr_packed_without_abi)] #[derive(KnownLayout)] #[repr(packed(2))] struct KL01PackedN(NotKnownLayout, NotKnownLayout); @@ -6656,7 +6629,7 @@ mod tests { assert_eq!(::LAYOUT, sized_layout(64, 64)); // ... with `packed`: - #[allow(dead_code)] + #[allow(dead_code, clippy::repr_packed_without_abi)] #[derive(KnownLayout)] #[repr(packed)] struct KL03Packed(NotKnownLayout, u8); @@ -6667,7 +6640,7 @@ mod tests { assert_eq!(::LAYOUT, sized_layout(1, 5)); // ... with `packed(N)` - #[allow(dead_code)] + #[allow(dead_code, clippy::repr_packed_without_abi)] #[derive(KnownLayout)] #[repr(packed(2))] struct KL03PackedN(NotKnownLayout, u8); @@ -7367,7 +7340,6 @@ mod tests { mod alloc { use super::*; - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[test] fn test_extend_vec_zeroed() { // Test extending when there is an existing allocation. @@ -7385,7 +7357,6 @@ mod tests { drop(v); } - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[test] fn test_extend_vec_zeroed_zst() { // Test extending when there is an existing (fake) allocation. @@ -7402,7 +7373,6 @@ mod tests { drop(v); } - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[test] fn test_insert_vec_zeroed() { // Insert at start (no existing allocation). @@ -7434,7 +7404,6 @@ mod tests { drop(v); } - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] #[test] fn test_insert_vec_zeroed_zst() { // Insert at start (no existing fake allocation). diff --git a/src/macros.rs b/src/macros.rs index 948f8f912b..75713a0cf1 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1348,37 +1348,22 @@ mod tests { let x: &[[u8; 2]] = transmute_ref!(&array_of_u8s); assert_eq!(x, slice_of_arrays); - // Before 1.61.0, we can't define the `const fn transmute_ref` function - // that we do on and after 1.61.0. - #[cfg(no_zerocopy_generic_bounds_in_const_fn_1_61_0)] + // Call through a generic function to make sure our autoref + // specialization trick works even when types are generic. + const fn transmute_ref(t: &T) -> &U + where + T: IntoBytes + Immutable, + U: FromBytes + Immutable, { - // Test that `transmute_ref!` supports non-`KnownLayout` `Sized` - // types. - const ARRAY_OF_NKL_U8S: Nkl<[u8; 8]> = Nkl([0u8, 1, 2, 3, 4, 5, 6, 7]); - const ARRAY_OF_NKL_ARRAYS: Nkl<[[u8; 2]; 4]> = Nkl([[0, 1], [2, 3], [4, 5], [6, 7]]); - const X_NKL: &Nkl<[[u8; 2]; 4]> = transmute_ref!(&ARRAY_OF_NKL_U8S); - assert_eq!(*X_NKL, ARRAY_OF_NKL_ARRAYS); + transmute_ref!(t) } - #[cfg(not(no_zerocopy_generic_bounds_in_const_fn_1_61_0))] - { - // Call through a generic function to make sure our autoref - // specialization trick works even when types are generic. - const fn transmute_ref(t: &T) -> &U - where - T: IntoBytes + Immutable, - U: FromBytes + Immutable, - { - transmute_ref!(t) - } - - // Test that `transmute_ref!` supports non-`KnownLayout` `Sized` - // types. - const ARRAY_OF_NKL_U8S: Nkl<[u8; 8]> = Nkl([0u8, 1, 2, 3, 4, 5, 6, 7]); - const ARRAY_OF_NKL_ARRAYS: Nkl<[[u8; 2]; 4]> = Nkl([[0, 1], [2, 3], [4, 5], [6, 7]]); - const X_NKL: &Nkl<[[u8; 2]; 4]> = transmute_ref(&ARRAY_OF_NKL_U8S); - assert_eq!(*X_NKL, ARRAY_OF_NKL_ARRAYS); - } + // Test that `transmute_ref!` supports non-`KnownLayout` `Sized` + // types. + const ARRAY_OF_NKL_U8S: Nkl<[u8; 8]> = Nkl([0u8, 1, 2, 3, 4, 5, 6, 7]); + const ARRAY_OF_NKL_ARRAYS: Nkl<[[u8; 2]; 4]> = Nkl([[0, 1], [2, 3], [4, 5], [6, 7]]); + const X_NKL: &Nkl<[[u8; 2]; 4]> = transmute_ref(&ARRAY_OF_NKL_U8S); + assert_eq!(*X_NKL, ARRAY_OF_NKL_ARRAYS); // Test that `transmute_ref!` works on slice DSTs in and that memory is // transmuted as expected. diff --git a/src/split_at.rs b/src/split_at.rs index 1d7b2c7d60..60f14ca0bf 100644 --- a/src/split_at.rs +++ b/src/split_at.rs @@ -50,10 +50,7 @@ use crate::pointer::invariant::{Aligned, Exclusive, Invariants, Shared, Valid}; not(feature = "derive"), doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.SplitAt.html"), )] -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented(note = "Consider adding `#[derive(SplitAt)]` to `{Self}`") -)] +#[diagnostic::on_unimplemented(note = "Consider adding `#[derive(SplitAt)]` to `{Self}`")] // # Safety // // The trailing slice is well-aligned for its element type. `Self` is `[T]`, or diff --git a/src/util/macro_util.rs b/src/util/macro_util.rs index 2235d0b8b4..d2d48772c9 100644 --- a/src/util/macro_util.rs +++ b/src/util/macro_util.rs @@ -48,15 +48,12 @@ pub unsafe trait Field { type Type: ?Sized; } -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented( - message = "`{T}` has {PADDING_BYTES} total byte(s) of padding", - label = "types with padding cannot implement `IntoBytes`", - note = "consider using `zerocopy::Unalign` to lower the alignment of individual fields", - note = "consider adding explicit fields where padding would be", - note = "consider using `#[repr(packed)]` to remove padding" - ) +#[diagnostic::on_unimplemented( + message = "`{T}` has {PADDING_BYTES} total byte(s) of padding", + label = "types with padding cannot implement `IntoBytes`", + note = "consider using `zerocopy::Unalign` to lower the alignment of individual fields", + note = "consider adding explicit fields where padding would be", + note = "consider using `#[repr(packed)]` to remove padding" )] pub trait PaddingFree {} impl PaddingFree for () {} @@ -66,15 +63,12 @@ impl PaddingFree for () {} // to `StaticPaddingFree` or something - or introduce a third trait with that // name) so that we can have more clear error messages. -#[cfg_attr( - not(no_zerocopy_diagnostic_on_unimplemented_1_78_0), - diagnostic::on_unimplemented( - message = "`{T}` has one or more padding bytes", - label = "types with padding cannot implement `IntoBytes`", - note = "consider using `zerocopy::Unalign` to lower the alignment of individual fields", - note = "consider adding explicit fields where padding would be", - note = "consider using `#[repr(packed)]` to remove padding" - ) +#[diagnostic::on_unimplemented( + message = "`{T}` has one or more padding bytes", + label = "types with padding cannot implement `IntoBytes`", + note = "consider using `zerocopy::Unalign` to lower the alignment of individual fields", + note = "consider adding explicit fields where padding would be", + note = "consider using `#[repr(packed)]` to remove padding" )] pub trait DynamicPaddingFree {} impl DynamicPaddingFree for () {} @@ -289,7 +283,6 @@ pub type SizeToTag = <() as size_to_tag::SizeToTag>::Ta // We put `Sized` in its own module so it can have the same name as the standard // library `Sized` without shadowing it in the parent module. -#[cfg(not(no_zerocopy_diagnostic_on_unimplemented_1_78_0))] mod __size_of { #[diagnostic::on_unimplemented( message = "`{Self}` is unsized", @@ -308,10 +301,6 @@ mod __size_of { } } -#[cfg(no_zerocopy_diagnostic_on_unimplemented_1_78_0)] -pub use core::mem::size_of; - -#[cfg(not(no_zerocopy_diagnostic_on_unimplemented_1_78_0))] pub use __size_of::size_of; /// How many padding bytes does the struct type `$t` have? @@ -965,6 +954,7 @@ mod tests { macro_rules! test { (#[$cfg:meta] ($($ts:ty),* ; $trailing_field_ty:ty) => $expect:expr) => {{ #[$cfg] + #[allow(clippy::repr_packed_without_abi)] struct Test($(#[allow(dead_code)] $ts,)* #[allow(dead_code)] $trailing_field_ty); assert_eq!(test!(@offset $($ts),* ; $trailing_field_ty), $expect); }}; @@ -1144,7 +1134,7 @@ mod tests { macro_rules! test { (#[$cfg:meta] ($($ts:ty),*) => $expect:expr) => {{ #[$cfg] - #[allow(dead_code)] + #[allow(dead_code, clippy::repr_packed_without_abi)] struct Test($($ts),*); assert_eq!(struct_padding!(Test, None::, None::, [$($ts),*]), $expect); }}; @@ -1211,7 +1201,7 @@ mod tests { macro_rules! test { (#[$cfg:meta] {$($fs:ident: $ts:ty),*} => $expect:expr) => {{ #[$cfg] - #[allow(unused)] // fields are never read + #[allow(unused, clippy::repr_packed_without_abi)] // fields are never read union Test{ $($fs: $ts),* } assert_eq!(union_padding!(Test, None::, None::, [$($ts),*]), $expect); }}; diff --git a/src/util/macros.rs b/src/util/macros.rs index 7dca5410c8..e25e62c3ae 100644 --- a/src/util/macros.rs +++ b/src/util/macros.rs @@ -549,11 +549,7 @@ macro_rules! maybe_const_trait_bounded_fn { // non-method functions. Each `$args` may optionally be followed by `: // $arg_tys:ty`, which can be omitted for `self`. ($(#[$attr:meta])* $vis:vis const fn $name:ident($($args:ident $(: $arg_tys:ty)?),* $(,)?) $(-> $ret_ty:ty)? $body:block) => { - #[cfg(not(no_zerocopy_generic_bounds_in_const_fn_1_61_0))] $(#[$attr])* $vis const fn $name($($args $(: $arg_tys)?),*) $(-> $ret_ty)? $body - - #[cfg(no_zerocopy_generic_bounds_in_const_fn_1_61_0)] - $(#[$attr])* $vis fn $name($($args $(: $arg_tys)?),*) $(-> $ret_ty)? $body }; } @@ -573,10 +569,7 @@ macro_rules! const_panic { panic[0] }}; ($($arg:tt)+) => {{ - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] panic!($($arg)+); - #[cfg(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0)] - const_panic!(@non_panic $($arg)+) }}; } @@ -586,46 +579,17 @@ macro_rules! const_panic { /// accommodate old toolchains. macro_rules! const_assert { ($e:expr) => {{ - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] assert!($e); - #[cfg(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0)] - { - let e = $e; - if !e { - let _: () = const_panic!(@non_panic concat!("assertion failed: ", stringify!($e))); - } - } }}; ($e:expr, $($args:tt)+) => {{ - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] assert!($e, $($args)+); - #[cfg(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0)] - { - let e = $e; - if !e { - let _: () = const_panic!(@non_panic concat!("assertion failed: ", stringify!($e), ": ", stringify!($arg)), $($args)*); - } - } }}; } /// Like `const_assert!`, but relative to `debug_assert!`. macro_rules! const_debug_assert { ($e:expr $(, $msg:expr)?) => {{ - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] debug_assert!($e $(, $msg)?); - #[cfg(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0)] - { - // Use this (rather than `#[cfg(debug_assertions)]`) to ensure that - // `$e` is always compiled even if it will never be evaluated at - // runtime. - if cfg!(debug_assertions) { - let e = $e; - if !e { - let _: () = const_panic!(@non_panic concat!("assertion failed: ", stringify!($e) $(, ": ", $msg)?)); - } - } - } }} } @@ -633,11 +597,7 @@ macro_rules! const_debug_assert { /// toolchain supports panicking in `const fn`. macro_rules! const_unreachable { () => {{ - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] unreachable!(); - - #[cfg(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0)] - loop {} }}; } diff --git a/src/util/mod.rs b/src/util/mod.rs index 4016f8f048..817c9e594c 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -240,7 +240,6 @@ pub(crate) const fn round_down_to_next_multiple_of_alignment( } let align = align.get(); - #[cfg(not(no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0))] debug_assert!(align.is_power_of_two()); // Subtraction can't underflow because `align.get() >= 1`. diff --git a/tests/ui/diagnostic-not-implemented.msrv.stderr b/tests/ui/diagnostic-not-implemented.msrv.stderr index 31d91f5bce..5e9d2d0a4e 100644 --- a/tests/ui/diagnostic-not-implemented.msrv.stderr +++ b/tests/ui/diagnostic-not-implemented.msrv.stderr @@ -4,6 +4,17 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied 16 | takes_from_bytes::(); | ^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 79 others note: required by a bound in `takes_from_bytes` --> $DIR/diagnostic-not-implemented.rs:77:24 | @@ -16,6 +27,17 @@ error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied 18 | takes_from_zeros::(); | ^^^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` + = help: the following other types implement trait `FromZeros`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 141 others note: required by a bound in `takes_from_zeros` --> $DIR/diagnostic-not-implemented.rs:78:24 | @@ -28,6 +50,17 @@ error[E0277]: the trait bound `NotZerocopy: Immutable` is not satisfied 20 | takes_immutable::(); | ^^^^^^^^^^^ the trait `Immutable` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(Immutable)]` to `NotZerocopy` + = help: the following other types implement trait `Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 128 others note: required by a bound in `takes_immutable` --> $DIR/diagnostic-not-implemented.rs:79:23 | @@ -40,6 +73,17 @@ error[E0277]: the trait bound `NotZerocopy: IntoBytes` is not satisfied 22 | takes_into_bytes::(); | ^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 68 others note: required by a bound in `takes_into_bytes` --> $DIR/diagnostic-not-implemented.rs:80:24 | @@ -52,6 +96,17 @@ error[E0277]: the trait bound `NotZerocopy: KnownLayout` is not satisfied 24 | takes_known_layout::(); | ^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(KnownLayout)]` to `NotZerocopy` + = help: the following other types implement trait `KnownLayout`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 66 others note: required by a bound in `takes_known_layout` --> $DIR/diagnostic-not-implemented.rs:81:26 | @@ -64,6 +119,17 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied 26 | takes_try_from_bytes::(); | ^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 153 others note: required by a bound in `takes_try_from_bytes` --> $DIR/diagnostic-not-implemented.rs:82:28 | @@ -76,6 +142,17 @@ error[E0277]: the trait bound `NotZerocopy: zerocopy::Unaligned` is not satisfie 28 | takes_unaligned::(); | ^^^^^^^^^^^ the trait `zerocopy::Unaligned` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(Unaligned)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy::Unaligned`: + bool + i8 + u8 + NonZero + NonZero + ReadOnly + U16 + U32 + and 26 others note: required by a bound in `takes_unaligned` --> $DIR/diagnostic-not-implemented.rs:83:23 | @@ -86,13 +163,46 @@ error[E0277]: the trait bound `NotZerocopy: Immutable` is not satisfied --> $DIR/diagnostic-not-implemented.rs:66:19 | 66 | Foo.write_obj(NotZerocopy(())); - | ^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `NotZerocopy` + | --------- ^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `NotZerocopy` + | | + | required by a bound introduced by this call + | +note: required by a bound in `Foo::write_obj` + --> $DIR/diagnostic-not-implemented.rs:73:25 + | +73 | fn write_obj(&mut self, _val: T) {} + | ^^^^^^^^^ required by this bound in `Foo::write_obj` +help: consider borrowing here + | +66 | Foo.write_obj(&NotZerocopy(())); + | + +66 | Foo.write_obj(&mut NotZerocopy(())); + | ++++ error[E0277]: the trait bound `NotZerocopy: IntoBytes` is not satisfied --> $DIR/diagnostic-not-implemented.rs:66:19 | 66 | Foo.write_obj(NotZerocopy(())); - | ^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` + | --------- ^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` + | | + | required by a bound introduced by this call + | + = note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 68 others +note: required by a bound in `Foo::write_obj` + --> $DIR/diagnostic-not-implemented.rs:73:37 + | +73 | fn write_obj(&mut self, _val: T) {} + | ^^^^^^^^^ required by this bound in `Foo::write_obj` error: aborting due to 9 previous errors diff --git a/tests/ui/include_value.msrv.stderr b/tests/ui/include_value.msrv.stderr index 3ac67be70d..0641c8eb3c 100644 --- a/tests/ui/include_value.msrv.stderr +++ b/tests/ui/include_value.msrv.stderr @@ -4,16 +4,27 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied 17 | zerocopy::include_value!("../../testdata/include_value/data"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 79 others note: required by a bound in `NOT_FROM_BYTES::transmute` --> $DIR/include_value.rs:17:5 | 17 | zerocopy::include_value!("../../testdata/include_value/data"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | required by a bound in this - | required by this bound in `NOT_FROM_BYTES::transmute` - = note: this error originates in the macro `$crate::transmute` (in Nightly builds, run with -Z macro-backtrace for more info) + | required by a bound in this function + | required by this bound in `transmute` + = note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `zerocopy::include_value` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/late-compile-pass.msrv.stderr b/tests/ui/late-compile-pass.msrv.stderr index ce3f175a17..2c2da495e8 100644 --- a/tests/ui/late-compile-pass.msrv.stderr +++ b/tests/ui/late-compile-pass.msrv.stderr @@ -29,34 +29,14 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:50:39 + --> $DIR/late-compile-pass.rs:49:39 | -50 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); +49 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `[u8; 4]` (32 bits) = note: target type: `u64` (64 bits) - = note: this error originates in the macro `$crate::transmute` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:58:41 - | -58 | let _decrease_size: Result = try_transmute!(AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: source type: `AU16` (16 bits) - = note: target type: `u8` (8 bits) - = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:63:43 - | -63 | let _increase_size: Result = try_transmute!(0u8); - | ^^^^^^^^^^^^^^^^^^^ - | - = note: source type: `u8` (8 bits) - = note: target type: `AU16` (16 bits) - = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `zerocopy::include_value` (in Nightly builds, run with -Z macro-backtrace for more info) warning: taking a mutable reference to a `const` item --> $DIR/late-compile-pass.rs:39:66 @@ -64,14 +44,14 @@ warning: taking a mutable reference to a `const` item 39 | const TRANSMUTE_MUT_CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); | ^^^^^^^^^^^^^^^^^ | - = note: `#[warn(const_item_mutation)]` on by default = note: each usage of a `const` item creates a new temporary = note: the mutable reference will refer to this temporary, not the original `const` item note: `const` item defined here --> $DIR/late-compile-pass.rs:36:1 | 36 | const ARRAY_OF_U8S: [u8; 2] = [0u8; 2]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(const_item_mutation)]` on by default error[E0658]: mutable references are not allowed in constants --> $DIR/late-compile-pass.rs:39:66 @@ -81,55 +61,73 @@ error[E0658]: mutable references are not allowed in constants | = note: see issue #57349 for more information -error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants +error[E0015]: cannot call non-const fn `Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut_inference_helper` in constants --> $DIR/late-compile-pass.rs:39:51 | 39 | const TRANSMUTE_MUT_CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants +error[E0015]: cannot call non-const fn `Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut` in constants --> $DIR/late-compile-pass.rs:39:51 | 39 | const TRANSMUTE_MUT_CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0716]: temporary value dropped while borrowed - --> $DIR/late-compile-pass.rs:39:71 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/late-compile-pass.rs:57:41 | -39 | const TRANSMUTE_MUT_CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); - | --------------------^^^^^^^^^^^^- - | | | - | | creates a temporary which is freed while still in use - | temporary value is freed at the end of this statement - | using this value as a constant requires that borrow lasts for `'static` +57 | let _decrease_size: Result = try_transmute!(AU16(0)); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `AU16` (16 bits) + = note: target type: `u8` (8 bits) + = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/late-compile-pass.rs:62:43 + | +62 | let _increase_size: Result = try_transmute!(0u8); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `u8` (8 bits) + = note: target type: `AU16` (16 bits) + = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0597]: `x` does not live long enough - --> $DIR/late-compile-pass.rs:69:60 + --> $DIR/late-compile-pass.rs:68:60 | -69 | let _: &'static mut u64 = zerocopy::transmute_mut!(&mut x); +66 | let mut x = 0u64; + | ----- binding `x` declared here +67 | // It is illegal to increase the lifetime scope. +68 | let _: &'static mut u64 = zerocopy::transmute_mut!(&mut x); | ---------------- ^^^^^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` -70 | -71 | } +69 | +70 | } | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/late-compile-pass.rs:76:56 + --> $DIR/late-compile-pass.rs:75:56 | -76 | let _: &'static u64 = zerocopy::transmute_ref!(&x); +73 | let x = 0u64; + | - binding `x` declared here +74 | // It is illegal to increase the lifetime scope. +75 | let _: &'static u64 = zerocopy::transmute_ref!(&x); | ------------ ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` -77 | -78 | } +76 | +77 | } | - `x` dropped here while still borrowed -error: aborting due to 12 previous errors; 1 warning emitted +error: aborting due to 11 previous errors; 1 warning emitted -Some errors have detailed explanations: E0015, E0512, E0597, E0658, E0716. +Some errors have detailed explanations: E0015, E0512, E0597, E0658. For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/late-compile-pass.nightly.stderr b/tests/ui/late-compile-pass.nightly.stderr index e7eff2774c..06d0e3f981 100644 --- a/tests/ui/late-compile-pass.nightly.stderr +++ b/tests/ui/late-compile-pass.nightly.stderr @@ -56,9 +56,9 @@ error[E0015]: cannot call non-const method `zerocopy::util::macro_util::Wrap::<& = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: transmuting from 4-byte type to 8-byte type: `[u8; 4]` -> `u64` - --> $DIR/late-compile-pass.rs:50:39 + --> $DIR/late-compile-pass.rs:49:39 | -50 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); +49 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `INCLUDE_VALUE_WRONG_SIZE` failed here | = note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `zerocopy::include_value` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -94,9 +94,9 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:50:39 + --> $DIR/late-compile-pass.rs:49:39 | -50 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); +49 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `[u8; 4]` (32 bits) @@ -104,9 +104,9 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `zerocopy::include_value` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:58:41 + --> $DIR/late-compile-pass.rs:57:41 | -58 | let _decrease_size: Result = try_transmute!(AU16(0)); +57 | let _decrease_size: Result = try_transmute!(AU16(0)); | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `AU16` (16 bits) @@ -114,9 +114,9 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:63:43 + --> $DIR/late-compile-pass.rs:62:43 | -63 | let _increase_size: Result = try_transmute!(0u8); +62 | let _increase_size: Result = try_transmute!(0u8); | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `u8` (8 bits) @@ -124,31 +124,31 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0597]: `x` does not live long enough - --> $DIR/late-compile-pass.rs:69:60 + --> $DIR/late-compile-pass.rs:68:60 | -67 | let mut x = 0u64; +66 | let mut x = 0u64; | ----- binding `x` declared here -68 | // It is illegal to increase the lifetime scope. -69 | let _: &'static mut u64 = zerocopy::transmute_mut!(&mut x); +67 | // It is illegal to increase the lifetime scope. +68 | let _: &'static mut u64 = zerocopy::transmute_mut!(&mut x); | ---------------- ^^^^^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` -70 | -71 | } +69 | +70 | } | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/late-compile-pass.rs:76:56 + --> $DIR/late-compile-pass.rs:75:56 | -74 | let x = 0u64; +73 | let x = 0u64; | - binding `x` declared here -75 | // It is illegal to increase the lifetime scope. -76 | let _: &'static u64 = zerocopy::transmute_ref!(&x); +74 | // It is illegal to increase the lifetime scope. +75 | let _: &'static u64 = zerocopy::transmute_ref!(&x); | ------------ ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` -77 | -78 | } +76 | +77 | } | - `x` dropped here while still borrowed error: aborting due to 14 previous errors; 1 warning emitted diff --git a/tests/ui/late-compile-pass.rs b/tests/ui/late-compile-pass.rs index 446e639437..99f6357696 100644 --- a/tests/ui/late-compile-pass.rs +++ b/tests/ui/late-compile-pass.rs @@ -38,13 +38,12 @@ const ARRAY_OF_U8S: [u8; 2] = [0u8; 2]; // `transmute_mut!` cannot, generally speaking, be used in const contexts. const TRANSMUTE_MUT_CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); //~[msrv]^ ERROR: mutable references are not allowed in constants -//~[msrv]^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants -//~[msrv]^^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants -//~[msrv]^^^^ ERROR: temporary value dropped while borrowed -//~[stable]^^^^^ ERROR: cannot call non-const method `Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut_inference_helper` in constants -//~[stable]^^^^^^ ERROR: cannot call non-const method `Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut` in constants -//~[nightly]^^^^^^^ ERROR: cannot call non-const method `zerocopy::util::macro_util::Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut_inference_helper` in constants -//~[nightly]^^^^^^^^ ERROR: cannot call non-const method `zerocopy::util::macro_util::Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut` in constants +//~[msrv]^^ ERROR: cannot call non-const fn `Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut_inference_helper` in constants +//~[msrv]^^^ ERROR: cannot call non-const fn `Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut` in constants +//~[stable]^^^^ ERROR: cannot call non-const method `Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut_inference_helper` in constants +//~[stable]^^^^^ ERROR: cannot call non-const method `Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut` in constants +//~[nightly]^^^^^^ ERROR: cannot call non-const method `zerocopy::util::macro_util::Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut_inference_helper` in constants +//~[nightly]^^^^^^^ ERROR: cannot call non-const method `zerocopy::util::macro_util::Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut` in constants // Should fail because the file is 4 bytes long, not 8. const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); diff --git a/tests/ui/late-compile-pass.stable.stderr b/tests/ui/late-compile-pass.stable.stderr index 16059d628e..89ff67d24b 100644 --- a/tests/ui/late-compile-pass.stable.stderr +++ b/tests/ui/late-compile-pass.stable.stderr @@ -56,9 +56,9 @@ error[E0015]: cannot call non-const method `Wrap::<&mut [u8; 2], &mut [u8; 2]>:: = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: transmuting from 4-byte type to 8-byte type: `[u8; 4]` -> `u64` - --> $DIR/late-compile-pass.rs:50:39 + --> $DIR/late-compile-pass.rs:49:39 | -50 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); +49 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `INCLUDE_VALUE_WRONG_SIZE` failed here | = note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `zerocopy::include_value` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -94,9 +94,9 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:50:39 + --> $DIR/late-compile-pass.rs:49:39 | -50 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); +49 | const INCLUDE_VALUE_WRONG_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `[u8; 4]` (32 bits) @@ -104,9 +104,9 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `zerocopy::include_value` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:58:41 + --> $DIR/late-compile-pass.rs:57:41 | -58 | let _decrease_size: Result = try_transmute!(AU16(0)); +57 | let _decrease_size: Result = try_transmute!(AU16(0)); | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `AU16` (16 bits) @@ -114,9 +114,9 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/late-compile-pass.rs:63:43 + --> $DIR/late-compile-pass.rs:62:43 | -63 | let _increase_size: Result = try_transmute!(0u8); +62 | let _increase_size: Result = try_transmute!(0u8); | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `u8` (8 bits) @@ -124,31 +124,31 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0597]: `x` does not live long enough - --> $DIR/late-compile-pass.rs:69:60 + --> $DIR/late-compile-pass.rs:68:60 | -67 | let mut x = 0u64; +66 | let mut x = 0u64; | ----- binding `x` declared here -68 | // It is illegal to increase the lifetime scope. -69 | let _: &'static mut u64 = zerocopy::transmute_mut!(&mut x); +67 | // It is illegal to increase the lifetime scope. +68 | let _: &'static mut u64 = zerocopy::transmute_mut!(&mut x); | ---------------- ^^^^^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` -70 | -71 | } +69 | +70 | } | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/late-compile-pass.rs:76:56 + --> $DIR/late-compile-pass.rs:75:56 | -74 | let x = 0u64; +73 | let x = 0u64; | - binding `x` declared here -75 | // It is illegal to increase the lifetime scope. -76 | let _: &'static u64 = zerocopy::transmute_ref!(&x); +74 | // It is illegal to increase the lifetime scope. +75 | let _: &'static u64 = zerocopy::transmute_ref!(&x); | ------------ ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` -77 | -78 | } +76 | +77 | } | - `x` dropped here while still borrowed error: aborting due to 14 previous errors; 1 warning emitted diff --git a/tests/ui/max-align.msrv.stderr b/tests/ui/max-align.msrv.stderr index 6d3293d6fe..e22094773e 100644 --- a/tests/ui/max-align.msrv.stderr +++ b/tests/ui/max-align.msrv.stderr @@ -1,9 +1,9 @@ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/max-align.rs:98:11 + --> $DIR/max-align.rs:98:17 | 98 | #[repr(C, align(1073741824))] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0589`. diff --git a/tests/ui/ptr-is-invariant-over-v.msrv.stderr b/tests/ui/ptr-is-invariant-over-v.msrv.stderr index 0fc796788f..1870845063 100644 --- a/tests/ui/ptr-is-invariant-over-v.msrv.stderr +++ b/tests/ui/ptr-is-invariant-over-v.msrv.stderr @@ -1,21 +1,34 @@ -error[E0623]: lifetime mismatch - --> $DIR/ptr-is-invariant-over-v.rs:21:14 +error: lifetime may not live long enough + --> $DIR/ptr-is-invariant-over-v.rs:21:5 | -18 | big: Ptr<'small, &'big u32, (Exclusive, Aligned, Valid)>, - | --------------------------------------------------- these two types are declared with different lifetimes... +17 | fn _when_exclusive<'big: 'small, 'small>( + | ---- ------ lifetime `'small` defined here + | | + | lifetime `'big` defined here ... 21 | _small = big; - | ^^^ ...but data from `big` flows into `big` here + | ^^^^^^^^^^^^ assignment requires that `'small` must outlive `'big` + | + = help: consider adding the following bound: `'small: 'big` + = note: requirement occurs because of the type `Ptr<'_, &u32, (zerocopy::invariant::Exclusive, Aligned, zerocopy::invariant::Valid)>`, which makes the generic argument `&u32` invariant + = note: the struct `Ptr<'a, T, I>` is invariant over the parameter `T` + = help: see for more information about variance -error[E0623]: lifetime mismatch - --> $DIR/ptr-is-invariant-over-v.rs:30:14 +error: lifetime may not live long enough + --> $DIR/ptr-is-invariant-over-v.rs:29:5 | -27 | big: Ptr<'small, &'big u32, (Shared, Aligned, Valid)>, - | ------------------------------------------------ these two types are declared with different lifetimes... +25 | fn _when_shared<'big: 'small, 'small>( + | ---- ------ lifetime `'small` defined here + | | + | lifetime `'big` defined here ... -30 | _small = big; - | ^^^ ...but data from `big` flows into `big` here +29 | _small = big; + | ^^^^^^^^^^^^ assignment requires that `'small` must outlive `'big` + | + = help: consider adding the following bound: `'small: 'big` + = note: requirement occurs because of the type `Ptr<'_, &u32, (Shared, Aligned, zerocopy::invariant::Valid)>`, which makes the generic argument `&u32` invariant + = note: the struct `Ptr<'a, T, I>` is invariant over the parameter `T` + = help: see for more information about variance error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0623`. diff --git a/tests/ui/ptr-is-invariant-over-v.nightly.stderr b/tests/ui/ptr-is-invariant-over-v.nightly.stderr index 7e6c721f33..e29c0a6113 100644 --- a/tests/ui/ptr-is-invariant-over-v.nightly.stderr +++ b/tests/ui/ptr-is-invariant-over-v.nightly.stderr @@ -15,14 +15,14 @@ error: lifetime may not live long enough = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/ptr-is-invariant-over-v.rs:30:5 + --> $DIR/ptr-is-invariant-over-v.rs:29:5 | -26 | fn _when_shared<'big: 'small, 'small>( +25 | fn _when_shared<'big: 'small, 'small>( | ---- ------ lifetime `'small` defined here | | | lifetime `'big` defined here ... -30 | _small = big; +29 | _small = big; | ^^^^^^^^^^^^ assignment requires that `'small` must outlive `'big` | = help: consider adding the following bound: `'small: 'big` diff --git a/tests/ui/ptr-is-invariant-over-v.rs b/tests/ui/ptr-is-invariant-over-v.rs index 1c35881256..2556a2b668 100644 --- a/tests/ui/ptr-is-invariant-over-v.rs +++ b/tests/ui/ptr-is-invariant-over-v.rs @@ -19,8 +19,7 @@ fn _when_exclusive<'big: 'small, 'small>( mut _small: Ptr<'small, &'small u32, (Exclusive, Aligned, Valid)>, ) { _small = big; - //~[msrv]^ ERROR: lifetime mismatch - //~[stable, nightly]^^ ERROR: lifetime may not live long enough + //~[msrv, stable, nightly]^ ERROR: lifetime may not live long enough } fn _when_shared<'big: 'small, 'small>( @@ -28,8 +27,7 @@ fn _when_shared<'big: 'small, 'small>( mut _small: Ptr<'small, &'small u32, (Shared, Aligned, Valid)>, ) { _small = big; - //~[msrv]^ ERROR: lifetime mismatch - //~[stable, nightly]^^ ERROR: lifetime may not live long enough + //~[msrv, stable, nightly]^ ERROR: lifetime may not live long enough } fn main() {} diff --git a/tests/ui/ptr-is-invariant-over-v.stable.stderr b/tests/ui/ptr-is-invariant-over-v.stable.stderr index 3df921ee4c..1870845063 100644 --- a/tests/ui/ptr-is-invariant-over-v.stable.stderr +++ b/tests/ui/ptr-is-invariant-over-v.stable.stderr @@ -15,14 +15,14 @@ error: lifetime may not live long enough = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/ptr-is-invariant-over-v.rs:30:5 + --> $DIR/ptr-is-invariant-over-v.rs:29:5 | -26 | fn _when_shared<'big: 'small, 'small>( +25 | fn _when_shared<'big: 'small, 'small>( | ---- ------ lifetime `'small` defined here | | | lifetime `'big` defined here ... -30 | _small = big; +29 | _small = big; | ^^^^^^^^^^^^ assignment requires that `'small` must outlive `'big` | = help: consider adding the following bound: `'small: 'big` diff --git a/tests/ui/transmute-ptr-to-usize.msrv.stderr b/tests/ui/transmute-ptr-to-usize.msrv.stderr index 4c2b66fd25..89e1d20c8c 100644 --- a/tests/ui/transmute-ptr-to-usize.msrv.stderr +++ b/tests/ui/transmute-ptr-to-usize.msrv.stderr @@ -2,18 +2,23 @@ error[E0277]: the trait bound `*const usize: IntoBytes` is not satisfied --> $DIR/transmute-ptr-to-usize.rs:21:30 | 21 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `*const usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the trait `IntoBytes` is not implemented for `*const usize` + | required by a bound introduced by this call | + = note: Consider adding `#[derive(IntoBytes)]` to `*const usize` + = help: the trait `IntoBytes` is implemented for `usize` note: required by a bound in `POINTER_VALUE::transmute` --> $DIR/transmute-ptr-to-usize.rs:21:30 | 21 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | required by a bound in this - | required by this bound in `POINTER_VALUE::transmute` + | required by a bound in this function + | required by this bound in `transmute` = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmute.msrv.stderr b/tests/ui/transmute.msrv.stderr index d00355220f..86f24fcf9c 100644 --- a/tests/ui/transmute.msrv.stderr +++ b/tests/ui/transmute.msrv.stderr @@ -4,30 +4,55 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied 17 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 79 others note: required by a bound in `DST_NOT_FROM_BYTES::transmute` --> $DIR/transmute.rs:17:41 | 17 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ^^^^^^^^^^^^^^^^^^^ | | - | required by a bound in this - | required by this bound in `DST_NOT_FROM_BYTES::transmute` + | required by a bound in this function + | required by this bound in `transmute` = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: IntoBytes` is not satisfied --> $DIR/transmute.rs:21:32 | 21 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the trait `IntoBytes` is not implemented for `NotZerocopy` + | required by a bound introduced by this call | + = note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 68 others note: required by a bound in `SRC_NOT_AS_BYTES::transmute` --> $DIR/transmute.rs:21:32 | 21 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | required by a bound in this - | required by this bound in `SRC_NOT_AS_BYTES::transmute` + | required by a bound in this function + | required by this bound in `transmute` = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/transmute_mut.msrv.stderr b/tests/ui/transmute_mut.msrv.stderr index 931042c23f..6b7d2a0250 100644 --- a/tests/ui/transmute_mut.msrv.stderr +++ b/tests/ui/transmute_mut.msrv.stderr @@ -19,20 +19,58 @@ error[E0308]: mismatched types = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `DstA: FromBytes` is not satisfied - --> $DIR/transmute_mut.rs:30:39 - | -30 | const DST_NOT_FROM_BYTES: &mut DstA = transmute_mut!(&mut SrcA); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `DstA` - | - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/transmute_mut.rs:30:39 + | +30 | const DST_NOT_FROM_BYTES: &mut DstA = transmute_mut!(&mut SrcA); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `DstA` + | + = note: Consider adding `#[derive(FromBytes)]` to `DstA` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 85 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:801:14 + | +798 | pub fn transmute_mut(self) -> &'a mut Dst + | ------------- required by a bound in this associated function +... +801 | Dst: FromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::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 trait bound `DstB: IntoBytes` is not satisfied - --> $DIR/transmute_mut.rs:42:37 - | -42 | const DST_NOT_AS_BYTES: &mut DstB = transmute_mut!(&mut SrcB); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `DstB` - | - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/transmute_mut.rs:42:37 + | +42 | const DST_NOT_AS_BYTES: &mut DstB = transmute_mut!(&mut SrcB); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `DstB` + | + = note: Consider adding `#[derive(IntoBytes)]` to `DstB` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 74 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:801:26 + | +798 | pub fn transmute_mut(self) -> &'a mut Dst + | ------------- required by a bound in this associated function +... +801 | Dst: FromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` + = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> $DIR/transmute_mut.rs:47:59 @@ -41,11 +79,14 @@ error[E0308]: mismatched types | ---------------^^^^^^- | | | | | expected `&mut _`, found `usize` - | | help: consider mutably borrowing here: `&mut 0usize` | expected due to this | = note: expected mutable reference `&mut _` found type `usize` +help: consider mutably borrowing here + | +47 | const SRC_DST_NOT_REFERENCES: &mut usize = transmute_mut!(&mut 0usize); + | ++++ error[E0308]: mismatched types --> $DIR/transmute_mut.rs:58:53 @@ -54,43 +95,84 @@ error[E0308]: mismatched types | ---------------^^^^^^- | | | | | expected `&mut _`, found `usize` - | | help: consider mutably borrowing here: `&mut 0usize` | expected due to this | = note: expected mutable reference `&mut _` found type `usize` +help: consider mutably borrowing here + | +58 | const SRC_NOT_A_REFERENCE: &mut u8 = transmute_mut!(&mut 0usize); + | ++++ error[E0277]: the trait bound `SrcC: FromBytes` is not satisfied - --> $DIR/transmute_mut.rs:70:39 - | -70 | const SRC_NOT_FROM_BYTES: &mut DstC = transmute_mut!(&mut SrcC); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `SrcC` - | - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/transmute_mut.rs:70:39 + | +70 | const SRC_NOT_FROM_BYTES: &mut DstC = transmute_mut!(&mut SrcC); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `SrcC` + | + = note: Consider adding `#[derive(FromBytes)]` to `SrcC` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 85 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:800:14 + | +798 | pub fn transmute_mut(self) -> &'a mut Dst + | ------------- required by a bound in this associated function +799 | where +800 | Src: FromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::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 trait bound `SrcD: IntoBytes` is not satisfied - --> $DIR/transmute_mut.rs:82:37 - | -82 | const SRC_NOT_AS_BYTES: &mut DstD = transmute_mut!(&mut SrcD); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `SrcD` - | - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/transmute_mut.rs:82:37 + | +82 | const SRC_NOT_AS_BYTES: &mut DstD = transmute_mut!(&mut SrcD); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `SrcD` + | + = note: Consider adding `#[derive(IntoBytes)]` to `SrcD` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 74 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:800:26 + | +798 | pub fn transmute_mut(self) -> &'a mut Dst + | ------------- required by a bound in this associated function +799 | where +800 | Src: FromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` + = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: the method `transmute_mut` exists for struct `Wrap<&mut [u8], &mut [u8; 1]>`, but its trait bounds were not satisfied --> $DIR/transmute_mut.rs:87:35 | 87 | const SRC_UNSIZED: &mut [u8; 1] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `Wrap<&mut [u8], &mut [u8; 1]>` due to unsatisfied trait bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $WORKSPACE/src/util/macro_util.rs:692:1 + ::: $WORKSPACE/src/util/macro_util.rs:681:1 | -692 | pub struct Wrap(pub Src, pub PhantomData); - | --------------------------------------------------------- doesn't satisfy `Wrap<&mut [u8], &mut [u8; 1]>: TransmuteMutDst` +681 | pub struct Wrap(pub Src, pub PhantomData); + | ------------------------- doesn't satisfy `Wrap<&mut [u8], &mut [u8; 1]>: TransmuteMutDst<'_>` | = note: the following trait bounds were not satisfied: `[u8]: Sized` `<[u8; 1] as KnownLayout>::PointerMetadata = usize` - which is required by `Wrap<&mut [u8], &mut [u8; 1]>: TransmuteMutDst` + which is required by `Wrap<&mut [u8], &mut [u8; 1]>: TransmuteMutDst<'_>` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types diff --git a/tests/ui/transmute_mut.nightly.stderr b/tests/ui/transmute_mut.nightly.stderr index a8583191ba..de1aa43eef 100644 --- a/tests/ui/transmute_mut.nightly.stderr +++ b/tests/ui/transmute_mut.nightly.stderr @@ -41,12 +41,12 @@ help: the trait `FromBytes` is not implemented for `DstA` (A, B, C, D, E, F, G, H) and 85 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` - --> src/util/macro_util.rs:812:14 + --> src/util/macro_util.rs:801:14 | -809 | pub fn transmute_mut(self) -> &'a mut Dst +798 | pub fn transmute_mut(self) -> &'a mut Dst | ------------- required by a bound in this associated function ... -812 | Dst: FromBytes + IntoBytes, +801 | Dst: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -73,12 +73,12 @@ help: the trait `IntoBytes` is not implemented for `DstB` AtomicIsize and 74 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` - --> src/util/macro_util.rs:812:26 + --> src/util/macro_util.rs:801:26 | -809 | pub fn transmute_mut(self) -> &'a mut Dst +798 | pub fn transmute_mut(self) -> &'a mut Dst | ------------- required by a bound in this associated function ... -812 | Dst: FromBytes + IntoBytes, +801 | Dst: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -149,12 +149,12 @@ help: the trait `FromBytes` is not implemented for `SrcC` (A, B, C, D, E, F, G, H) and 85 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` - --> src/util/macro_util.rs:811:14 + --> src/util/macro_util.rs:800:14 | -809 | pub fn transmute_mut(self) -> &'a mut Dst +798 | pub fn transmute_mut(self) -> &'a mut Dst | ------------- required by a bound in this associated function -810 | where -811 | Src: FromBytes + IntoBytes, +799 | where +800 | Src: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -181,12 +181,12 @@ help: the trait `IntoBytes` is not implemented for `SrcD` AtomicIsize and 74 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` - --> src/util/macro_util.rs:811:26 + --> src/util/macro_util.rs:800:26 | -809 | pub fn transmute_mut(self) -> &'a mut Dst +798 | pub fn transmute_mut(self) -> &'a mut Dst | ------------- required by a bound in this associated function -810 | where -811 | Src: FromBytes + IntoBytes, +799 | where +800 | Src: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -196,9 +196,9 @@ error[E0599]: the method `transmute_mut` exists for struct `zerocopy::util::macr 87 | const SRC_UNSIZED: &mut [u8; 1] = transmute_mut!(&mut [0u8][..]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: src/util/macro_util.rs:692:1 + ::: src/util/macro_util.rs:681:1 | -692 | pub struct Wrap(pub Src, pub PhantomData); +681 | pub struct Wrap(pub Src, pub PhantomData); | ------------------------- doesn't satisfy `_: TransmuteMutDst<'_>` | = note: the following trait bounds were not satisfied: diff --git a/tests/ui/transmute_mut.stable.stderr b/tests/ui/transmute_mut.stable.stderr index d1bdd85b24..1671505084 100644 --- a/tests/ui/transmute_mut.stable.stderr +++ b/tests/ui/transmute_mut.stable.stderr @@ -41,12 +41,12 @@ help: the trait `FromBytes` is not implemented for `DstA` (A, B, C, D, E, F, G, H) and 85 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:812:14 + --> $WORKSPACE/src/util/macro_util.rs:801:14 | -809 | pub fn transmute_mut(self) -> &'a mut Dst +798 | pub fn transmute_mut(self) -> &'a mut Dst | ------------- required by a bound in this associated function ... -812 | Dst: FromBytes + IntoBytes, +801 | Dst: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -73,12 +73,12 @@ help: the trait `IntoBytes` is not implemented for `DstB` AtomicIsize and 74 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:812:26 + --> $WORKSPACE/src/util/macro_util.rs:801:26 | -809 | pub fn transmute_mut(self) -> &'a mut Dst +798 | pub fn transmute_mut(self) -> &'a mut Dst | ------------- required by a bound in this associated function ... -812 | Dst: FromBytes + IntoBytes, +801 | Dst: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -149,12 +149,12 @@ help: the trait `FromBytes` is not implemented for `SrcC` (A, B, C, D, E, F, G, H) and 85 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:811:14 + --> $WORKSPACE/src/util/macro_util.rs:800:14 | -809 | pub fn transmute_mut(self) -> &'a mut Dst +798 | pub fn transmute_mut(self) -> &'a mut Dst | ------------- required by a bound in this associated function -810 | where -811 | Src: FromBytes + IntoBytes, +799 | where +800 | Src: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -181,12 +181,12 @@ help: the trait `IntoBytes` is not implemented for `SrcD` AtomicIsize and 74 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:811:26 + --> $WORKSPACE/src/util/macro_util.rs:800:26 | -809 | pub fn transmute_mut(self) -> &'a mut Dst +798 | pub fn transmute_mut(self) -> &'a mut Dst | ------------- required by a bound in this associated function -810 | where -811 | Src: FromBytes + IntoBytes, +799 | where +800 | Src: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -196,9 +196,9 @@ error[E0599]: the method `transmute_mut` exists for struct `Wrap<&mut [u8], &mut 87 | const SRC_UNSIZED: &mut [u8; 1] = transmute_mut!(&mut [0u8][..]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $WORKSPACE/src/util/macro_util.rs:692:1 + ::: $WORKSPACE/src/util/macro_util.rs:681:1 | -692 | pub struct Wrap(pub Src, pub PhantomData); +681 | pub struct Wrap(pub Src, pub PhantomData); | ------------------------- doesn't satisfy `Wrap<&mut [u8], &mut [u8; 1]>: TransmuteMutDst<'_>` | = note: the following trait bounds were not satisfied: diff --git a/tests/ui/transmute_ref.msrv.stderr b/tests/ui/transmute_ref.msrv.stderr index d70436009a..f1192b4cd0 100644 --- a/tests/ui/transmute_ref.msrv.stderr +++ b/tests/ui/transmute_ref.msrv.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/transmute_ref.rs:29:36 | 29 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` @@ -12,7 +12,7 @@ error[E0308]: mismatched types --> $DIR/transmute_ref.rs:29:36 | 29 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/transmute_ref.rs:29:36 | 29 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/transmute_ref.rs:29:36 | 29 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` @@ -42,26 +42,54 @@ error[E0277]: the trait bound `DstA: FromBytes` is not satisfied --> $DIR/transmute_ref.rs:40:35 | 40 | const DST_NOT_FROM_BYTES: &DstA = transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `DstA` - | -note: required by `DST_NOT_FROM_BYTES::AssertDstIsFromBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the trait `FromBytes` is not implemented for `DstA` + | required by a bound introduced by this call + | + = note: Consider adding `#[derive(FromBytes)]` to `DstA` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 80 others +note: required by a bound in `DST_NOT_FROM_BYTES::AssertDstIsFromBytes` --> $DIR/transmute_ref.rs:40:35 | 40 | const DST_NOT_FROM_BYTES: &DstA = transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsFromBytes` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `DstB: Immutable` is not satisfied --> $DIR/transmute_ref.rs:48:34 | 48 | const DST_NOT_IMMUTABLE: &DstB = transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `DstB` - | -note: required by `DST_NOT_IMMUTABLE::AssertDstIsImmutable` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the trait `Immutable` is not implemented for `DstB` + | required by a bound introduced by this call + | + = note: Consider adding `#[derive(Immutable)]` to `DstB` + = help: the following other types implement trait `Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 130 others +note: required by a bound in `DST_NOT_IMMUTABLE::AssertDstIsImmutable` --> $DIR/transmute_ref.rs:48:34 | 48 | const DST_NOT_IMMUTABLE: &DstB = transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsImmutable` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types @@ -70,18 +98,21 @@ error[E0308]: mismatched types 53 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); | ---------------^^^^^^- | | | - | | expected reference, found `usize` - | | help: consider borrowing here: `&0usize` + | | expected `&_`, found `usize` | expected due to this | = note: expected reference `&_` found type `usize` +help: consider borrowing here + | +53 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(&0usize); + | + error[E0308]: mismatched types --> $DIR/transmute_ref.rs:53:39 | 53 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` @@ -91,7 +122,7 @@ error[E0308]: mismatched types --> $DIR/transmute_ref.rs:53:39 | 53 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` @@ -101,7 +132,7 @@ error[E0308]: mismatched types --> $DIR/transmute_ref.rs:53:39 | 53 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` @@ -111,7 +142,7 @@ error[E0308]: mismatched types --> $DIR/transmute_ref.rs:53:39 | 53 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` @@ -123,24 +154,41 @@ error[E0308]: mismatched types 62 | const SRC_NOT_A_REFERENCE: &u8 = transmute_ref!(0usize); | ---------------^^^^^^- | | | - | | expected reference, found `usize` - | | help: consider borrowing here: `&0usize` + | | expected `&_`, found `usize` | expected due to this | = note: expected reference `&_` found type `usize` +help: consider borrowing here + | +62 | const SRC_NOT_A_REFERENCE: &u8 = transmute_ref!(&0usize); + | + error[E0277]: the trait bound `SrcA: IntoBytes` is not satisfied --> $DIR/transmute_ref.rs:70:33 | 70 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&SrcA(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `SrcA` - | -note: required by `SRC_NOT_AS_BYTES::AssertSrcIsIntoBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the trait `IntoBytes` is not implemented for `SrcA` + | required by a bound introduced by this call + | + = note: Consider adding `#[derive(IntoBytes)]` to `SrcA` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 69 others +note: required by a bound in `SRC_NOT_AS_BYTES::AssertSrcIsIntoBytes` --> $DIR/transmute_ref.rs:70:33 | 70 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&SrcA(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsIntoBytes` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `SrcA: IntoBytes` is not satisfied @@ -149,24 +197,49 @@ error[E0277]: the trait bound `SrcA: IntoBytes` is not satisfied 70 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&SrcA(AU16(0))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `SrcA` | + = note: Consider adding `#[derive(IntoBytes)]` to `SrcA` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 69 others note: required by a bound in `SRC_NOT_AS_BYTES::AssertSrcIsIntoBytes` --> $DIR/transmute_ref.rs:70:33 | 70 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&SrcA(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `SRC_NOT_AS_BYTES::AssertSrcIsIntoBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsIntoBytes` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `SrcB: Immutable` is not satisfied --> $DIR/transmute_ref.rs:79:34 | 79 | const SRC_NOT_IMMUTABLE: &AU16 = transmute_ref!(&SrcB(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `Immutable` - | -note: required by `SRC_NOT_IMMUTABLE::AssertSrcIsImmutable` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the trait `Immutable` is not implemented for `SrcB` + | required by a bound introduced by this call + | + = note: Consider adding `#[derive(Immutable)]` to `SrcB` + = help: the following other types implement trait `Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 130 others +note: required by a bound in `SRC_NOT_IMMUTABLE::AssertSrcIsImmutable` --> $DIR/transmute_ref.rs:79:34 | 79 | const SRC_NOT_IMMUTABLE: &AU16 = transmute_ref!(&SrcB(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsImmutable` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `SrcB: Immutable` is not satisfied @@ -175,28 +248,39 @@ error[E0277]: the trait bound `SrcB: Immutable` is not satisfied 79 | const SRC_NOT_IMMUTABLE: &AU16 = transmute_ref!(&SrcB(AU16(0))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `SrcB` | + = note: Consider adding `#[derive(Immutable)]` to `SrcB` + = help: the following other types implement trait `Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 130 others note: required by a bound in `SRC_NOT_IMMUTABLE::AssertSrcIsImmutable` --> $DIR/transmute_ref.rs:79:34 | 79 | const SRC_NOT_IMMUTABLE: &AU16 = transmute_ref!(&SrcB(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `SRC_NOT_IMMUTABLE::AssertSrcIsImmutable` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsImmutable` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: the method `transmute_ref` exists for struct `Wrap<&[u8], &[u8; 1]>`, but its trait bounds were not satisfied --> $DIR/transmute_ref.rs:84:31 | 84 | const SRC_UNSIZED: &[u8; 1] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `Wrap<&[u8], &[u8; 1]>` due to unsatisfied trait bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $WORKSPACE/src/util/macro_util.rs:692:1 + ::: $WORKSPACE/src/util/macro_util.rs:681:1 | -692 | pub struct Wrap(pub Src, pub PhantomData); - | --------------------------------------------------------- doesn't satisfy `Wrap<&[u8], &[u8; 1]>: TransmuteRefDst` +681 | pub struct Wrap(pub Src, pub PhantomData); + | ------------------------- doesn't satisfy `Wrap<&[u8], &[u8; 1]>: TransmuteRefDst<'_>` | = note: the following trait bounds were not satisfied: `[u8]: Sized` `<[u8; 1] as KnownLayout>::PointerMetadata = usize` - which is required by `Wrap<&[u8], &[u8; 1]>: TransmuteRefDst` + which is required by `Wrap<&[u8], &[u8; 1]>: TransmuteRefDst<'_>` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types diff --git a/tests/ui/transmute_ref.nightly.stderr b/tests/ui/transmute_ref.nightly.stderr index 1fc9242ec6..ce9c63083d 100644 --- a/tests/ui/transmute_ref.nightly.stderr +++ b/tests/ui/transmute_ref.nightly.stderr @@ -342,9 +342,9 @@ error[E0599]: the method `transmute_ref` exists for struct `zerocopy::util::macr 84 | const SRC_UNSIZED: &[u8; 1] = transmute_ref!(&[0u8][..]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: src/util/macro_util.rs:692:1 + ::: src/util/macro_util.rs:681:1 | -692 | pub struct Wrap(pub Src, pub PhantomData); +681 | pub struct Wrap(pub Src, pub PhantomData); | ------------------------- doesn't satisfy `_: TransmuteRefDst<'_>` | = note: the following trait bounds were not satisfied: diff --git a/tests/ui/transmute_ref.stable.stderr b/tests/ui/transmute_ref.stable.stderr index da4ab8025d..c32ba4576b 100644 --- a/tests/ui/transmute_ref.stable.stderr +++ b/tests/ui/transmute_ref.stable.stderr @@ -342,9 +342,9 @@ error[E0599]: the method `transmute_ref` exists for struct `Wrap<&[u8], &[u8; 1] 84 | const SRC_UNSIZED: &[u8; 1] = transmute_ref!(&[0u8][..]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $WORKSPACE/src/util/macro_util.rs:692:1 + ::: $WORKSPACE/src/util/macro_util.rs:681:1 | -692 | pub struct Wrap(pub Src, pub PhantomData); +681 | pub struct Wrap(pub Src, pub PhantomData); | ------------------------- doesn't satisfy `Wrap<&[u8], &[u8; 1]>: TransmuteRefDst<'_>` | = note: the following trait bounds were not satisfied: diff --git a/tests/ui/try_transmute.msrv.stderr b/tests/ui/try_transmute.msrv.stderr index 2497483105..7993e9ea46 100644 --- a/tests/ui/try_transmute.msrv.stderr +++ b/tests/ui/try_transmute.msrv.stderr @@ -1,22 +1,20 @@ -error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied - --> $DIR/try_transmute.rs:15:58 - | -15 | let dst_not_try_from_bytes: Result = try_transmute!(AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` - | -note: required by a bound in `try_transmute` - --> $WORKSPACE/src/util/macro_util.rs:526:10 - | -526 | Dst: TryFromBytes, - | ^^^^^^^^^^^^ required by this bound in `try_transmute` - = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied --> $DIR/try_transmute.rs:15:33 | 15 | let dst_not_try_from_bytes: Result = try_transmute!(AU16(0)); | ^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 153 others note: required by a bound in `ValidityError` --> $WORKSPACE/src/error.rs:588:45 | @@ -29,6 +27,44 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied 15 | let dst_not_try_from_bytes: Result = try_transmute!(AU16(0)); | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 153 others +note: required by a bound in `try_transmute` + --> $WORKSPACE/src/util/macro_util.rs:515:10 + | +512 | pub fn try_transmute(src: Src) -> Result> + | ------------- required by a bound in this function +... +515 | Dst: TryFromBytes, + | ^^^^^^^^^^^^ required by this bound in `try_transmute` + = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied + --> $DIR/try_transmute.rs:15:58 + | +15 | let dst_not_try_from_bytes: Result = try_transmute!(AU16(0)); + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` + | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 153 others note: required by a bound in `ValidityError` --> $WORKSPACE/src/error.rs:588:45 | @@ -42,10 +78,24 @@ error[E0277]: the trait bound `NotZerocopy: IntoBytes` is not satisfied 21 | let src_not_into_bytes: Result = try_transmute!(NotZerocopy(AU16(0))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 68 others note: required by a bound in `try_transmute` - --> $WORKSPACE/src/util/macro_util.rs:525:10 + --> $WORKSPACE/src/util/macro_util.rs:514:10 | -525 | Src: IntoBytes, +512 | pub fn try_transmute(src: Src) -> Result> + | ------------- required by a bound in this function +513 | where +514 | Src: IntoBytes, | ^^^^^^^^^ required by this bound in `try_transmute` = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/try_transmute.nightly.stderr b/tests/ui/try_transmute.nightly.stderr index 7d4b5262a1..0b7c1e0e5a 100644 --- a/tests/ui/try_transmute.nightly.stderr +++ b/tests/ui/try_transmute.nightly.stderr @@ -49,12 +49,12 @@ help: the trait `TryFromBytes` is not implemented for `NotZerocopy` (A, B, C, D, E, F, G, H) and 153 others note: required by a bound in `zerocopy::util::macro_util::try_transmute` - --> src/util/macro_util.rs:526:10 + --> src/util/macro_util.rs:515:10 | -523 | pub fn try_transmute(src: Src) -> Result> +512 | pub fn try_transmute(src: Src) -> Result> | ------------- required by a bound in this function ... -526 | Dst: TryFromBytes, +515 | Dst: TryFromBytes, | ^^^^^^^^^^^^ required by this bound in `try_transmute` = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -110,12 +110,12 @@ help: the trait `IntoBytes` is not implemented for `NotZerocopy` AtomicIsize and 68 others note: required by a bound in `zerocopy::util::macro_util::try_transmute` - --> src/util/macro_util.rs:525:10 + --> src/util/macro_util.rs:514:10 | -523 | pub fn try_transmute(src: Src) -> Result> +512 | pub fn try_transmute(src: Src) -> Result> | ------------- required by a bound in this function -524 | where -525 | Src: IntoBytes, +513 | where +514 | Src: IntoBytes, | ^^^^^^^^^ required by this bound in `try_transmute` = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/try_transmute.stable.stderr b/tests/ui/try_transmute.stable.stderr index 321254e8c4..fd18ec11d1 100644 --- a/tests/ui/try_transmute.stable.stderr +++ b/tests/ui/try_transmute.stable.stderr @@ -49,12 +49,12 @@ help: the trait `TryFromBytes` is not implemented for `NotZerocopy` (A, B, C, D, E, F, G, H) and 153 others note: required by a bound in `try_transmute` - --> $WORKSPACE/src/util/macro_util.rs:526:10 + --> $WORKSPACE/src/util/macro_util.rs:515:10 | -523 | pub fn try_transmute(src: Src) -> Result> +512 | pub fn try_transmute(src: Src) -> Result> | ------------- required by a bound in this function ... -526 | Dst: TryFromBytes, +515 | Dst: TryFromBytes, | ^^^^^^^^^^^^ required by this bound in `try_transmute` = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -110,12 +110,12 @@ help: the trait `IntoBytes` is not implemented for `NotZerocopy` AtomicIsize and 68 others note: required by a bound in `try_transmute` - --> $WORKSPACE/src/util/macro_util.rs:525:10 + --> $WORKSPACE/src/util/macro_util.rs:514:10 | -523 | pub fn try_transmute(src: Src) -> Result> +512 | pub fn try_transmute(src: Src) -> Result> | ------------- required by a bound in this function -524 | where -525 | Src: IntoBytes, +513 | where +514 | Src: IntoBytes, | ^^^^^^^^^ required by this bound in `try_transmute` = note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/try_transmute_mut.msrv.stderr b/tests/ui/try_transmute_mut.msrv.stderr index 6a2edd1801..f4f285041d 100644 --- a/tests/ui/try_transmute_mut.msrv.stderr +++ b/tests/ui/try_transmute_mut.msrv.stderr @@ -1,18 +1,56 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied - --> $DIR/try_transmute_mut.rs:18:63 - | -18 | let dst_not_try_from_bytes: Result<&mut NotZerocopy, _> = try_transmute_mut!(src); - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` - | - = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_mut.rs:18:63 + | +18 | let dst_not_try_from_bytes: Result<&mut NotZerocopy, _> = try_transmute_mut!(src); + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` + | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 156 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:824:14 + | +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> + | ----------------- required by a bound in this associated function +... +824 | Dst: TryFromBytes + IntoBytes, + | ^^^^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` + = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: IntoBytes` is not satisfied - --> $DIR/try_transmute_mut.rs:18:63 - | -18 | let dst_not_try_from_bytes: Result<&mut NotZerocopy, _> = try_transmute_mut!(src); - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` - | - = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_mut.rs:18:63 + | +18 | let dst_not_try_from_bytes: Result<&mut NotZerocopy, _> = try_transmute_mut!(src); + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` + | + = note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 69 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:824:29 + | +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> + | ----------------- required by a bound in this associated function +... +824 | Dst: TryFromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` + = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied --> $DIR/try_transmute_mut.rs:18:33 @@ -20,6 +58,17 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied 18 | let dst_not_try_from_bytes: Result<&mut NotZerocopy, _> = try_transmute_mut!(src); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 156 others note: required by a bound in `ValidityError` --> $WORKSPACE/src/error.rs:588:45 | @@ -32,6 +81,17 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied 18 | let dst_not_try_from_bytes: Result<&mut NotZerocopy, _> = try_transmute_mut!(src); | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 156 others note: required by a bound in `ValidityError` --> $WORKSPACE/src/error.rs:588:45 | @@ -40,36 +100,112 @@ note: required by a bound in `ValidityError` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `SrcA: FromBytes` is not satisfied - --> $DIR/try_transmute_mut.rs:33:41 - | -33 | let src_not_from_bytes: &mut DstA = try_transmute_mut!(&mut SrcA).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `SrcA` - | - = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_mut.rs:33:41 + | +33 | let src_not_from_bytes: &mut DstA = try_transmute_mut!(&mut SrcA).unwrap(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `SrcA` + | + = note: Consider adding `#[derive(FromBytes)]` to `SrcA` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 80 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:823:14 + | +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> + | ----------------- required by a bound in this associated function +822 | where +823 | Src: FromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` + = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `DstA: IntoBytes` is not satisfied - --> $DIR/try_transmute_mut.rs:33:41 - | -33 | let src_not_from_bytes: &mut DstA = try_transmute_mut!(&mut SrcA).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `DstA` - | - = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_mut.rs:33:41 + | +33 | let src_not_from_bytes: &mut DstA = try_transmute_mut!(&mut SrcA).unwrap(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `DstA` + | + = note: Consider adding `#[derive(IntoBytes)]` to `DstA` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 69 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:824:29 + | +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> + | ----------------- required by a bound in this associated function +... +824 | Dst: TryFromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` + = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `SrcB: IntoBytes` is not satisfied - --> $DIR/try_transmute_mut.rs:46:41 - | -46 | let src_not_from_bytes: &mut DstB = try_transmute_mut!(&mut SrcB).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `SrcB` - | - = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_mut.rs:46:41 + | +46 | let src_not_from_bytes: &mut DstB = try_transmute_mut!(&mut SrcB).unwrap(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `SrcB` + | + = note: Consider adding `#[derive(IntoBytes)]` to `SrcB` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 69 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:823:26 + | +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> + | ----------------- required by a bound in this associated function +822 | where +823 | Src: FromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` + = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `DstB: IntoBytes` is not satisfied - --> $DIR/try_transmute_mut.rs:46:41 - | -46 | let src_not_from_bytes: &mut DstB = try_transmute_mut!(&mut SrcB).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `DstB` - | - = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_mut.rs:46:41 + | +46 | let src_not_from_bytes: &mut DstB = try_transmute_mut!(&mut SrcB).unwrap(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `DstB` + | + = note: Consider adding `#[derive(IntoBytes)]` to `DstB` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 69 others +note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` + --> $WORKSPACE/src/util/macro_util.rs:824:29 + | +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> + | ----------------- required by a bound in this associated function +... +824 | Dst: TryFromBytes + IntoBytes, + | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` + = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors diff --git a/tests/ui/try_transmute_mut.nightly.stderr b/tests/ui/try_transmute_mut.nightly.stderr index 75ff6d63ee..6941406d75 100644 --- a/tests/ui/try_transmute_mut.nightly.stderr +++ b/tests/ui/try_transmute_mut.nightly.stderr @@ -21,12 +21,12 @@ help: the trait `TryFromBytes` is not implemented for `NotZerocopy` (A, B, C, D, E, F, G, H) and 156 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> src/util/macro_util.rs:835:14 + --> src/util/macro_util.rs:824:14 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function ... -835 | Dst: TryFromBytes + IntoBytes, +824 | Dst: TryFromBytes + IntoBytes, | ^^^^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -53,12 +53,12 @@ help: the trait `IntoBytes` is not implemented for `NotZerocopy` AtomicIsize and 69 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> src/util/macro_util.rs:835:29 + --> src/util/macro_util.rs:824:29 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function ... -835 | Dst: TryFromBytes + IntoBytes, +824 | Dst: TryFromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -142,12 +142,12 @@ help: the trait `FromBytes` is not implemented for `SrcA` (A, B, C, D, E, F, G, H) and 80 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> src/util/macro_util.rs:834:14 + --> src/util/macro_util.rs:823:14 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function -833 | where -834 | Src: FromBytes + IntoBytes, +822 | where +823 | Src: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -174,12 +174,12 @@ help: the trait `IntoBytes` is not implemented for `DstA` AtomicIsize and 69 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> src/util/macro_util.rs:835:29 + --> src/util/macro_util.rs:824:29 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function ... -835 | Dst: TryFromBytes + IntoBytes, +824 | Dst: TryFromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -206,12 +206,12 @@ help: the trait `IntoBytes` is not implemented for `SrcB` AtomicIsize and 69 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> src/util/macro_util.rs:834:26 + --> src/util/macro_util.rs:823:26 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function -833 | where -834 | Src: FromBytes + IntoBytes, +822 | where +823 | Src: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -238,12 +238,12 @@ help: the trait `IntoBytes` is not implemented for `DstB` AtomicIsize and 69 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> src/util/macro_util.rs:835:29 + --> src/util/macro_util.rs:824:29 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function ... -835 | Dst: TryFromBytes + IntoBytes, +824 | Dst: TryFromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/try_transmute_mut.stable.stderr b/tests/ui/try_transmute_mut.stable.stderr index bf8bd8f1fe..2f1d2897b3 100644 --- a/tests/ui/try_transmute_mut.stable.stderr +++ b/tests/ui/try_transmute_mut.stable.stderr @@ -21,12 +21,12 @@ help: the trait `TryFromBytes` is not implemented for `NotZerocopy` (A, B, C, D, E, F, G, H) and 156 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:835:14 + --> $WORKSPACE/src/util/macro_util.rs:824:14 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function ... -835 | Dst: TryFromBytes + IntoBytes, +824 | Dst: TryFromBytes + IntoBytes, | ^^^^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -53,12 +53,12 @@ help: the trait `IntoBytes` is not implemented for `NotZerocopy` AtomicIsize and 69 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:835:29 + --> $WORKSPACE/src/util/macro_util.rs:824:29 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function ... -835 | Dst: TryFromBytes + IntoBytes, +824 | Dst: TryFromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -142,12 +142,12 @@ help: the trait `FromBytes` is not implemented for `SrcA` (A, B, C, D, E, F, G, H) and 80 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:834:14 + --> $WORKSPACE/src/util/macro_util.rs:823:14 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function -833 | where -834 | Src: FromBytes + IntoBytes, +822 | where +823 | Src: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -174,12 +174,12 @@ help: the trait `IntoBytes` is not implemented for `DstA` AtomicIsize and 69 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:835:29 + --> $WORKSPACE/src/util/macro_util.rs:824:29 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function ... -835 | Dst: TryFromBytes + IntoBytes, +824 | Dst: TryFromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -206,12 +206,12 @@ help: the trait `IntoBytes` is not implemented for `SrcB` AtomicIsize and 69 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:834:26 + --> $WORKSPACE/src/util/macro_util.rs:823:26 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function -833 | where -834 | Src: FromBytes + IntoBytes, +822 | where +823 | Src: FromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -238,12 +238,12 @@ help: the trait `IntoBytes` is not implemented for `DstB` AtomicIsize and 69 others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::try_transmute_mut` - --> $WORKSPACE/src/util/macro_util.rs:835:29 + --> $WORKSPACE/src/util/macro_util.rs:824:29 | -832 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> +821 | pub fn try_transmute_mut(self) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>> | ----------------- required by a bound in this associated function ... -835 | Dst: TryFromBytes + IntoBytes, +824 | Dst: TryFromBytes + IntoBytes, | ^^^^^^^^^ required by this bound in `Wrap::<&mut Src, &mut Dst>::try_transmute_mut` = note: this error originates in the macro `try_transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/try_transmute_ref.msrv.stderr b/tests/ui/try_transmute_ref.msrv.stderr index aca2936efe..0eb99dc502 100644 --- a/tests/ui/try_transmute_ref.msrv.stderr +++ b/tests/ui/try_transmute_ref.msrv.stderr @@ -1,41 +1,73 @@ error[E0308]: mismatched types - --> $DIR/try_transmute_ref.rs:19:33 - | -19 | let _: Result<&mut u8, _> = try_transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability - | - = note: expected mutable reference `&mut u8` - found reference `&_` - = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) + --> tests$RUSTUP_TOOLCHAIN/lib/rustlib/src/rust/library/core/src/result.rs:506:5 + | +506 | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), + | ^^ + = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> $DIR/try_transmute_ref.rs:19:33 | 19 | let _: Result<&mut u8, _> = try_transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | types differ in mutability - | help: try using a variant of the expected enum: `Err(t.try_transmute_ref())` + | ^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | = note: expected enum `Result<&mut u8, _>` found enum `Result<&_, ValidityError<&u8, _>>` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied - --> $DIR/try_transmute_ref.rs:25:59 - | -25 | let dst_not_try_from_bytes: Result<&NotZerocopy, _> = try_transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` - | - = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_ref.rs:25:59 + | +25 | let dst_not_try_from_bytes: Result<&NotZerocopy, _> = try_transmute_ref!(&AU16(0)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` + | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 153 others +note: required by a bound in `Wrap::<&'a Src, &'a Dst>::try_transmute_ref` + --> $WORKSPACE/src/util/macro_util.rs:744:14 + | +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> + | ----------------- required by a bound in this associated function +... +744 | Dst: TryFromBytes + Immutable, + | ^^^^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` + = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: Immutable` is not satisfied - --> $DIR/try_transmute_ref.rs:25:59 - | -25 | let dst_not_try_from_bytes: Result<&NotZerocopy, _> = try_transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `NotZerocopy` - | - = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_ref.rs:25:59 + | +25 | let dst_not_try_from_bytes: Result<&NotZerocopy, _> = try_transmute_ref!(&AU16(0)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `NotZerocopy` + | + = note: Consider adding `#[derive(Immutable)]` to `NotZerocopy` + = help: the following other types implement trait `Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 128 others +note: required by a bound in `Wrap::<&'a Src, &'a Dst>::try_transmute_ref` + --> $WORKSPACE/src/util/macro_util.rs:744:29 + | +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> + | ----------------- required by a bound in this associated function +... +744 | Dst: TryFromBytes + Immutable, + | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` + = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied --> $DIR/try_transmute_ref.rs:25:33 @@ -43,6 +75,17 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied 25 | let dst_not_try_from_bytes: Result<&NotZerocopy, _> = try_transmute_ref!(&AU16(0)); | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 153 others note: required by a bound in `ValidityError` --> $WORKSPACE/src/error.rs:588:45 | @@ -55,6 +98,17 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied 25 | let dst_not_try_from_bytes: Result<&NotZerocopy, _> = try_transmute_ref!(&AU16(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 153 others note: required by a bound in `ValidityError` --> $WORKSPACE/src/error.rs:588:45 | @@ -63,20 +117,58 @@ note: required by a bound in `ValidityError` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: IntoBytes` is not satisfied - --> $DIR/try_transmute_ref.rs:33:48 - | -33 | let src_not_into_bytes: Result<&AU16, _> = try_transmute_ref!(&NotZerocopy(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` - | - = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_ref.rs:33:48 + | +33 | let src_not_into_bytes: Result<&AU16, _> = try_transmute_ref!(&NotZerocopy(AU16(0))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` + | + = note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy` + = help: the following other types implement trait `IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 68 others +note: required by a bound in `Wrap::<&'a Src, &'a Dst>::try_transmute_ref` + --> $WORKSPACE/src/util/macro_util.rs:743:14 + | +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> + | ----------------- required by a bound in this associated function +742 | where +743 | Src: IntoBytes + Immutable, + | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` + = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: Immutable` is not satisfied - --> $DIR/try_transmute_ref.rs:33:48 - | -33 | let src_not_into_bytes: Result<&AU16, _> = try_transmute_ref!(&NotZerocopy(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `NotZerocopy` - | - = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/try_transmute_ref.rs:33:48 + | +33 | let src_not_into_bytes: Result<&AU16, _> = try_transmute_ref!(&NotZerocopy(AU16(0))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `NotZerocopy` + | + = note: Consider adding `#[derive(Immutable)]` to `NotZerocopy` + = help: the following other types implement trait `Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 128 others +note: required by a bound in `Wrap::<&'a Src, &'a Dst>::try_transmute_ref` + --> $WORKSPACE/src/util/macro_util.rs:743:26 + | +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> + | ----------------- required by a bound in this associated function +742 | where +743 | Src: IntoBytes + Immutable, + | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` + = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors diff --git a/tests/ui/try_transmute_ref.nightly.stderr b/tests/ui/try_transmute_ref.nightly.stderr index 7838f0ccae..f8c9c737da 100644 --- a/tests/ui/try_transmute_ref.nightly.stderr +++ b/tests/ui/try_transmute_ref.nightly.stderr @@ -38,12 +38,12 @@ help: the trait `TryFromBytes` is not implemented for `NotZerocopy` (A, B, C, D, E, F, G, H) and 153 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a Src, &'a Dst>::try_transmute_ref` - --> src/util/macro_util.rs:755:14 + --> src/util/macro_util.rs:744:14 | -752 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> | ----------------- required by a bound in this associated function ... -755 | Dst: TryFromBytes + Immutable, +744 | Dst: TryFromBytes + Immutable, | ^^^^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -70,12 +70,12 @@ help: the trait `Immutable` is not implemented for `NotZerocopy` (A, B, C, D, E, F) and 128 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a Src, &'a Dst>::try_transmute_ref` - --> src/util/macro_util.rs:755:29 + --> src/util/macro_util.rs:744:29 | -752 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> | ----------------- required by a bound in this associated function ... -755 | Dst: TryFromBytes + Immutable, +744 | Dst: TryFromBytes + Immutable, | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -159,12 +159,12 @@ help: the trait `IntoBytes` is not implemented for `NotZerocopy` AtomicIsize and 68 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a Src, &'a Dst>::try_transmute_ref` - --> src/util/macro_util.rs:754:14 + --> src/util/macro_util.rs:743:14 | -752 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> | ----------------- required by a bound in this associated function -753 | where -754 | Src: IntoBytes + Immutable, +742 | where +743 | Src: IntoBytes + Immutable, | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -191,12 +191,12 @@ help: the trait `Immutable` is not implemented for `NotZerocopy` (A, B, C, D, E, F) and 128 others note: required by a bound in `zerocopy::util::macro_util::Wrap::<&'a Src, &'a Dst>::try_transmute_ref` - --> src/util/macro_util.rs:754:26 + --> src/util/macro_util.rs:743:26 | -752 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> | ----------------- required by a bound in this associated function -753 | where -754 | Src: IntoBytes + Immutable, +742 | where +743 | Src: IntoBytes + Immutable, | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/try_transmute_ref.stable.stderr b/tests/ui/try_transmute_ref.stable.stderr index 7577e39563..1c73b12665 100644 --- a/tests/ui/try_transmute_ref.stable.stderr +++ b/tests/ui/try_transmute_ref.stable.stderr @@ -38,12 +38,12 @@ help: the trait `TryFromBytes` is not implemented for `NotZerocopy` (A, B, C, D, E, F, G, H) and 153 others note: required by a bound in `Wrap::<&'a Src, &'a Dst>::try_transmute_ref` - --> $WORKSPACE/src/util/macro_util.rs:755:14 + --> $WORKSPACE/src/util/macro_util.rs:744:14 | -752 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> | ----------------- required by a bound in this associated function ... -755 | Dst: TryFromBytes + Immutable, +744 | Dst: TryFromBytes + Immutable, | ^^^^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -70,12 +70,12 @@ help: the trait `Immutable` is not implemented for `NotZerocopy` (A, B, C, D, E, F) and 128 others note: required by a bound in `Wrap::<&'a Src, &'a Dst>::try_transmute_ref` - --> $WORKSPACE/src/util/macro_util.rs:755:29 + --> $WORKSPACE/src/util/macro_util.rs:744:29 | -752 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> | ----------------- required by a bound in this associated function ... -755 | Dst: TryFromBytes + Immutable, +744 | Dst: TryFromBytes + Immutable, | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -159,12 +159,12 @@ help: the trait `IntoBytes` is not implemented for `NotZerocopy` AtomicIsize and 68 others note: required by a bound in `Wrap::<&'a Src, &'a Dst>::try_transmute_ref` - --> $WORKSPACE/src/util/macro_util.rs:754:14 + --> $WORKSPACE/src/util/macro_util.rs:743:14 | -752 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> | ----------------- required by a bound in this associated function -753 | where -754 | Src: IntoBytes + Immutable, +742 | where +743 | Src: IntoBytes + Immutable, | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -191,12 +191,12 @@ help: the trait `Immutable` is not implemented for `NotZerocopy` (A, B, C, D, E, F) and 128 others note: required by a bound in `Wrap::<&'a Src, &'a Dst>::try_transmute_ref` - --> $WORKSPACE/src/util/macro_util.rs:754:26 + --> $WORKSPACE/src/util/macro_util.rs:743:26 | -752 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> +741 | pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>> | ----------------- required by a bound in this associated function -753 | where -754 | Src: IntoBytes + Immutable, +742 | where +743 | Src: IntoBytes + Immutable, | ^^^^^^^^^ required by this bound in `Wrap::<&Src, &Dst>::try_transmute_ref` = note: this error originates in the macro `try_transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tools/cargo-zerocopy/src/main.rs b/tools/cargo-zerocopy/src/main.rs index 8bfe693616..849bebe1e6 100644 --- a/tools/cargo-zerocopy/src/main.rs +++ b/tools/cargo-zerocopy/src/main.rs @@ -355,6 +355,15 @@ fn delegate_cargo() -> Result<(), Error> { install_targets_or_exit(version, &targets)?; + // We determine if the subcommand is `asm` so we can later skip + // the fully-qualified package name (FQPN) substitution. The + // `cargo-show-asm` crate's internal package parsing fails when + // an FQPN includes a pre-release tag (e.g., `-alpha.1`), + // incorrectly reporting that the package cannot be found. + // Passing a short package name directly to `cargo asm` does + // not suffer from ambiguity involving dev-dependencies, so + // bypassing the substitution remains safe. + let is_asm = args_vec.first().map(|s| s.as_str()) == Some("asm"); let mut args = args_vec.into_iter(); let env_rustflags = env::vars() @@ -394,21 +403,23 @@ fn delegate_cargo() -> Result<(), Error> { }; // Replace `-p`, `-p ` and `--package )`. We do - // this because unqualified package names are sometimes ambiguous - // if a dev-dependency has taken a dependency on an earlier - // version of zerocopy or zerocopy-derive. + // with the equivalent of `-p $(cargo pkgid -p )`. We + // do this because unqualified package names are sometimes + // ambiguous if a dev-dependency has taken a dependency on an + // earlier version of zerocopy or zerocopy-derive. We skip this + // substitution if the subcommand is `asm` for reasons + // documented above. loop { let Some(arg) = args.next() else { break; }; - if arg == "-p" || arg == "--package" { + if !is_asm && (arg == "-p" || arg == "--package") { cmd.arg(&arg); let Some(arg) = args.next() else { break; }; cmd.arg(fqpn(arg)); - } else if arg.starts_with("-p") { + } else if !is_asm && arg.starts_with("-p") { cmd.arg("-p"); cmd.arg(fqpn(arg[2..].to_string())); } else if arg == "--" { diff --git a/zerocopy-derive/Cargo.toml b/zerocopy-derive/Cargo.toml index dd7373012d..334e87ff6a 100644 --- a/zerocopy-derive/Cargo.toml +++ b/zerocopy-derive/Cargo.toml @@ -9,8 +9,11 @@ [package] edition = "2021" name = "zerocopy-derive" -version = "0.8.48" -authors = ["Joshua Liebow-Feeser ", "Jack Wrenn "] +version = "0.9.0-alpha.1" +authors = [ + "Joshua Liebow-Feeser ", + "Jack Wrenn ", +] description = "Custom derive for traits from the zerocopy crate" license = "BSD-2-Clause OR Apache-2.0 OR MIT" repository = "https://github.com/google/zerocopy" @@ -20,7 +23,11 @@ repository = "https://github.com/google/zerocopy" # so we exclude them to keep the published crate file small. # # [1] https://github.com/rust-lang/crater -exclude = [".*", "tests/enum_from_bytes.rs", "tests/ui-nightly/enum_from_bytes_u16_too_few.rs.disabled"] +exclude = [ + ".*", + "tests/enum_from_bytes.rs", + "tests/ui-nightly/enum_from_bytes_u16_too_few.rs.disabled", +] [lints.rust] # See #1792 for more context. diff --git a/zerocopy-derive/tests/ui/absence_of_deprecated_warning.msrv.stderr b/zerocopy-derive/tests/ui/absence_of_deprecated_warning.msrv.stderr index a6e5233055..7cf2be65ce 100644 --- a/zerocopy-derive/tests/ui/absence_of_deprecated_warning.msrv.stderr +++ b/zerocopy-derive/tests/ui/absence_of_deprecated_warning.msrv.stderr @@ -10,5 +10,19 @@ note: the lint level is defined here 14 | #![deny(deprecated)] | ^^^^^^^^^^ -error: aborting due to previous error +warning: struct `OldHeader` is never constructed + --> $DIR/absence_of_deprecated_warning.rs:24:8 + | +24 | struct OldHeader { + | ^^^^^^^^^ + | + = note: `#[warn(dead_code)]` on by default + +warning: trait `T` is never used + --> $DIR/absence_of_deprecated_warning.rs:29:7 + | +29 | trait T {} + | ^ + +error: aborting due to 1 previous error; 2 warnings emitted diff --git a/zerocopy-derive/tests/ui/cfgs/on_error.msrv.stderr b/zerocopy-derive/tests/ui/cfgs/on_error.msrv.stderr index b96a123459..470f2fb460 100644 --- a/zerocopy-derive/tests/ui/cfgs/on_error.msrv.stderr +++ b/zerocopy-derive/tests/ui/cfgs/on_error.msrv.stderr @@ -12,6 +12,17 @@ error[E0277]: the trait bound `bool: FromBytes` is not satisfied 13 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool` | + = note: Consider adding `#[derive(FromBytes)]` to `bool` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 79 others = help: see issue #48214 = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui/cfgs/union_into_bytes_cfg.msrv.stderr b/zerocopy-derive/tests/ui/cfgs/union_into_bytes_cfg.msrv.stderr index 499ae3748b..66fccdf43a 100644 --- a/zerocopy-derive/tests/ui/cfgs/union_into_bytes_cfg.msrv.stderr +++ b/zerocopy-derive/tests/ui/cfgs/union_into_bytes_cfg.msrv.stderr @@ -1,5 +1,5 @@ error: requires --cfg zerocopy_derive_union_into_bytes; -please let us know you use this feature: https://github.com/google/zerocopy/discussions/1802 + please let us know you use this feature: https://github.com/google/zerocopy/discussions/1802 --> $DIR/union_into_bytes_cfg.rs:20:10 | 20 | #[derive(IntoBytes)] @@ -7,5 +7,5 @@ please let us know you use this feature: https://github.com/google/zerocopy/disc | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/zerocopy-derive/tests/ui/derive_transparent.msrv.stderr b/zerocopy-derive/tests/ui/derive_transparent.msrv.stderr index 9a199b1041..1ae497fa0d 100644 --- a/zerocopy-derive/tests/ui/derive_transparent.msrv.stderr +++ b/zerocopy-derive/tests/ui/derive_transparent.msrv.stderr @@ -1,92 +1,147 @@ error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied - --> $DIR/derive_transparent.rs:35:1 + --> $DIR/derive_transparent.rs:35:23 | 35 | util_assert_impl_all!(TransparentStruct: TryFromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy` - | -note: required because of the requirements on the impl of `zerocopy_renamed::TryFromBytes` for `TransparentStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`, which is required by `TransparentStruct: zerocopy_renamed::TryFromBytes` + | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 154 others +note: required for `TransparentStruct` to implement `zerocopy_renamed::TryFromBytes` --> $DIR/derive_transparent.rs:24:21 | 24 | #[derive(IntoBytes, FromBytes, Unaligned)] - | ^^^^^^^^^ + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` --> $DIR/derive_transparent.rs:35:1 | 35 | util_assert_impl_all!(TransparentStruct: TryFromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` - = note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` + = note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied - --> $DIR/derive_transparent.rs:38:1 + --> $DIR/derive_transparent.rs:38:23 | 38 | util_assert_impl_all!(TransparentStruct: FromZeros); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy` - | -note: required because of the requirements on the impl of `FromZeros` for `TransparentStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy`, which is required by `TransparentStruct: FromZeros` + | + = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` + = help: the following other types implement trait `FromZeros`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 142 others +note: required for `TransparentStruct` to implement `FromZeros` --> $DIR/derive_transparent.rs:24:21 | 24 | #[derive(IntoBytes, FromBytes, Unaligned)] - | ^^^^^^^^^ + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` --> $DIR/derive_transparent.rs:38:1 | 38 | util_assert_impl_all!(TransparentStruct: FromZeros); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` - = note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` + = note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied - --> $DIR/derive_transparent.rs:41:1 + --> $DIR/derive_transparent.rs:41:23 | 41 | util_assert_impl_all!(TransparentStruct: FromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy` - | -note: required because of the requirements on the impl of `zerocopy_renamed::FromBytes` for `TransparentStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`, which is required by `TransparentStruct: zerocopy_renamed::FromBytes` + | + = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 80 others +note: required for `TransparentStruct` to implement `zerocopy_renamed::FromBytes` --> $DIR/derive_transparent.rs:24:21 | 24 | #[derive(IntoBytes, FromBytes, Unaligned)] - | ^^^^^^^^^ + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` --> $DIR/derive_transparent.rs:41:1 | 41 | util_assert_impl_all!(TransparentStruct: FromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` - = note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` + = note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied - --> $DIR/derive_transparent.rs:44:1 + --> $DIR/derive_transparent.rs:44:23 | 44 | util_assert_impl_all!(TransparentStruct: IntoBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy` - | -note: required because of the requirements on the impl of `zerocopy_renamed::IntoBytes` for `TransparentStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy`, which is required by `TransparentStruct: zerocopy_renamed::IntoBytes` + | + = note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 69 others +note: required for `TransparentStruct` to implement `zerocopy_renamed::IntoBytes` --> $DIR/derive_transparent.rs:24:10 | 24 | #[derive(IntoBytes, FromBytes, Unaligned)] - | ^^^^^^^^^ + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` --> $DIR/derive_transparent.rs:44:1 | 44 | util_assert_impl_all!(TransparentStruct: IntoBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` - = note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` + = note: this error originates in the derive macro `IntoBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/derive_transparent.rs:47:1 + --> $DIR/derive_transparent.rs:47:23 | 47 | util_assert_impl_all!(TransparentStruct: Unaligned); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `NotZerocopy` - | -note: required because of the requirements on the impl of `zerocopy_renamed::Unaligned` for `TransparentStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `NotZerocopy`, which is required by `TransparentStruct: zerocopy_renamed::Unaligned` + | + = note: Consider adding `#[derive(Unaligned)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::Unaligned`: + bool + i8 + u8 + TransparentStruct + NonZero + NonZero + zerocopy_renamed::ReadOnly + U16 + and 27 others +note: required for `TransparentStruct` to implement `zerocopy_renamed::Unaligned` --> $DIR/derive_transparent.rs:24:32 | 24 | #[derive(IntoBytes, FromBytes, Unaligned)] - | ^^^^^^^^^ + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` --> $DIR/derive_transparent.rs:47:1 | 47 | util_assert_impl_all!(TransparentStruct: Unaligned); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all` - = note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` + = note: this error originates in the derive macro `Unaligned` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 5 previous errors diff --git a/zerocopy-derive/tests/ui/enum.msrv.stderr b/zerocopy-derive/tests/ui/enum.msrv.stderr index 44af96210a..0d0b74c824 100644 --- a/zerocopy-derive/tests/ui/enum.msrv.stderr +++ b/zerocopy-derive/tests/ui/enum.msrv.stderr @@ -75,7 +75,7 @@ error: FromZeros only supported on enums with a variant that has a discriminant | |_^ error: FromZeros only supported on enums with a variant that has a discriminant of `0` -help: This enum has discriminants which are not literal integers. One of those may define or imply which variant has a discriminant of zero. Use a literal integer to define or imply the variant with a discriminant of zero. + help: This enum has discriminants which are not literal integers. One of those may define or imply which variant has a discriminant of zero. Use a literal integer to define or imply the variant with a discriminant of zero. --> $DIR/enum.rs:151:1 | 151 | / #[zerocopy(crate = "zerocopy_renamed")] @@ -94,192 +94,181 @@ error: FromZeros only supported on enums with a variant that has a discriminant 172 | | 173 | | #[repr(u8)] 174 | | enum FromZeros7 { -... | -177 | | B(NotFromZeros), -178 | | } +175 | | A = 1, +176 | | B(NotFromZeros), +177 | | } | |_^ error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:184:10 + --> $DIR/enum.rs:183:10 | -184 | #[derive(FromBytes)] +183 | #[derive(FromBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:193:8 + --> $DIR/enum.rs:192:8 | -193 | #[repr(C)] +192 | #[repr(C)] | ^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:201:8 + --> $DIR/enum.rs:200:8 | -201 | #[repr(usize)] +200 | #[repr(usize)] | ^^^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:209:8 + --> $DIR/enum.rs:208:8 | -209 | #[repr(isize)] +208 | #[repr(isize)] | ^^^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:217:8 + --> $DIR/enum.rs:216:8 | -217 | #[repr(u32)] +216 | #[repr(u32)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:225:8 + --> $DIR/enum.rs:224:8 | -225 | #[repr(i32)] +224 | #[repr(i32)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:233:8 + --> $DIR/enum.rs:232:8 | -233 | #[repr(u64)] +232 | #[repr(u64)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:241:8 + --> $DIR/enum.rs:240:8 | -241 | #[repr(i64)] +240 | #[repr(i64)] | ^^^ error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:515:10 + --> $DIR/enum.rs:514:10 | -515 | #[derive(Unaligned)] +514 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:523:10 + --> $DIR/enum.rs:522:10 | -523 | #[derive(Unaligned)] +522 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:531:10 + --> $DIR/enum.rs:530:10 | -531 | #[derive(Unaligned)] +530 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:539:10 + --> $DIR/enum.rs:538:10 | -539 | #[derive(Unaligned)] +538 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:547:10 + --> $DIR/enum.rs:546:10 | -547 | #[derive(Unaligned)] +546 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:555:10 + --> $DIR/enum.rs:554:10 | -555 | #[derive(Unaligned)] +554 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:563:10 + --> $DIR/enum.rs:562:10 | -563 | #[derive(Unaligned)] +562 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:571:10 + --> $DIR/enum.rs:570:10 | -571 | #[derive(Unaligned)] +570 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:579:10 + --> $DIR/enum.rs:578:10 | -579 | #[derive(Unaligned)] +578 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/enum.rs:589:12 + --> $DIR/enum.rs:588:12 | -589 | #[repr(u8, align(2))] +588 | #[repr(u8, align(2))] | ^^^^^ error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/enum.rs:597:12 + --> $DIR/enum.rs:596:12 | -597 | #[repr(i8, align(2))] +596 | #[repr(i8, align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/enum.rs:605:18 + --> $DIR/enum.rs:604:18 | -605 | #[repr(align(1), align(2))] +604 | #[repr(align(1), align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/enum.rs:613:18 + --> $DIR/enum.rs:612:18 | -613 | #[repr(align(2), align(4))] +612 | #[repr(align(2), align(4))] | ^^^^^ error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:657:10 + --> $DIR/enum.rs:653:10 | -657 | #[derive(IntoBytes)] +653 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:665:10 + --> $DIR/enum.rs:661:10 | -665 | #[derive(IntoBytes)] +661 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: generic parameters may not be used in const operations - --> $DIR/enum.rs:677:7 + --> $DIR/enum.rs:673:7 | -677 | A(T), +673 | A(T), | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions -error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants - --> $DIR/enum.rs:175:9 - | -175 | A = 1, - | ^ disallowed custom discriminant -176 | -177 | B(NotFromZeros), - | --------------- tuple variant defined here - | - = note: see issue #60553 for more information - error[E0565]: meta item in `repr` must be an identifier --> $DIR/enum.rs:20:8 | @@ -291,6 +280,8 @@ error[E0552]: unrecognized representation hint | 29 | #[repr(foo)] | ^^^ + | + = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` error[E0566]: conflicting representation hints --> $DIR/enum.rs:46:8 @@ -298,9 +289,9 @@ error[E0566]: conflicting representation hints 46 | #[repr(u8, u16)] | ^^ ^^^ | - = note: `#[deny(conflicting_repr_hints)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #68585 + = note: `#[deny(conflicting_repr_hints)]` on by default error[E0277]: the trait bound `UnsafeCell<()>: Immutable` is not satisfied --> $DIR/enum.rs:64:10 @@ -308,6 +299,17 @@ error[E0277]: the trait bound `UnsafeCell<()>: Immutable` is not satisfied 64 | #[derive(Immutable)] | ^^^^^^^^^ the trait `Immutable` is not implemented for `UnsafeCell<()>` | + = note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>` + = help: the following other types implement trait `Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 137 others = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -317,6 +319,17 @@ error[E0277]: the trait bound `UnsafeCell: Immutable` is not satisfied 75 | #[derive(Immutable)] | ^^^^^^^^^ the trait `Immutable` is not implemented for `UnsafeCell` | + = note: Consider adding `#[derive(Immutable)]` to `UnsafeCell` + = help: the following other types implement trait `Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 137 others = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -326,6 +339,17 @@ error[E0277]: the trait bound `NotTryFromBytes: TryFromBytes` is not satisfied 104 | #[derive(TryFromBytes)] | ^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotTryFromBytes` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotTryFromBytes` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 157 others = help: see issue #48214 = note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -335,6 +359,17 @@ error[E0277]: the trait bound `NotFromZeros: TryFromBytes` is not satisfied 161 | #[derive(FromZeros)] | ^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotFromZeros` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotFromZeros` + = help: the following other types implement trait `TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 157 others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -344,76 +379,139 @@ error[E0277]: the trait bound `NotFromZeros: FromZeros` is not satisfied 161 | #[derive(FromZeros)] | ^^^^^^^^^ the trait `FromZeros` is not implemented for `NotFromZeros` | + = note: Consider adding `#[derive(FromZeros)]` to `NotFromZeros` + = help: the following other types implement trait `FromZeros`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 142 others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `bool: FromBytes` is not satisfied - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool` | + = note: Consider adding `#[derive(FromBytes)]` to `bool` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 79 others = help: see issue #48214 = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): PaddingFree` is not satisfied - --> $DIR/enum.rs:623:10 +error[E0277]: `IntoBytes1` has 1 total byte(s) of padding + --> $DIR/enum.rs:622:10 | -623 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `PaddingFree` is not implemented for `()` +622 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | - = help: the following implementations were found: - <() as PaddingFree> + = help: the trait `PaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `PaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): PaddingFree` is not satisfied - --> $DIR/enum.rs:638:10 +error[E0277]: `IntoBytes2` has 3 total byte(s) of padding + --> $DIR/enum.rs:636:10 | -638 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `PaddingFree` is not implemented for `()` +636 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | - = help: the following implementations were found: - <() as PaddingFree> + = help: the trait `PaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `PaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): PaddingFree` is not satisfied - --> $DIR/enum.rs:647:10 +error[E0277]: `IntoBytes3` has 2 total byte(s) of padding + --> $DIR/enum.rs:644:10 | -647 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `PaddingFree` is not implemented for `()` +644 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | - = help: the following implementations were found: - <() as PaddingFree> + = help: the trait `PaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `PaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: generic `Self` types are currently not permitted in anonymous constants - --> $DIR/enum.rs:672:10 + --> $DIR/enum.rs:668:10 | -672 | #[derive(IntoBytes)] +668 | #[derive(IntoBytes)] | ^^^^^^^^^ | note: not a concrete type - --> $DIR/enum.rs:672:10 + --> $DIR/enum.rs:668:10 | -672 | #[derive(IntoBytes)] +668 | #[derive(IntoBytes)] | ^^^^^^^^^ = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): PaddingFree` is not satisfied - --> $DIR/enum.rs:681:10 +error[E0277]: `IntoBytes7` has 1 total byte(s) of padding + --> $DIR/enum.rs:677:10 | -681 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `PaddingFree` is not implemented for `()` +677 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | - = help: the following implementations were found: - <() as PaddingFree> + = help: the trait `PaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `PaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0277]: the trait bound `bool: FromBytes` is not satisfied + --> $DIR/enum.rs:246:10 + | +246 | #[derive(FromBytes)] + | ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`, which is required by `FooU8: FromBytes` + | + = note: Consider adding `#[derive(FromBytes)]` to `bool` + = help: the following other types implement trait `FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 79 others +note: required for `FooU8` to implement `FromBytes` + --> $DIR/enum.rs:246:10 + | +246 | #[derive(FromBytes)] + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro +note: required by a bound in `assert_is_from_bytes` + --> $DIR/enum.rs:246:10 + | +246 | #[derive(FromBytes)] + | ^^^^^^^^^ required by this bound in `assert_is_from_bytes` + = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) + error: aborting due to 52 previous errors -Some errors have detailed explanations: E0277, E0552, E0565, E0566, E0658. +Some errors have detailed explanations: E0277, E0552, E0565, E0566. For more information about an error, try `rustc --explain E0277`. diff --git a/zerocopy-derive/tests/ui/enum.nightly.stderr b/zerocopy-derive/tests/ui/enum.nightly.stderr index f36b7b82ec..9b854ee16b 100644 --- a/zerocopy-derive/tests/ui/enum.nightly.stderr +++ b/zerocopy-derive/tests/ui/enum.nightly.stderr @@ -117,177 +117,177 @@ error: FromZeros only supported on enums with a variant that has a discriminant 172 | | 173 | | #[repr(u8)] 174 | | enum FromZeros7 { -... | -177 | | B(NotFromZeros), -178 | | } +175 | | A = 1, +176 | | B(NotFromZeros), +177 | | } | |_^ error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:184:10 + --> $DIR/enum.rs:183:10 | -184 | #[derive(FromBytes)] +183 | #[derive(FromBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:193:8 + --> $DIR/enum.rs:192:8 | -193 | #[repr(C)] +192 | #[repr(C)] | ^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:201:8 + --> $DIR/enum.rs:200:8 | -201 | #[repr(usize)] +200 | #[repr(usize)] | ^^^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:209:8 + --> $DIR/enum.rs:208:8 | -209 | #[repr(isize)] +208 | #[repr(isize)] | ^^^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:217:8 + --> $DIR/enum.rs:216:8 | -217 | #[repr(u32)] +216 | #[repr(u32)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:225:8 + --> $DIR/enum.rs:224:8 | -225 | #[repr(i32)] +224 | #[repr(i32)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:233:8 + --> $DIR/enum.rs:232:8 | -233 | #[repr(u64)] +232 | #[repr(u64)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:241:8 + --> $DIR/enum.rs:240:8 | -241 | #[repr(i64)] +240 | #[repr(i64)] | ^^^ error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:515:10 + --> $DIR/enum.rs:514:10 | -515 | #[derive(Unaligned)] +514 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:523:10 + --> $DIR/enum.rs:522:10 | -523 | #[derive(Unaligned)] +522 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:531:10 + --> $DIR/enum.rs:530:10 | -531 | #[derive(Unaligned)] +530 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:539:10 + --> $DIR/enum.rs:538:10 | -539 | #[derive(Unaligned)] +538 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:547:10 + --> $DIR/enum.rs:546:10 | -547 | #[derive(Unaligned)] +546 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:555:10 + --> $DIR/enum.rs:554:10 | -555 | #[derive(Unaligned)] +554 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:563:10 + --> $DIR/enum.rs:562:10 | -563 | #[derive(Unaligned)] +562 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:571:10 + --> $DIR/enum.rs:570:10 | -571 | #[derive(Unaligned)] +570 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:579:10 + --> $DIR/enum.rs:578:10 | -579 | #[derive(Unaligned)] +578 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/enum.rs:589:12 + --> $DIR/enum.rs:588:12 | -589 | #[repr(u8, align(2))] +588 | #[repr(u8, align(2))] | ^^^^^^^^ error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/enum.rs:597:12 + --> $DIR/enum.rs:596:12 | -597 | #[repr(i8, align(2))] +596 | #[repr(i8, align(2))] | ^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/enum.rs:605:8 + --> $DIR/enum.rs:604:8 | -605 | #[repr(align(1), align(2))] +604 | #[repr(align(1), align(2))] | ^^^^^^^^^^^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/enum.rs:613:8 + --> $DIR/enum.rs:612:8 | -613 | #[repr(align(2), align(4))] +612 | #[repr(align(2), align(4))] | ^^^^^^^^^^^^^^^^^^ error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:657:10 + --> $DIR/enum.rs:653:10 | -657 | #[derive(IntoBytes)] +653 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:665:10 + --> $DIR/enum.rs:661:10 | -665 | #[derive(IntoBytes)] +661 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: generic parameters may not be used in const operations - --> $DIR/enum.rs:677:7 + --> $DIR/enum.rs:673:7 | -677 | A(T), +673 | A(T), | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions @@ -454,9 +454,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: the trait bound `bool: FromBytes` is not satisfied - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool` | = note: Consider adding `#[derive(FromBytes)]` to `bool` @@ -478,9 +478,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: `IntoBytes1` has 1 total byte(s) of padding - --> $DIR/enum.rs:623:10 + --> $DIR/enum.rs:622:10 | -623 | #[derive(IntoBytes)] +622 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -488,7 +488,7 @@ error[E0277]: `IntoBytes1` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> src/util/macro_util.rs:62:0 + --> src/util/macro_util.rs:59:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -497,9 +497,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: `IntoBytes2` has 3 total byte(s) of padding - --> $DIR/enum.rs:638:10 + --> $DIR/enum.rs:636:10 | -638 | #[derive(IntoBytes)] +636 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -507,7 +507,7 @@ error[E0277]: `IntoBytes2` has 3 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> src/util/macro_util.rs:62:0 + --> src/util/macro_util.rs:59:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -516,9 +516,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: `IntoBytes3` has 2 total byte(s) of padding - --> $DIR/enum.rs:647:10 + --> $DIR/enum.rs:644:10 | -647 | #[derive(IntoBytes)] +644 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -526,7 +526,7 @@ error[E0277]: `IntoBytes3` has 2 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> src/util/macro_util.rs:62:0 + --> src/util/macro_util.rs:59:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -535,22 +535,22 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error: generic `Self` types are currently not permitted in anonymous constants - --> $DIR/enum.rs:672:10 + --> $DIR/enum.rs:668:10 | -672 | #[derive(IntoBytes)] +668 | #[derive(IntoBytes)] | ^^^^^^^^^ | note: not a concrete type - --> $DIR/enum.rs:672:10 + --> $DIR/enum.rs:668:10 | -672 | #[derive(IntoBytes)] +668 | #[derive(IntoBytes)] | ^^^^^^^^^ = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes7` has 1 total byte(s) of padding - --> $DIR/enum.rs:681:10 + --> $DIR/enum.rs:677:10 | -681 | #[derive(IntoBytes)] +677 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -558,7 +558,7 @@ error[E0277]: `IntoBytes7` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> src/util/macro_util.rs:62:0 + --> src/util/macro_util.rs:59:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -567,9 +567,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: the trait bound `bool: FromBytes` is not satisfied - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool` | = note: Consider adding `#[derive(FromBytes)]` to `bool` @@ -584,14 +584,14 @@ error[E0277]: the trait bound `bool: FromBytes` is not satisfied (A, B, C, D, E, F, G, H) and 79 others note: required for `FooU8` to implement `FromBytes` - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `assert_is_from_bytes` - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ required by this bound in `assert_is_from_bytes` = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui/enum.rs b/zerocopy-derive/tests/ui/enum.rs index b881aed531..e99199bedb 100644 --- a/zerocopy-derive/tests/ui/enum.rs +++ b/zerocopy-derive/tests/ui/enum.rs @@ -173,7 +173,6 @@ enum FromZeros6 { #[repr(u8)] enum FromZeros7 { A = 1, - //~[msrv]^ ERROR: custom discriminant values are not allowed in enums with tuple or struct variants B(NotFromZeros), } @@ -246,7 +245,7 @@ enum FromBytes8 { #[derive(FromBytes)] //~[msrv, stable, nightly]^ ERROR: the trait bound `bool: FromBytes` is not satisfied -//~[stable, nightly]^^ ERROR: the trait bound `bool: FromBytes` is not satisfied +//~[msrv, stable, nightly]^^ ERROR: the trait bound `bool: FromBytes` is not satisfied #[zerocopy(crate = "zerocopy_renamed")] #[repr(u8)] enum FooU8 { @@ -621,8 +620,7 @@ enum Unaligned13 { // #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): PaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes1` has 1 total byte(s) of padding +//~[msrv, stable, nightly]^ ERROR: `IntoBytes1` has 1 total byte(s) of padding #[zerocopy(crate = "zerocopy_renamed")] #[repr(u8)] enum IntoBytes1 { @@ -636,8 +634,7 @@ enum IntoBytes1 { struct Align4IntoBytes(u32); #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): PaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes2` has 3 total byte(s) of padding +//~[msrv, stable, nightly]^ ERROR: `IntoBytes2` has 3 total byte(s) of padding #[zerocopy(crate = "zerocopy_renamed")] #[repr(u8)] enum IntoBytes2 { @@ -645,8 +642,7 @@ enum IntoBytes2 { } #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): PaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes3` has 2 total byte(s) of padding +//~[msrv, stable, nightly]^ ERROR: `IntoBytes3` has 2 total byte(s) of padding #[zerocopy(crate = "zerocopy_renamed")] #[repr(u32)] enum IntoBytes3 { @@ -679,8 +675,7 @@ enum IntoBytes6 { } #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): PaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes7` has 1 total byte(s) of padding +//~[msrv, stable, nightly]^ ERROR: `IntoBytes7` has 1 total byte(s) of padding #[zerocopy(crate = "zerocopy_renamed")] #[repr(u8, align(2))] enum IntoBytes7 { diff --git a/zerocopy-derive/tests/ui/enum.stable.stderr b/zerocopy-derive/tests/ui/enum.stable.stderr index 943615aa3c..7ff6cd4875 100644 --- a/zerocopy-derive/tests/ui/enum.stable.stderr +++ b/zerocopy-derive/tests/ui/enum.stable.stderr @@ -94,177 +94,177 @@ error: FromZeros only supported on enums with a variant that has a discriminant 172 | | 173 | | #[repr(u8)] 174 | | enum FromZeros7 { -... | -177 | | B(NotFromZeros), -178 | | } +175 | | A = 1, +176 | | B(NotFromZeros), +177 | | } | |_^ error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:184:10 + --> $DIR/enum.rs:183:10 | -184 | #[derive(FromBytes)] +183 | #[derive(FromBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:193:8 + --> $DIR/enum.rs:192:8 | -193 | #[repr(C)] +192 | #[repr(C)] | ^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:201:8 + --> $DIR/enum.rs:200:8 | -201 | #[repr(usize)] +200 | #[repr(usize)] | ^^^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:209:8 + --> $DIR/enum.rs:208:8 | -209 | #[repr(isize)] +208 | #[repr(isize)] | ^^^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:217:8 + --> $DIR/enum.rs:216:8 | -217 | #[repr(u32)] +216 | #[repr(u32)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:225:8 + --> $DIR/enum.rs:224:8 | -225 | #[repr(i32)] +224 | #[repr(i32)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:233:8 + --> $DIR/enum.rs:232:8 | -233 | #[repr(u64)] +232 | #[repr(u64)] | ^^^ error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16` - --> $DIR/enum.rs:241:8 + --> $DIR/enum.rs:240:8 | -241 | #[repr(i64)] +240 | #[repr(i64)] | ^^^ error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:515:10 + --> $DIR/enum.rs:514:10 | -515 | #[derive(Unaligned)] +514 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:523:10 + --> $DIR/enum.rs:522:10 | -523 | #[derive(Unaligned)] +522 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:531:10 + --> $DIR/enum.rs:530:10 | -531 | #[derive(Unaligned)] +530 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:539:10 + --> $DIR/enum.rs:538:10 | -539 | #[derive(Unaligned)] +538 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:547:10 + --> $DIR/enum.rs:546:10 | -547 | #[derive(Unaligned)] +546 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:555:10 + --> $DIR/enum.rs:554:10 | -555 | #[derive(Unaligned)] +554 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:563:10 + --> $DIR/enum.rs:562:10 | -563 | #[derive(Unaligned)] +562 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:571:10 + --> $DIR/enum.rs:570:10 | -571 | #[derive(Unaligned)] +570 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment - --> $DIR/enum.rs:579:10 + --> $DIR/enum.rs:578:10 | -579 | #[derive(Unaligned)] +578 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/enum.rs:589:12 + --> $DIR/enum.rs:588:12 | -589 | #[repr(u8, align(2))] +588 | #[repr(u8, align(2))] | ^^^^^ error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/enum.rs:597:12 + --> $DIR/enum.rs:596:12 | -597 | #[repr(i8, align(2))] +596 | #[repr(i8, align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/enum.rs:605:18 + --> $DIR/enum.rs:604:18 | -605 | #[repr(align(1), align(2))] +604 | #[repr(align(1), align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/enum.rs:613:18 + --> $DIR/enum.rs:612:18 | -613 | #[repr(align(2), align(4))] +612 | #[repr(align(2), align(4))] | ^^^^^ error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:657:10 + --> $DIR/enum.rs:653:10 | -657 | #[derive(IntoBytes)] +653 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout - --> $DIR/enum.rs:665:10 + --> $DIR/enum.rs:661:10 | -665 | #[derive(IntoBytes)] +661 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: generic parameters may not be used in const operations - --> $DIR/enum.rs:677:7 + --> $DIR/enum.rs:673:7 | -677 | A(T), +673 | A(T), | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions @@ -410,9 +410,9 @@ help: the trait `FromZeros` is not implemented for `NotFromZeros` = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `bool: FromBytes` is not satisfied - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool` | = note: Consider adding `#[derive(FromBytes)]` to `bool` @@ -430,9 +430,9 @@ error[E0277]: the trait bound `bool: FromBytes` is not satisfied = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes1` has 1 total byte(s) of padding - --> $DIR/enum.rs:623:10 + --> $DIR/enum.rs:622:10 | -623 | #[derive(IntoBytes)] +622 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -440,17 +440,17 @@ error[E0277]: `IntoBytes1` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:62:1 + --> $WORKSPACE/src/util/macro_util.rs:59:1 | - 62 | impl PaddingFree for () {} + 59 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes2` has 3 total byte(s) of padding - --> $DIR/enum.rs:638:10 + --> $DIR/enum.rs:636:10 | -638 | #[derive(IntoBytes)] +636 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -458,17 +458,17 @@ error[E0277]: `IntoBytes2` has 3 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:62:1 + --> $WORKSPACE/src/util/macro_util.rs:59:1 | - 62 | impl PaddingFree for () {} + 59 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes3` has 2 total byte(s) of padding - --> $DIR/enum.rs:647:10 + --> $DIR/enum.rs:644:10 | -647 | #[derive(IntoBytes)] +644 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -476,30 +476,30 @@ error[E0277]: `IntoBytes3` has 2 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:62:1 + --> $WORKSPACE/src/util/macro_util.rs:59:1 | - 62 | impl PaddingFree for () {} + 59 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: generic `Self` types are currently not permitted in anonymous constants - --> $DIR/enum.rs:672:10 + --> $DIR/enum.rs:668:10 | -672 | #[derive(IntoBytes)] +668 | #[derive(IntoBytes)] | ^^^^^^^^^ | note: not a concrete type - --> $DIR/enum.rs:672:10 + --> $DIR/enum.rs:668:10 | -672 | #[derive(IntoBytes)] +668 | #[derive(IntoBytes)] | ^^^^^^^^^ = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes7` has 1 total byte(s) of padding - --> $DIR/enum.rs:681:10 + --> $DIR/enum.rs:677:10 | -681 | #[derive(IntoBytes)] +677 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -507,17 +507,17 @@ error[E0277]: `IntoBytes7` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:62:1 + --> $WORKSPACE/src/util/macro_util.rs:59:1 | - 62 | impl PaddingFree for () {} + 59 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `bool: FromBytes` is not satisfied - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool` | = note: Consider adding `#[derive(FromBytes)]` to `bool` @@ -532,14 +532,14 @@ error[E0277]: the trait bound `bool: FromBytes` is not satisfied (A, B, C, D, E, F, G, H) and 79 others note: required for `FooU8` to implement `FromBytes` - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `assert_is_from_bytes` - --> $DIR/enum.rs:247:10 + --> $DIR/enum.rs:246:10 | -247 | #[derive(FromBytes)] +246 | #[derive(FromBytes)] | ^^^^^^^^^ required by this bound in `assert_is_from_bytes` = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui/enum_from_bytes_u8_too_few.msrv.stderr b/zerocopy-derive/tests/ui/enum_from_bytes_u8_too_few.msrv.stderr index a441f6401a..5194362169 100644 --- a/zerocopy-derive/tests/ui/enum_from_bytes_u8_too_few.msrv.stderr +++ b/zerocopy-derive/tests/ui/enum_from_bytes_u8_too_few.msrv.stderr @@ -10,5 +10,5 @@ error: FromBytes only supported on repr(u8) enum with 256 variants 274 | | } | |_^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/zerocopy-derive/tests/ui/late_compile_pass.msrv.stderr b/zerocopy-derive/tests/ui/late_compile_pass.msrv.stderr index 0901173b39..ac1cf48b31 100644 --- a/zerocopy-derive/tests/ui/late_compile_pass.msrv.stderr +++ b/zerocopy-derive/tests/ui/late_compile_pass.msrv.stderr @@ -12,6 +12,17 @@ error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is n 29 | #[derive(TryFromBytes)] | ^^^^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 156 others = help: see issue #48214 = note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -21,6 +32,17 @@ error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is n 41 | #[derive(FromZeros)] | ^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 156 others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -30,6 +52,17 @@ error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied 41 | #[derive(FromZeros)] | ^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` + = help: the following other types implement trait `FromZeros`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 143 others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -39,6 +72,17 @@ error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is n 54 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::TryFromBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 156 others = help: see issue #48214 = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -48,6 +92,17 @@ error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied 54 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` + = help: the following other types implement trait `FromZeros`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 143 others = help: see issue #48214 = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -57,45 +112,129 @@ error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not 54 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 80 others = help: see issue #48214 = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied - --> $DIR/late_compile_pass.rs:70:10 + --> $DIR/late_compile_pass.rs:71:10 | -70 | #[derive(IntoBytes)] +71 | #[derive(IntoBytes)] | ^^^^^^^^^ the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy` | + = note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::IntoBytes`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 69 others = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:83:10 + --> $DIR/late_compile_pass.rs:84:10 | -83 | #[derive(Unaligned)] +84 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` | + = note: Consider adding `#[derive(Unaligned)]` to `AU16` + = help: the following other types implement trait `zerocopy_renamed::Unaligned`: + bool + i8 + u8 + Unaligned1 + Unaligned2 + Unaligned3 + NonZero + NonZero + and 29 others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:93:10 + --> $DIR/late_compile_pass.rs:94:10 | -93 | #[derive(Unaligned)] +94 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` | + = note: Consider adding `#[derive(Unaligned)]` to `AU16` + = help: the following other types implement trait `zerocopy_renamed::Unaligned`: + bool + i8 + u8 + Unaligned1 + Unaligned2 + Unaligned3 + NonZero + NonZero + and 29 others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:102:10 + --> $DIR/late_compile_pass.rs:103:10 | -102 | #[derive(Unaligned)] +103 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` | + = note: Consider adding `#[derive(Unaligned)]` to `AU16` + = help: the following other types implement trait `zerocopy_renamed::Unaligned`: + bool + i8 + u8 + Unaligned1 + Unaligned2 + Unaligned3 + NonZero + NonZero + and 29 others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 10 previous errors; 1 warning emitted +error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied + --> $DIR/late_compile_pass.rs:54:10 + | +54 | #[derive(FromBytes)] + | ^^^^^^^^^ the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`, which is required by `FromBytes1: zerocopy_renamed::FromBytes` + | + = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` + = help: the following other types implement trait `zerocopy_renamed::FromBytes`: + isize + i8 + i16 + i32 + i64 + i128 + usize + u8 + and 80 others +note: required for `FromBytes1` to implement `zerocopy_renamed::FromBytes` + --> $DIR/late_compile_pass.rs:54:10 + | +54 | #[derive(FromBytes)] + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro +note: required by a bound in `_::_::::is_bit_valid::assert_is_from_bytes` + --> $DIR/late_compile_pass.rs:54:10 + | +54 | #[derive(FromBytes)] + | ^^^^^^^^^ required by this bound in `assert_is_from_bytes` + = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 11 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/zerocopy-derive/tests/ui/late_compile_pass.nightly.stderr b/zerocopy-derive/tests/ui/late_compile_pass.nightly.stderr index b162cead26..51c65eeede 100644 --- a/zerocopy-derive/tests/ui/late_compile_pass.nightly.stderr +++ b/zerocopy-derive/tests/ui/late_compile_pass.nightly.stderr @@ -181,9 +181,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied - --> $DIR/late_compile_pass.rs:70:10 + --> $DIR/late_compile_pass.rs:71:10 | -70 | #[derive(IntoBytes)] +71 | #[derive(IntoBytes)] | ^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy` @@ -210,9 +210,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:83:10 + --> $DIR/late_compile_pass.rs:84:10 | -83 | #[derive(Unaligned)] +84 | #[derive(Unaligned)] | ^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` @@ -239,9 +239,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:93:10 + --> $DIR/late_compile_pass.rs:94:10 | -93 | #[derive(Unaligned)] +94 | #[derive(Unaligned)] | ^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` @@ -268,9 +268,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:102:10 + --> $DIR/late_compile_pass.rs:103:10 | -102 | #[derive(Unaligned)] +103 | #[derive(Unaligned)] | ^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` diff --git a/zerocopy-derive/tests/ui/late_compile_pass.rs b/zerocopy-derive/tests/ui/late_compile_pass.rs index 28b5375837..8263594cf3 100644 --- a/zerocopy-derive/tests/ui/late_compile_pass.rs +++ b/zerocopy-derive/tests/ui/late_compile_pass.rs @@ -53,11 +53,12 @@ struct FromZeros1 { #[derive(FromBytes)] //~[msrv]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied -//~[msrv, stable, nightly]^^ ERROR: the trait bound `NotZerocopy: FromZeros` is not satisfied -//~[msrv]^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied -//~[stable, nightly]^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied -//~[stable, nightly]^^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied +//~[msrv]^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied +//~[msrv, stable, nightly]^^^ ERROR: the trait bound `NotZerocopy: FromZeros` is not satisfied +//~[msrv]^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied +//~[stable, nightly]^^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied //~[stable, nightly]^^^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied +//~[stable, nightly]^^^^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied #[zerocopy(crate = "zerocopy_renamed")] struct FromBytes1 { value: NotZerocopy, diff --git a/zerocopy-derive/tests/ui/late_compile_pass.stable.stderr b/zerocopy-derive/tests/ui/late_compile_pass.stable.stderr index a78a8be406..f278026683 100644 --- a/zerocopy-derive/tests/ui/late_compile_pass.stable.stderr +++ b/zerocopy-derive/tests/ui/late_compile_pass.stable.stderr @@ -157,9 +157,9 @@ help: the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocop = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied - --> $DIR/late_compile_pass.rs:70:10 + --> $DIR/late_compile_pass.rs:71:10 | -70 | #[derive(IntoBytes)] +71 | #[derive(IntoBytes)] | ^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy` @@ -182,9 +182,9 @@ help: the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocop = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:83:10 + --> $DIR/late_compile_pass.rs:84:10 | -83 | #[derive(Unaligned)] +84 | #[derive(Unaligned)] | ^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` @@ -207,9 +207,9 @@ help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:93:10 + --> $DIR/late_compile_pass.rs:94:10 | -93 | #[derive(Unaligned)] +94 | #[derive(Unaligned)] | ^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` @@ -232,9 +232,9 @@ help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/late_compile_pass.rs:102:10 + --> $DIR/late_compile_pass.rs:103:10 | -102 | #[derive(Unaligned)] +103 | #[derive(Unaligned)] | ^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` diff --git a/zerocopy-derive/tests/ui/mid_compile_pass.msrv.stderr b/zerocopy-derive/tests/ui/mid_compile_pass.msrv.stderr index 17628309db..74102566d8 100644 --- a/zerocopy-derive/tests/ui/mid_compile_pass.msrv.stderr +++ b/zerocopy-derive/tests/ui/mid_compile_pass.msrv.stderr @@ -1,38 +1,41 @@ error[E0277]: the trait bound `T: KnownLayout` is not satisfied - --> $DIR/mid_compile_pass.rs:67:26 + --> $DIR/mid_compile_pass.rs:66:26 | -67 | fn test_kl13(t: T) -> impl KnownLayout { - | ^^^^^^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `T` +66 | fn test_kl13(t: T) -> impl KnownLayout { + | ^^^^^^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `T`, which is required by `KL13: KnownLayout` | -note: required because of the requirements on the impl of `KnownLayout` for `KL13` - --> $DIR/mid_compile_pass.rs:62:10 + = note: Consider adding `#[derive(KnownLayout)]` to `T` +note: required for `KL13` to implement `KnownLayout` + --> $DIR/mid_compile_pass.rs:61:10 | -62 | #[derive(KnownLayout)] - | ^^^^^^^^^^^ +61 | #[derive(KnownLayout)] + | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | -67 | fn test_kl13(t: T) -> impl KnownLayout { +66 | fn test_kl13(t: T) -> impl KnownLayout { | +++++++++++++++++++++++++++++++ error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/mid_compile_pass.rs:32:15 | 31 | fn test_kl04(kl: &KL04) { - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` 32 | assert_kl(kl); - | ^^ doesn't have a size known at compile-time + | --------- ^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | note: required because it appears within the type `KL04` --> $DIR/mid_compile_pass.rs:29:8 | 29 | struct KL04(u8, T); | ^^^^ -note: required because of the requirements on the impl of `KnownLayout` for `KL04` +note: required for `KL04` to implement `KnownLayout` --> $DIR/mid_compile_pass.rs:27:10 | 27 | #[derive(KnownLayout)] - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `assert_kl` --> $DIR/mid_compile_pass.rs:23:26 | @@ -43,26 +46,28 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | 31 - fn test_kl04(kl: &KL04) { 31 + fn test_kl04(kl: &KL04) { - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/mid_compile_pass.rs:43:15 | 42 | fn test_kl06(kl: &KL06) { - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` 43 | assert_kl(kl); - | ^^ doesn't have a size known at compile-time + | --------- ^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | note: required because it appears within the type `KL06` --> $DIR/mid_compile_pass.rs:40:8 | 40 | struct KL06(u8, T); | ^^^^ -note: required because of the requirements on the impl of `KnownLayout` for `KL06` +note: required for `KL06` to implement `KnownLayout` --> $DIR/mid_compile_pass.rs:38:10 | 38 | #[derive(KnownLayout)] - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `assert_kl` --> $DIR/mid_compile_pass.rs:23:26 | @@ -73,28 +78,33 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | 42 - fn test_kl06(kl: &KL06) { 42 + fn test_kl06(kl: &KL06) { - | + | -error[E0277]: the trait bound `T: KnownLayout` is not satisfied +error[E0277]: the trait bound `KL12: KnownLayout` is not satisfied --> $DIR/mid_compile_pass.rs:55:15 | 55 | assert_kl(kl) - | ^^ - | | - | expected an implementor of trait `KnownLayout` - | help: consider borrowing here: `&kl` + | --------- ^^ the trait `KnownLayout` is not implemented for `KL12` + | | + | required by a bound introduced by this call | -note: required because of the requirements on the impl of `KnownLayout` for `KL12` +note: required for `KL12` to implement `KnownLayout` --> $DIR/mid_compile_pass.rs:49:10 | 49 | #[derive(KnownLayout)] - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `assert_kl` --> $DIR/mid_compile_pass.rs:23:26 | 23 | fn assert_kl(_: &T) {} | ^^^^^^^^^^^ required by this bound in `assert_kl` = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider borrowing here + | +55 | assert_kl(&kl) + | + +55 | assert_kl(&mut kl) + | ++++ error: aborting due to 4 previous errors diff --git a/zerocopy-derive/tests/ui/mid_compile_pass.nightly.stderr b/zerocopy-derive/tests/ui/mid_compile_pass.nightly.stderr index 05d4f5f36f..cd4a7993ba 100644 --- a/zerocopy-derive/tests/ui/mid_compile_pass.nightly.stderr +++ b/zerocopy-derive/tests/ui/mid_compile_pass.nightly.stderr @@ -1,22 +1,22 @@ error[E0277]: the trait bound `T: KnownLayout` is not satisfied - --> $DIR/mid_compile_pass.rs:67:26 + --> $DIR/mid_compile_pass.rs:66:26 | -67 | fn test_kl13(t: T) -> impl KnownLayout { +66 | fn test_kl13(t: T) -> impl KnownLayout { | ^^^^^^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `T` -68 | -69 | KL13(0u8, t) +67 | +68 | KL13(0u8, t) | ------------ return type was inferred to be `KL13` here | = note: Consider adding `#[derive(KnownLayout)]` to `T` note: required for `KL13` to implement `KnownLayout` - --> $DIR/mid_compile_pass.rs:62:10 + --> $DIR/mid_compile_pass.rs:61:10 | -62 | #[derive(KnownLayout)] +61 | #[derive(KnownLayout)] | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` with trait `KnownLayout` | -67 | fn test_kl13(t: T) -> impl KnownLayout { +66 | fn test_kl13(t: T) -> impl KnownLayout { | +++++++++++++++++++++++++++++++ error[E0277]: the size for values of type `T` cannot be known at compilation time diff --git a/zerocopy-derive/tests/ui/mid_compile_pass.rs b/zerocopy-derive/tests/ui/mid_compile_pass.rs index 9a3d48a0d3..4796827abf 100644 --- a/zerocopy-derive/tests/ui/mid_compile_pass.rs +++ b/zerocopy-derive/tests/ui/mid_compile_pass.rs @@ -53,8 +53,7 @@ struct KL12(u8, T); fn test_kl12(kl: &KL12) { assert_kl(kl) - //~[msrv]^ ERROR: the trait bound `T: KnownLayout` is not satisfied - //~[stable, nightly]^^ ERROR: the trait bound `KL12: KnownLayout` is not satisfied + //~[msrv, stable, nightly]^ ERROR: the trait bound `KL12: KnownLayout` is not satisfied } // -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name | diff --git a/zerocopy-derive/tests/ui/mid_compile_pass.stable.stderr b/zerocopy-derive/tests/ui/mid_compile_pass.stable.stderr index 05d4f5f36f..cd4a7993ba 100644 --- a/zerocopy-derive/tests/ui/mid_compile_pass.stable.stderr +++ b/zerocopy-derive/tests/ui/mid_compile_pass.stable.stderr @@ -1,22 +1,22 @@ error[E0277]: the trait bound `T: KnownLayout` is not satisfied - --> $DIR/mid_compile_pass.rs:67:26 + --> $DIR/mid_compile_pass.rs:66:26 | -67 | fn test_kl13(t: T) -> impl KnownLayout { +66 | fn test_kl13(t: T) -> impl KnownLayout { | ^^^^^^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `T` -68 | -69 | KL13(0u8, t) +67 | +68 | KL13(0u8, t) | ------------ return type was inferred to be `KL13` here | = note: Consider adding `#[derive(KnownLayout)]` to `T` note: required for `KL13` to implement `KnownLayout` - --> $DIR/mid_compile_pass.rs:62:10 + --> $DIR/mid_compile_pass.rs:61:10 | -62 | #[derive(KnownLayout)] +61 | #[derive(KnownLayout)] | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` with trait `KnownLayout` | -67 | fn test_kl13(t: T) -> impl KnownLayout { +66 | fn test_kl13(t: T) -> impl KnownLayout { | +++++++++++++++++++++++++++++++ error[E0277]: the size for values of type `T` cannot be known at compilation time diff --git a/zerocopy-derive/tests/ui/msrv_specific.msrv.stderr b/zerocopy-derive/tests/ui/msrv_specific.msrv.stderr index 1c1f034189..5c50fa01b1 100644 --- a/zerocopy-derive/tests/ui/msrv_specific.msrv.stderr +++ b/zerocopy-derive/tests/ui/msrv_specific.msrv.stderr @@ -7,16 +7,27 @@ warning: unused `#[macro_use]` import = note: `#[warn(unused_imports)]` on by default error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/msrv_specific.rs:37:9 + --> $DIR/msrv_specific.rs:37:27 | 37 | is_into_bytes_1::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` + | ^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`, which is required by `IntoBytes1: zerocopy_renamed::IntoBytes` | -note: required because of the requirements on the impl of `zerocopy_renamed::IntoBytes` for `IntoBytes1` + = note: Consider adding `#[derive(Unaligned)]` to `AU16` + = help: the following other types implement trait `zerocopy_renamed::Unaligned`: + bool + i8 + u8 + NonZero + NonZero + zerocopy_renamed::ReadOnly + U16 + U32 + and 26 others +note: required for `IntoBytes1` to implement `zerocopy_renamed::IntoBytes` --> $DIR/msrv_specific.rs:25:10 | 25 | #[derive(IntoBytes)] - | ^^^^^^^^^ + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `is_into_bytes_1` --> $DIR/msrv_specific.rs:35:23 | @@ -24,6 +35,6 @@ note: required by a bound in `is_into_bytes_1` | ^^^^^^^^^ required by this bound in `is_into_bytes_1` = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error; 1 warning emitted +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/zerocopy-derive/tests/ui/privacy.rs b/zerocopy-derive/tests/ui/privacy.rs index 58db7467d5..5f9d828fe8 100644 --- a/zerocopy-derive/tests/ui/privacy.rs +++ b/zerocopy-derive/tests/ui/privacy.rs @@ -133,24 +133,24 @@ const _: () = { const _: () = { let _: >::Type = -//~[msrv]^ ERROR: type provided when a constant was expected + //~[msrv]^ ERROR: type provided when a constant was expected 0u8; let _: >::Type = -//~[msrv]^ ERROR: type provided when a constant was expected -//~[stable, nightly]^^ ERROR: type `private::_::_::_::ẕb` is private + //~[msrv]^ ERROR: type provided when a constant was expected + //~[stable, nightly]^^ ERROR: type `private::_::_::_::ẕb` is private 0u16; }; const _: () = { let _: >::Type = -//~[msrv]^ ERROR: type provided when a constant was expected + //~[msrv]^ ERROR: type provided when a constant was expected 0u8; let _: >::Type = -//~[msrv]^ ERROR: type provided when a constant was expected + //~[msrv]^ ERROR: type provided when a constant was expected 0u16; let _: >::Type = -//~[msrv]^ ERROR: type provided when a constant was expected + //~[msrv]^ ERROR: type provided when a constant was expected 0u8; let _: $DIR/struct.rs:210:11 + --> $DIR/struct.rs:204:11 | -210 | #[repr(C, C)] /$RUSTUP_TOOLCHAIN/lib/rustlib/src/rust/library/core/src/mem/mod.rs:303:22 +204 | #[repr(C, C)] // zerocopy-derive conservatively treats these as conflicting reprs + | ^ + +error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout + --> $DIR/struct.rs:210:10 + | +210 | #[derive(IntoBytes)] + | ^^^^^^^^^ + | + = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout + --> $DIR/struct.rs:217:10 + | +217 | #[derive(IntoBytes)] + | ^^^^^^^^^ + | + = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout + --> $DIR/struct.rs:244:10 + | +244 | #[derive(IntoBytes)] + | ^^^^^^^^^ + | + = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: cannot derive `Unaligned` on type with alignment greater than 1 + --> $DIR/struct.rs:266:11 + | +266 | #[repr(C, align(2))] + | ^^^^^ + +error: this conflicts with another representation hint + --> $DIR/struct.rs:272:8 + | +272 | #[repr(transparent, align(2))] + | ^^^^^^^^^^^ + +error: this conflicts with another representation hint + --> $DIR/struct.rs:281:16 + | +281 | #[repr(packed, align(2))] + | ^^^^^ + +error: this conflicts with another representation hint + --> $DIR/struct.rs:288:18 + | +288 | #[repr(align(1), align(2))] + | ^^^^^ + +error: this conflicts with another representation hint + --> $DIR/struct.rs:294:18 + | +294 | #[repr(align(2), align(4))] + | ^^^^^ + +error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment + --> $DIR/struct.rs:298:10 + | +298 | #[derive(Unaligned)] + | ^^^^^^^^^ + | + = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment + --> $DIR/struct.rs:303:10 + | +303 | #[derive(Unaligned)] + | ^^^^^^^^^ + | + = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: this conflicts with another representation hint + --> $DIR/struct.rs:317:8 + | +317 | #[repr(C, packed(2))] + | ^ + +error[E0692]: transparent struct cannot have other repr hints + --> $DIR/struct.rs:272:8 + | +272 | #[repr(transparent, align(2))] + | ^^^^^^^^^^^ ^^^^^^^^ + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/struct.rs:31:10 + | +31 | #[derive(KnownLayout)] + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `KL00`, the trait `Sized` is not implemented for `[u8]`, which is required by `KL00: Sized` +note: required because it appears within the type `KL00` + --> $DIR/struct.rs:34:8 + | +34 | struct KL00(u8, NotKnownLayoutDst); + | ^^^^ + = help: see issue #48214 + = note: this error originates in the derive macro `KnownLayout` (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 + --> $DIR/struct.rs:38:10 + | +38 | #[derive(KnownLayout)] + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `KL02`, the trait `Sized` is not implemented for `[u8]`, which is required by `KL02: Sized` +note: required because it appears within the type `KL02` + --> $DIR/struct.rs:41:8 + | +41 | struct KL02(u8, [u8]); + | ^^^^ + = help: see issue #48214 + = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `NotKnownLayoutDst: zerocopy_renamed::KnownLayout` is not satisfied + --> $DIR/struct.rs:45:10 + | +45 | #[derive(KnownLayout)] + | ^^^^^^^^^^^ the trait `zerocopy_renamed::KnownLayout` is not implemented for `NotKnownLayoutDst` + | + = note: Consider adding `#[derive(KnownLayout)]` to `NotKnownLayoutDst` + = help: the following other types implement trait `zerocopy_renamed::KnownLayout`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 74 others + = help: see issue #48214 + = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `NotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied + --> $DIR/struct.rs:53:10 + | +53 | #[derive(KnownLayout)] + | ^^^^^^^^^^^ the trait `zerocopy_renamed::KnownLayout` is not implemented for `NotKnownLayout` + | + = note: Consider adding `#[derive(KnownLayout)]` to `NotKnownLayout` + = help: the following other types implement trait `zerocopy_renamed::KnownLayout`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 74 others + = help: see issue #48214 + = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is not satisfied + --> $DIR/struct.rs:63:10 + | +63 | #[derive(Immutable)] + | ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<()>` + | + = note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>` + = help: the following other types implement trait `zerocopy_renamed::Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 130 others + = help: see issue #48214 + = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `UnsafeCell: zerocopy_renamed::Immutable` is not satisfied + --> $DIR/struct.rs:70:10 + | +70 | #[derive(Immutable)] + | ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell`, which is required by `[UnsafeCell; 0]: zerocopy_renamed::Immutable` + | + = note: Consider adding `#[derive(Immutable)]` to `UnsafeCell` + = help: the following other types implement trait `zerocopy_renamed::Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 130 others + = note: required for `[UnsafeCell; 0]` to implement `zerocopy_renamed::Immutable` + = help: see issue #48214 + = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type + --> $DIR/struct.rs:84:1 + | +84 | struct TryFromBytesPacked { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `AU16` has a `#[repr(align)]` attribute + --> $DIR/../include.rs:64:5 + | +64 | pub struct AU16(pub u16); + | ^^^^^^^^^^^^^^^ + +error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type + --> $DIR/struct.rs:92:1 + | +92 | struct TryFromBytesPackedN { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `AU16` has a `#[repr(align)]` attribute + --> $DIR/../include.rs:64:5 + | +64 | pub struct AU16(pub u16); + | ^^^^^^^^^^^^^^^ + +error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type + --> $DIR/struct.rs:100:1 + | +100 | struct TryFromBytesCPacked { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `AU16` has a `#[repr(align)]` attribute + --> $DIR/../include.rs:64:5 + | +64 | pub struct AU16(pub u16); + | ^^^^^^^^^^^^^^^ + +error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type + --> $DIR/struct.rs:108:1 + | +108 | struct TryFromBytesCPackedN { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `AU16` has a `#[repr(align)]` attribute + --> $DIR/../include.rs:64:5 + | +64 | pub struct AU16(pub u16); + | ^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied + --> $DIR/struct.rs:120:10 + | +120 | #[derive(IntoBytes)] + | ^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` + | + = note: Consider adding `#[derive(Unaligned)]` to `AU16` + = help: the following other types implement trait `zerocopy_renamed::Unaligned`: + bool + i8 + u8 + NonZero + NonZero + zerocopy_renamed::ReadOnly + U16 + U32 + and 26 others + = help: see issue #48214 + = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `IntoBytes2` has 1 total byte(s) of padding + --> $DIR/struct.rs:129:10 + | +129 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` + | + = help: the trait `PaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `PaddingFree` is implemented for `()` + = help: see issue #48214 + = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `IntoBytes3` has 1 total byte(s) of padding + --> $DIR/struct.rs:138:10 + | +138 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | -303 | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + = help: the trait `PaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `PaddingFree` is implemented for `()` + = help: see issue #48214 + = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): DynamicPaddingFree` is not satisfied - --> $DIR/struct.rs:172:10 +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/struct.rs:156:10 + | +156 | #[derive(IntoBytes)] + | ^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `IntoBytes4`, the trait `Sized` is not implemented for `[u8]`, which is required by `IntoBytes4: macro_util::__size_of::Sized` +note: required because it appears within the type `IntoBytes4` + --> $DIR/struct.rs:161:8 + | +161 | struct IntoBytes4 { + | ^^^^^^^^^^ + = note: required for `IntoBytes4` to implement `macro_util::__size_of::Sized` +note: required by a bound in `macro_util::__size_of::size_of` + --> $WORKSPACE/src/util/macro_util.rs:299:29 + | +299 | pub const fn size_of() -> usize { + | ^^^^^ required by this bound in `size_of` + = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `[u8]` is unsized + --> $DIR/struct.rs:163:8 + | +163 | b: SliceU8, + | ^^^^^^^ `IntoBytes` needs all field types to be `Sized` in order to determine whether there is padding | -172 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `DynamicPaddingFree` is not implemented for `()` + = help: the trait `Sized` is not implemented for `[u8]`, which is required by `[u8]: macro_util::__size_of::Sized` + = note: consider using `#[repr(packed)]` to remove padding + = note: `IntoBytes` does not require the fields of `#[repr(packed)]` types to be `Sized` + = note: required for `[u8]` to implement `macro_util::__size_of::Sized` +note: required by a bound in `macro_util::__size_of::size_of` + --> $WORKSPACE/src/util/macro_util.rs:299:29 | - = help: the following implementations were found: - <() as DynamicPaddingFree> +299 | pub const fn size_of() -> usize { + | ^^^^^ required by this bound in `size_of` + +error[E0277]: `IntoBytes5` has one or more padding bytes + --> $DIR/struct.rs:169:10 + | +169 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` + | + = help: the trait `DynamicPaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `DynamicPaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): DynamicPaddingFree` is not satisfied - --> $DIR/struct.rs:184:10 +error[E0277]: `IntoBytes6` has one or more padding bytes + --> $DIR/struct.rs:180:10 | -184 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `DynamicPaddingFree` is not implemented for `()` +180 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | - = help: the following implementations were found: - <() as DynamicPaddingFree> + = help: the trait `DynamicPaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `DynamicPaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): DynamicPaddingFree` is not satisfied - --> $DIR/struct.rs:197:10 +error[E0277]: `IntoBytes7` has one or more padding bytes + --> $DIR/struct.rs:192:10 | -197 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `DynamicPaddingFree` is not implemented for `()` +192 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | - = help: the following implementations were found: - <() as DynamicPaddingFree> + = help: the trait `DynamicPaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `DynamicPaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): DynamicPaddingFree` is not satisfied - --> $DIR/struct.rs:260:10 +error[E0277]: `IntoBytes13` has one or more padding bytes + --> $DIR/struct.rs:254:10 | -260 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `DynamicPaddingFree` is not implemented for `()` +254 | #[derive(IntoBytes)] + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | - = help: the following implementations were found: - <() as DynamicPaddingFree> + = help: the trait `DynamicPaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `DynamicPaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0587]: type has conflicting packed and align representation hints + --> $DIR/struct.rs:283:1 + | +283 | struct Unaligned3; + | ^^^^^^^^^^^^^^^^^ + error[E0277]: the trait bound `SplitAtNotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied - --> $DIR/struct.rs:328:10 + --> $DIR/struct.rs:321:10 | -328 | #[derive(SplitAt)] +321 | #[derive(SplitAt)] | ^^^^^^^ the trait `zerocopy_renamed::KnownLayout` is not implemented for `SplitAtNotKnownLayout` | + = note: Consider adding `#[derive(KnownLayout)]` to `SplitAtNotKnownLayout` + = help: the following other types implement trait `zerocopy_renamed::KnownLayout`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 74 others note: required by a bound in `SplitAt` - --> $WORKSPACE/src/split_at.rs:61:27 + --> $WORKSPACE/src/split_at.rs:58:27 | -61 | pub unsafe trait SplitAt: KnownLayout { +58 | pub unsafe trait SplitAt: KnownLayout { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `SplitAt` = note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `u8: SplitAt` is not satisfied - --> $DIR/struct.rs:334:10 + --> $DIR/struct.rs:327:10 | -334 | #[derive(SplitAt, KnownLayout)] +327 | #[derive(SplitAt, KnownLayout)] | ^^^^^^^ the trait `SplitAt` is not implemented for `u8` | + = note: Consider adding `#[derive(SplitAt)]` to `u8` + = help: the following other types implement trait `SplitAt`: + SplitAtNotKnownLayout + SplitAtSized + [T] = help: see issue #48214 = note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0271]: type mismatch resolving `::PointerMetadata == usize` - --> $DIR/struct.rs:334:10 +error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied + --> $DIR/struct.rs:238:28 | -334 | #[derive(SplitAt, KnownLayout)] - | ^^^^^^^ expected `()`, found `usize` +238 | is_into_bytes_11::>(); + | ^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`, which is required by `IntoBytes11: zerocopy_renamed::IntoBytes` | - = help: see issue #48214 - = note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: Consider adding `#[derive(Unaligned)]` to `AU16` + = help: the following other types implement trait `zerocopy_renamed::Unaligned`: + bool + i8 + u8 + NonZero + NonZero + zerocopy_renamed::ReadOnly + U16 + U32 + and 26 others +note: required for `IntoBytes11` to implement `zerocopy_renamed::IntoBytes` + --> $DIR/struct.rs:226:10 + | +226 | #[derive(IntoBytes)] + | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro +note: required by a bound in `is_into_bytes_11` + --> $DIR/struct.rs:236:24 + | +236 | fn is_into_bytes_11() { + | ^^^^^^^^^ required by this bound in `is_into_bytes_11` + = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 31 previous errors +error: aborting due to 36 previous errors -Some errors have detailed explanations: E0271, E0277, E0692. -For more information about an error, try `rustc --explain E0271`. +Some errors have detailed explanations: E0277, E0587, E0588, E0692. +For more information about an error, try `rustc --explain E0277`. diff --git a/zerocopy-derive/tests/ui/struct.nightly.stderr b/zerocopy-derive/tests/ui/struct.nightly.stderr index 54d79388da..b7f3b8013a 100644 --- a/zerocopy-derive/tests/ui/struct.nightly.stderr +++ b/zerocopy-derive/tests/ui/struct.nightly.stderr @@ -1,94 +1,94 @@ error: this conflicts with another representation hint - --> $DIR/struct.rs:210:8 + --> $DIR/struct.rs:204:8 | -210 | #[repr(C, C)] // zerocopy-derive conservatively treats these as conflicting reprs +204 | #[repr(C, C)] // zerocopy-derive conservatively treats these as conflicting reprs | ^^^^ error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout - --> $DIR/struct.rs:216:10 + --> $DIR/struct.rs:210:10 | -216 | #[derive(IntoBytes)] +210 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout - --> $DIR/struct.rs:223:10 + --> $DIR/struct.rs:217:10 | -223 | #[derive(IntoBytes)] +217 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout - --> $DIR/struct.rs:250:10 + --> $DIR/struct.rs:244:10 | -250 | #[derive(IntoBytes)] +244 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/struct.rs:273:11 + --> $DIR/struct.rs:266:11 | -273 | #[repr(C, align(2))] +266 | #[repr(C, align(2))] | ^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/struct.rs:279:8 + --> $DIR/struct.rs:272:8 | -279 | #[repr(transparent, align(2))] +272 | #[repr(transparent, align(2))] | ^^^^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/struct.rs:288:8 + --> $DIR/struct.rs:281:8 | -288 | #[repr(packed, align(2))] +281 | #[repr(packed, align(2))] | ^^^^^^^^^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/struct.rs:295:8 + --> $DIR/struct.rs:288:8 | -295 | #[repr(align(1), align(2))] +288 | #[repr(align(1), align(2))] | ^^^^^^^^^^^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/struct.rs:301:8 + --> $DIR/struct.rs:294:8 | -301 | #[repr(align(2), align(4))] +294 | #[repr(align(2), align(4))] | ^^^^^^^^^^^^^^^^^^ error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/struct.rs:305:10 + --> $DIR/struct.rs:298:10 | -305 | #[derive(Unaligned)] +298 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/struct.rs:310:10 + --> $DIR/struct.rs:303:10 | -310 | #[derive(Unaligned)] +303 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: this conflicts with another representation hint - --> $DIR/struct.rs:320:19 + --> $DIR/struct.rs:313:19 | -320 | #[repr(packed(2), C)] +313 | #[repr(packed(2), C)] | ___________________^ -321 | | -322 | | #[derive(Unaligned)] -323 | | #[zerocopy(crate = "zerocopy_renamed")] -324 | | #[repr(C, packed(2))] +314 | | +315 | | #[derive(Unaligned)] +316 | | #[zerocopy(crate = "zerocopy_renamed")] +317 | | #[repr(C, packed(2))] | |________^ error[E0692]: transparent struct cannot have other repr hints - --> $DIR/struct.rs:279:8 + --> $DIR/struct.rs:272:8 | -279 | #[repr(transparent, align(2))] +272 | #[repr(transparent, align(2))] | ^^^^^^^^^^^ ^^^^^^^^ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -324,7 +324,7 @@ error[E0277]: `IntoBytes2` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> src/util/macro_util.rs:62:0 + --> src/util/macro_util.rs:59:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -333,9 +333,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: `IntoBytes3` has 1 total byte(s) of padding - --> $DIR/struct.rs:139:10 + --> $DIR/struct.rs:138:10 | -139 | #[derive(IntoBytes)] +138 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -343,7 +343,7 @@ error[E0277]: `IntoBytes3` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> src/util/macro_util.rs:62:0 + --> src/util/macro_util.rs:59:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -352,26 +352,26 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/struct.rs:158:10 + --> $DIR/struct.rs:156:10 | -158 | #[derive(IntoBytes)] +156 | #[derive(IntoBytes)] | ^^^^^^^^^ doesn't have a size known at compile-time | = help: within `IntoBytes4`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `IntoBytes4` - --> $DIR/struct.rs:163:8 + --> $DIR/struct.rs:161:8 | -163 | struct IntoBytes4 { +161 | struct IntoBytes4 { | ^^^^^^^^^^ = note: required for `IntoBytes4` to implement `zerocopy_renamed::util::macro_util::__size_of::Sized` note: required by a bound in `zerocopy_renamed::util::macro_util::__size_of::size_of` - --> src/util/macro_util.rs:306:4 + --> src/util/macro_util.rs:299:4 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `[u8]` is unsized - --> $DIR/struct.rs:165:8 + --> $DIR/struct.rs:163:8 | -165 | b: SliceU8, +163 | b: SliceU8, | ^^^^^^^ `IntoBytes` needs all field types to be `Sized` in order to determine whether there is padding | = help: the trait `Sized` is not implemented for `[u8]` @@ -379,12 +379,12 @@ error[E0277]: `[u8]` is unsized = note: `IntoBytes` does not require the fields of `#[repr(packed)]` types to be `Sized` = note: required for `[u8]` to implement `zerocopy_renamed::util::macro_util::__size_of::Sized` note: required by a bound in `zerocopy_renamed::util::macro_util::__size_of::size_of` - --> src/util/macro_util.rs:306:4 + --> src/util/macro_util.rs:299:4 error[E0277]: `IntoBytes5` has one or more padding bytes - --> $DIR/struct.rs:172:10 + --> $DIR/struct.rs:169:10 | -172 | #[derive(IntoBytes)] +169 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -392,7 +392,7 @@ error[E0277]: `IntoBytes5` has one or more padding bytes = note: consider using `#[repr(packed)]` to remove padding help: the trait `DynamicPaddingFree` is not implemented for `()` but trait `DynamicPaddingFree` is implemented for it - --> src/util/macro_util.rs:80:0 + --> src/util/macro_util.rs:74:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -401,9 +401,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: `IntoBytes6` has one or more padding bytes - --> $DIR/struct.rs:184:10 + --> $DIR/struct.rs:180:10 | -184 | #[derive(IntoBytes)] +180 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -411,7 +411,7 @@ error[E0277]: `IntoBytes6` has one or more padding bytes = note: consider using `#[repr(packed)]` to remove padding help: the trait `DynamicPaddingFree` is not implemented for `()` but trait `DynamicPaddingFree` is implemented for it - --> src/util/macro_util.rs:80:0 + --> src/util/macro_util.rs:74:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -420,9 +420,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: `IntoBytes7` has one or more padding bytes - --> $DIR/struct.rs:197:10 + --> $DIR/struct.rs:192:10 | -197 | #[derive(IntoBytes)] +192 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -430,7 +430,7 @@ error[E0277]: `IntoBytes7` has one or more padding bytes = note: consider using `#[repr(packed)]` to remove padding help: the trait `DynamicPaddingFree` is not implemented for `()` but trait `DynamicPaddingFree` is implemented for it - --> src/util/macro_util.rs:80:0 + --> src/util/macro_util.rs:74:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -439,9 +439,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: `IntoBytes13` has one or more padding bytes - --> $DIR/struct.rs:260:10 + --> $DIR/struct.rs:254:10 | -260 | #[derive(IntoBytes)] +254 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -449,7 +449,7 @@ error[E0277]: `IntoBytes13` has one or more padding bytes = note: consider using `#[repr(packed)]` to remove padding help: the trait `DynamicPaddingFree` is not implemented for `()` but trait `DynamicPaddingFree` is implemented for it - --> src/util/macro_util.rs:80:0 + --> src/util/macro_util.rs:74:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -458,21 +458,21 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0587]: type has conflicting packed and align representation hints - --> $DIR/struct.rs:290:1 + --> $DIR/struct.rs:283:1 | -290 | struct Unaligned3; +283 | struct Unaligned3; | ^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `SplitAtNotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied - --> $DIR/struct.rs:328:10 + --> $DIR/struct.rs:321:10 | -328 | #[derive(SplitAt)] +321 | #[derive(SplitAt)] | ^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `SplitAtNotKnownLayout` - --> $DIR/struct.rs:332:1 + --> $DIR/struct.rs:325:1 | -332 | struct SplitAtNotKnownLayout([u8]); +325 | struct SplitAtNotKnownLayout([u8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: Consider adding `#[derive(KnownLayout)]` to `SplitAtNotKnownLayout` = help: the following other types implement trait `zerocopy_renamed::KnownLayout`: @@ -486,25 +486,25 @@ help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `SplitAtN AtomicI16 and 73 others note: required by a bound in `SplitAt` - --> src/split_at.rs:61:0 + --> src/split_at.rs:58:0 = note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `u8: SplitAt` is not satisfied - --> $DIR/struct.rs:334:10 + --> $DIR/struct.rs:327:10 | -334 | #[derive(SplitAt, KnownLayout)] +327 | #[derive(SplitAt, KnownLayout)] | ^^^^^^^ the trait `SplitAt` is not implemented for `u8` | = note: Consider adding `#[derive(SplitAt)]` to `u8` help: the following other types implement trait `SplitAt` - --> $DIR/struct.rs:328:10 + --> $DIR/struct.rs:321:10 | -328 | #[derive(SplitAt)] +321 | #[derive(SplitAt)] | ^^^^^^^ `SplitAtNotKnownLayout` ... -334 | #[derive(SplitAt, KnownLayout)] +327 | #[derive(SplitAt, KnownLayout)] | ^^^^^^^ `SplitAtSized` - --> src/split_at.rs:251:0 + --> src/split_at.rs:248:0 | = note: `[T]` = help: see issue #48214 @@ -515,9 +515,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/struct.rs:244:28 + --> $DIR/struct.rs:238:28 | -244 | is_into_bytes_11::>(); +238 | is_into_bytes_11::>(); | ^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` @@ -537,14 +537,14 @@ help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` I128 and 26 others note: required for `IntoBytes11` to implement `zerocopy_renamed::IntoBytes` - --> $DIR/struct.rs:232:10 + --> $DIR/struct.rs:226:10 | -232 | #[derive(IntoBytes)] +226 | #[derive(IntoBytes)] | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `is_into_bytes_11` - --> $DIR/struct.rs:242:24 + --> $DIR/struct.rs:236:24 | -242 | fn is_into_bytes_11() { +236 | fn is_into_bytes_11() { | ^^^^^^^^^ required by this bound in `is_into_bytes_11` = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui/struct.rs b/zerocopy-derive/tests/ui/struct.rs index cb16a89d16..3721017a4b 100644 --- a/zerocopy-derive/tests/ui/struct.rs +++ b/zerocopy-derive/tests/ui/struct.rs @@ -82,7 +82,7 @@ struct Immutable2 { #[zerocopy(crate = "zerocopy_renamed")] #[repr(packed)] struct TryFromBytesPacked { - //~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type + //~[msrv, stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type foo: AU16, } @@ -90,7 +90,7 @@ struct TryFromBytesPacked { #[zerocopy(crate = "zerocopy_renamed")] #[repr(packed(1))] struct TryFromBytesPackedN { - //~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type + //~[msrv, stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type foo: AU16, } @@ -98,7 +98,7 @@ struct TryFromBytesPackedN { #[zerocopy(crate = "zerocopy_renamed")] #[repr(C, packed)] struct TryFromBytesCPacked { - //~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type + //~[msrv, stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type foo: AU16, } @@ -106,7 +106,7 @@ struct TryFromBytesCPacked { #[zerocopy(crate = "zerocopy_renamed")] #[repr(C, packed(1))] struct TryFromBytesCPackedN { - //~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type + //~[msrv, stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type foo: AU16, } @@ -127,8 +127,7 @@ struct IntoBytes1 { } #[derive(IntoBytes)] -//~[stable, nightly]^ ERROR: `IntoBytes2` has 1 total byte(s) of padding -//~[msrv]^^ ERROR: the trait bound `(): PaddingFree` is not satisfied +//~[msrv, stable, nightly]^ ERROR: `IntoBytes2` has 1 total byte(s) of padding #[zerocopy(crate = "zerocopy_renamed")] #[repr(C)] struct IntoBytes2 { @@ -137,8 +136,7 @@ struct IntoBytes2 { } #[derive(IntoBytes)] -//~[stable, nightly]^ ERROR: `IntoBytes3` has 1 total byte(s) of padding -//~[msrv]^^ ERROR: the trait bound `(): PaddingFree` is not satisfied +//~[msrv, stable, nightly]^ ERROR: `IntoBytes3` has 1 total byte(s) of padding #[zerocopy(crate = "zerocopy_renamed")] #[repr(C, packed(2))] struct IntoBytes3 { @@ -163,15 +161,13 @@ type SliceU8 = [u8]; struct IntoBytes4 { a: u8, b: SliceU8, - //~[stable, nightly]^ ERROR: `[u8]` is unsized - //~[msrv]^^ ERROR: the size for values of type `[u8]` cannot be known at compilation time + //~[msrv, stable, nightly]^ ERROR: `[u8]` is unsized } // Padding between `u8` and `[u16]`. `[u16]` is syntactically identifiable as a // slice, so this case is handled by our `repr(C)` slice DST support. #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): DynamicPaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes5` has one or more padding bytes +//~[msrv, stable, nightly]^ ERROR: `IntoBytes5` has one or more padding bytes #[zerocopy(crate = "zerocopy_renamed")] #[repr(C)] struct IntoBytes5 { @@ -182,8 +178,7 @@ struct IntoBytes5 { // Trailing padding after `[u8]`. `[u8]` is syntactically identifiable as a // slice, so this case is handled by our `repr(C)` slice DST support. #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): DynamicPaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes6` has one or more padding bytes +//~[msrv, stable, nightly]^ ERROR: `IntoBytes6` has one or more padding bytes #[zerocopy(crate = "zerocopy_renamed")] #[repr(C)] struct IntoBytes6 { @@ -195,8 +190,7 @@ struct IntoBytes6 { // is syntactically identifiable as a slice, so this case is handled by our // `repr(C)` slice DST support. #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): DynamicPaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes7` has one or more padding bytes +//~[msrv, stable, nightly]^ ERROR: `IntoBytes7` has one or more padding bytes #[zerocopy(crate = "zerocopy_renamed")] #[repr(C)] struct IntoBytes7 { @@ -242,7 +236,7 @@ struct IntoBytes11 { fn is_into_bytes_11() { if false { is_into_bytes_11::>(); - //~[stable, nightly]^ ERROR: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied + //~[msrv, stable, nightly]^ ERROR: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied } } @@ -258,8 +252,7 @@ struct IntoBytes12 { // NOTE(#3063): This exists to ensure that our analysis for structs with // syntactic DSTs accounts for `align(N)`. #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): DynamicPaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes13` has one or more padding bytes +//~[msrv, stable, nightly]^ ERROR: `IntoBytes13` has one or more padding bytes #[zerocopy(crate = "zerocopy_renamed")] #[repr(C, align(2))] struct IntoBytes13([u8]); @@ -288,7 +281,7 @@ struct Unaligned2 { #[repr(packed, align(2))] //~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint struct Unaligned3; -//~[stable, nightly]^ ERROR: type has conflicting packed and align representation hints +//~[msrv, stable, nightly]^ ERROR: type has conflicting packed and align representation hints #[derive(Unaligned)] #[zerocopy(crate = "zerocopy_renamed")] @@ -332,8 +325,7 @@ struct WeirdReprSpan; struct SplitAtNotKnownLayout([u8]); #[derive(SplitAt, KnownLayout)] -//~[msrv]^ ERROR: type mismatch resolving `::PointerMetadata == usize` -//~[msrv, stable, nightly]^^ ERROR: the trait bound `u8: SplitAt` is not satisfied +//~[msrv, stable, nightly]^ ERROR: the trait bound `u8: SplitAt` is not satisfied #[zerocopy(crate = "zerocopy_renamed")] #[repr(C)] struct SplitAtSized(u8); diff --git a/zerocopy-derive/tests/ui/struct.stable.stderr b/zerocopy-derive/tests/ui/struct.stable.stderr index 996ab8973e..6d183b3cf1 100644 --- a/zerocopy-derive/tests/ui/struct.stable.stderr +++ b/zerocopy-derive/tests/ui/struct.stable.stderr @@ -1,89 +1,89 @@ error: this conflicts with another representation hint - --> $DIR/struct.rs:210:11 + --> $DIR/struct.rs:204:11 | -210 | #[repr(C, C)] // zerocopy-derive conservatively treats these as conflicting reprs +204 | #[repr(C, C)] // zerocopy-derive conservatively treats these as conflicting reprs | ^ error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout - --> $DIR/struct.rs:216:10 + --> $DIR/struct.rs:210:10 | -216 | #[derive(IntoBytes)] +210 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout - --> $DIR/struct.rs:223:10 + --> $DIR/struct.rs:217:10 | -223 | #[derive(IntoBytes)] +217 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout - --> $DIR/struct.rs:250:10 + --> $DIR/struct.rs:244:10 | -250 | #[derive(IntoBytes)] +244 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/struct.rs:273:11 + --> $DIR/struct.rs:266:11 | -273 | #[repr(C, align(2))] +266 | #[repr(C, align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/struct.rs:279:8 + --> $DIR/struct.rs:272:8 | -279 | #[repr(transparent, align(2))] +272 | #[repr(transparent, align(2))] | ^^^^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/struct.rs:288:16 + --> $DIR/struct.rs:281:16 | -288 | #[repr(packed, align(2))] +281 | #[repr(packed, align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/struct.rs:295:18 + --> $DIR/struct.rs:288:18 | -295 | #[repr(align(1), align(2))] +288 | #[repr(align(1), align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/struct.rs:301:18 + --> $DIR/struct.rs:294:18 | -301 | #[repr(align(2), align(4))] +294 | #[repr(align(2), align(4))] | ^^^^^ error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/struct.rs:305:10 + --> $DIR/struct.rs:298:10 | -305 | #[derive(Unaligned)] +298 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/struct.rs:310:10 + --> $DIR/struct.rs:303:10 | -310 | #[derive(Unaligned)] +303 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: this conflicts with another representation hint - --> $DIR/struct.rs:324:8 + --> $DIR/struct.rs:317:8 | -324 | #[repr(C, packed(2))] +317 | #[repr(C, packed(2))] | ^ error[E0692]: transparent struct cannot have other repr hints - --> $DIR/struct.rs:279:8 + --> $DIR/struct.rs:272:8 | -279 | #[repr(transparent, align(2))] +272 | #[repr(transparent, align(2))] | ^^^^^^^^^^^ ^^^^^^^^ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -291,17 +291,17 @@ error[E0277]: `IntoBytes2` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:62:1 + --> $WORKSPACE/src/util/macro_util.rs:59:1 | - 62 | impl PaddingFree for () {} + 59 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes3` has 1 total byte(s) of padding - --> $DIR/struct.rs:139:10 + --> $DIR/struct.rs:138:10 | -139 | #[derive(IntoBytes)] +138 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -309,37 +309,37 @@ error[E0277]: `IntoBytes3` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:62:1 + --> $WORKSPACE/src/util/macro_util.rs:59:1 | - 62 | impl PaddingFree for () {} + 59 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (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 - --> $DIR/struct.rs:158:10 + --> $DIR/struct.rs:156:10 | -158 | #[derive(IntoBytes)] +156 | #[derive(IntoBytes)] | ^^^^^^^^^ doesn't have a size known at compile-time | = help: within `IntoBytes4`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `IntoBytes4` - --> $DIR/struct.rs:163:8 + --> $DIR/struct.rs:161:8 | -163 | struct IntoBytes4 { +161 | struct IntoBytes4 { | ^^^^^^^^^^ = note: required for `IntoBytes4` to implement `macro_util::__size_of::Sized` note: required by a bound in `macro_util::__size_of::size_of` - --> $WORKSPACE/src/util/macro_util.rs:306:29 + --> $WORKSPACE/src/util/macro_util.rs:299:29 | -306 | pub const fn size_of() -> usize { +299 | pub const fn size_of() -> usize { | ^^^^^ required by this bound in `size_of` = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `[u8]` is unsized - --> $DIR/struct.rs:165:8 + --> $DIR/struct.rs:163:8 | -165 | b: SliceU8, +163 | b: SliceU8, | ^^^^^^^ `IntoBytes` needs all field types to be `Sized` in order to determine whether there is padding | = help: the trait `Sized` is not implemented for `[u8]` @@ -347,15 +347,15 @@ error[E0277]: `[u8]` is unsized = note: `IntoBytes` does not require the fields of `#[repr(packed)]` types to be `Sized` = note: required for `[u8]` to implement `macro_util::__size_of::Sized` note: required by a bound in `macro_util::__size_of::size_of` - --> $WORKSPACE/src/util/macro_util.rs:306:29 + --> $WORKSPACE/src/util/macro_util.rs:299:29 | -306 | pub const fn size_of() -> usize { +299 | pub const fn size_of() -> usize { | ^^^^^ required by this bound in `size_of` error[E0277]: `IntoBytes5` has one or more padding bytes - --> $DIR/struct.rs:172:10 + --> $DIR/struct.rs:169:10 | -172 | #[derive(IntoBytes)] +169 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -363,17 +363,17 @@ error[E0277]: `IntoBytes5` has one or more padding bytes = note: consider using `#[repr(packed)]` to remove padding help: the trait `DynamicPaddingFree` is not implemented for `()` but trait `DynamicPaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:80:1 + --> $WORKSPACE/src/util/macro_util.rs:74:1 | - 80 | impl DynamicPaddingFree for () {} + 74 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes6` has one or more padding bytes - --> $DIR/struct.rs:184:10 + --> $DIR/struct.rs:180:10 | -184 | #[derive(IntoBytes)] +180 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -381,17 +381,17 @@ error[E0277]: `IntoBytes6` has one or more padding bytes = note: consider using `#[repr(packed)]` to remove padding help: the trait `DynamicPaddingFree` is not implemented for `()` but trait `DynamicPaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:80:1 + --> $WORKSPACE/src/util/macro_util.rs:74:1 | - 80 | impl DynamicPaddingFree for () {} + 74 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes7` has one or more padding bytes - --> $DIR/struct.rs:197:10 + --> $DIR/struct.rs:192:10 | -197 | #[derive(IntoBytes)] +192 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -399,17 +399,17 @@ error[E0277]: `IntoBytes7` has one or more padding bytes = note: consider using `#[repr(packed)]` to remove padding help: the trait `DynamicPaddingFree` is not implemented for `()` but trait `DynamicPaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:80:1 + --> $WORKSPACE/src/util/macro_util.rs:74:1 | - 80 | impl DynamicPaddingFree for () {} + 74 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `IntoBytes13` has one or more padding bytes - --> $DIR/struct.rs:260:10 + --> $DIR/struct.rs:254:10 | -260 | #[derive(IntoBytes)] +254 | #[derive(IntoBytes)] | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields @@ -417,29 +417,29 @@ error[E0277]: `IntoBytes13` has one or more padding bytes = note: consider using `#[repr(packed)]` to remove padding help: the trait `DynamicPaddingFree` is not implemented for `()` but trait `DynamicPaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:80:1 + --> $WORKSPACE/src/util/macro_util.rs:74:1 | - 80 | impl DynamicPaddingFree for () {} + 74 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0587]: type has conflicting packed and align representation hints - --> $DIR/struct.rs:290:1 + --> $DIR/struct.rs:283:1 | -290 | struct Unaligned3; +283 | struct Unaligned3; | ^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `SplitAtNotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied - --> $DIR/struct.rs:328:10 + --> $DIR/struct.rs:321:10 | -328 | #[derive(SplitAt)] +321 | #[derive(SplitAt)] | ^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `SplitAtNotKnownLayout` - --> $DIR/struct.rs:332:1 + --> $DIR/struct.rs:325:1 | -332 | struct SplitAtNotKnownLayout([u8]); +325 | struct SplitAtNotKnownLayout([u8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: Consider adding `#[derive(KnownLayout)]` to `SplitAtNotKnownLayout` = help: the following other types implement trait `zerocopy_renamed::KnownLayout`: @@ -453,39 +453,39 @@ help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `SplitAtN AtomicI16 and 73 others note: required by a bound in `SplitAt` - --> $WORKSPACE/src/split_at.rs:61:27 + --> $WORKSPACE/src/split_at.rs:58:27 | - 61 | pub unsafe trait SplitAt: KnownLayout { + 58 | pub unsafe trait SplitAt: KnownLayout { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `SplitAt` = note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `u8: SplitAt` is not satisfied - --> $DIR/struct.rs:334:10 + --> $DIR/struct.rs:327:10 | -334 | #[derive(SplitAt, KnownLayout)] +327 | #[derive(SplitAt, KnownLayout)] | ^^^^^^^ the trait `SplitAt` is not implemented for `u8` | = note: Consider adding `#[derive(SplitAt)]` to `u8` help: the following other types implement trait `SplitAt` - --> $DIR/struct.rs:328:10 + --> $DIR/struct.rs:321:10 | -328 | #[derive(SplitAt)] +321 | #[derive(SplitAt)] | ^^^^^^^ `SplitAtNotKnownLayout` ... -334 | #[derive(SplitAt, KnownLayout)] +327 | #[derive(SplitAt, KnownLayout)] | ^^^^^^^ `SplitAtSized` | - ::: $WORKSPACE/src/split_at.rs:251:1 + ::: $WORKSPACE/src/split_at.rs:248:1 | -251 | unsafe impl SplitAt for [T] { +248 | unsafe impl SplitAt for [T] { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[T]` = help: see issue #48214 = note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied - --> $DIR/struct.rs:244:28 + --> $DIR/struct.rs:238:28 | -244 | is_into_bytes_11::>(); +238 | is_into_bytes_11::>(); | ^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` @@ -505,14 +505,14 @@ help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16` I128 and 26 others note: required for `IntoBytes11` to implement `zerocopy_renamed::IntoBytes` - --> $DIR/struct.rs:232:10 + --> $DIR/struct.rs:226:10 | -232 | #[derive(IntoBytes)] +226 | #[derive(IntoBytes)] | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro note: required by a bound in `is_into_bytes_11` - --> $DIR/struct.rs:242:24 + --> $DIR/struct.rs:236:24 | -242 | fn is_into_bytes_11() { +236 | fn is_into_bytes_11() { | ^^^^^^^^^ required by this bound in `is_into_bytes_11` = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui/union.msrv.stderr b/zerocopy-derive/tests/ui/union.msrv.stderr index 9a3203cfa6..fcd28bea96 100644 --- a/zerocopy-derive/tests/ui/union.msrv.stderr +++ b/zerocopy-derive/tests/ui/union.msrv.stderr @@ -7,57 +7,57 @@ error: unsupported on types with type parameters = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)] - --> $DIR/union.rs:55:10 + --> $DIR/union.rs:54:10 | -55 | #[derive(IntoBytes)] +54 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)] - --> $DIR/union.rs:63:10 + --> $DIR/union.rs:62:10 | -63 | #[derive(IntoBytes)] +62 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/union.rs:77:11 + --> $DIR/union.rs:76:11 | -77 | #[repr(C, align(2))] +76 | #[repr(C, align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:95:16 + --> $DIR/union.rs:94:16 | -95 | #[repr(packed, align(2))] +94 | #[repr(packed, align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:104:18 + --> $DIR/union.rs:103:18 | -104 | #[repr(align(1), align(2))] +103 | #[repr(align(1), align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:112:18 + --> $DIR/union.rs:111:18 | -112 | #[repr(align(2), align(4))] +111 | #[repr(align(2), align(4))] | ^^^^^ error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/union.rs:118:10 + --> $DIR/union.rs:117:10 | -118 | #[derive(Unaligned)] +117 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/union.rs:126:10 + --> $DIR/union.rs:125:10 | -126 | #[derive(Unaligned)] +125 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -66,23 +66,56 @@ error[E0277]: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is n --> $DIR/union.rs:25:10 | 25 | #[derive(Immutable)] - | ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<()>` + | ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<()>`, which is required by `ManuallyDrop>: zerocopy_renamed::Immutable` | - = note: required because of the requirements on the impl of `zerocopy_renamed::Immutable` for `ManuallyDrop>` + = note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>` + = help: the following other types implement trait `zerocopy_renamed::Immutable`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and 129 others + = note: required for `ManuallyDrop>` to implement `zerocopy_renamed::Immutable` = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `(): PaddingFree` is not satisfied +error[E0277]: `IntoBytes2` has 1 total byte(s) of padding --> $DIR/union.rs:44:10 | 44 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `PaddingFree` is not implemented for `()` + | ^^^^^^^^^ types with padding cannot implement `IntoBytes` | - = help: the following implementations were found: - <() as PaddingFree> + = help: the trait `PaddingFree` is not implemented for `()` + = note: consider using `zerocopy::Unalign` to lower the alignment of individual fields + = note: consider adding explicit fields where padding would be + = note: consider using `#[repr(packed)]` to remove padding + = help: the trait `PaddingFree` is implemented for `()` = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 11 previous errors +error[E0587]: type has conflicting packed and align representation hints + --> $DIR/union.rs:96:1 + | +96 | union Unaligned3 { + | ^^^^^^^^^^^^^^^^ + +error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type + --> $DIR/union.rs:129:1 + | +129 | union Unaligned7 { + | ^^^^^^^^^^^^^^^^ + | +note: `AU16` has a `#[repr(align)]` attribute + --> $DIR/../include.rs:64:5 + | +64 | pub struct AU16(pub u16); + | ^^^^^^^^^^^^^^^ + +error: aborting due to 13 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0587, E0588. +For more information about an error, try `rustc --explain E0277`. diff --git a/zerocopy-derive/tests/ui/union.nightly.stderr b/zerocopy-derive/tests/ui/union.nightly.stderr index c48fb2e221..b7a655d6d9 100644 --- a/zerocopy-derive/tests/ui/union.nightly.stderr +++ b/zerocopy-derive/tests/ui/union.nightly.stderr @@ -7,57 +7,57 @@ error: unsupported on types with type parameters = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)] - --> $DIR/union.rs:55:10 + --> $DIR/union.rs:54:10 | -55 | #[derive(IntoBytes)] +54 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)] - --> $DIR/union.rs:63:10 + --> $DIR/union.rs:62:10 | -63 | #[derive(IntoBytes)] +62 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/union.rs:77:11 + --> $DIR/union.rs:76:11 | -77 | #[repr(C, align(2))] +76 | #[repr(C, align(2))] | ^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:95:8 + --> $DIR/union.rs:94:8 | -95 | #[repr(packed, align(2))] +94 | #[repr(packed, align(2))] | ^^^^^^^^^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:104:8 + --> $DIR/union.rs:103:8 | -104 | #[repr(align(1), align(2))] +103 | #[repr(align(1), align(2))] | ^^^^^^^^^^^^^^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:112:8 + --> $DIR/union.rs:111:8 | -112 | #[repr(align(2), align(4))] +111 | #[repr(align(2), align(4))] | ^^^^^^^^^^^^^^^^^^ error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/union.rs:118:10 + --> $DIR/union.rs:117:10 | -118 | #[derive(Unaligned)] +117 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/union.rs:126:10 + --> $DIR/union.rs:125:10 | -126 | #[derive(Unaligned)] +125 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -98,7 +98,7 @@ error[E0277]: `IntoBytes2` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> src/util/macro_util.rs:62:0 + --> src/util/macro_util.rs:59:0 = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -107,15 +107,15 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | error[E0587]: type has conflicting packed and align representation hints - --> $DIR/union.rs:97:1 + --> $DIR/union.rs:96:1 | -97 | union Unaligned3 { +96 | union Unaligned3 { | ^^^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type - --> $DIR/union.rs:130:1 + --> $DIR/union.rs:129:1 | -130 | union Unaligned7 { +129 | union Unaligned7 { | ^^^^^^^^^^^^^^^^ | note: `AU16` has a `#[repr(align)]` attribute diff --git a/zerocopy-derive/tests/ui/union.rs b/zerocopy-derive/tests/ui/union.rs index 7663dfcdb5..0b88fdafca 100644 --- a/zerocopy-derive/tests/ui/union.rs +++ b/zerocopy-derive/tests/ui/union.rs @@ -42,8 +42,7 @@ union IntoBytes1 { } #[derive(IntoBytes)] -//~[msrv]^ ERROR: the trait bound `(): PaddingFree` is not satisfied -//~[stable, nightly]^^ ERROR: `IntoBytes2` has 1 total byte(s) of padding +//~[msrv, stable, nightly]^ ERROR: `IntoBytes2` has 1 total byte(s) of padding #[zerocopy(crate = "zerocopy_renamed")] #[repr(C)] union IntoBytes2 { @@ -95,7 +94,7 @@ union Unaligned1 { #[repr(packed, align(2))] //~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint union Unaligned3 { - //~[stable, nightly]^ ERROR: type has conflicting packed and align representation hints + //~[msrv, stable, nightly]^ ERROR: type has conflicting packed and align representation hints foo: u8, } @@ -128,7 +127,7 @@ union Unaligned6 { #[zerocopy(crate = "zerocopy_renamed")] #[repr(packed(2))] union Unaligned7 { - //~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type + //~[msrv, stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type foo: i16, bar: AU16, } diff --git a/zerocopy-derive/tests/ui/union.stable.stderr b/zerocopy-derive/tests/ui/union.stable.stderr index 1e224a6fe5..471b2ea750 100644 --- a/zerocopy-derive/tests/ui/union.stable.stderr +++ b/zerocopy-derive/tests/ui/union.stable.stderr @@ -7,57 +7,57 @@ error: unsupported on types with type parameters = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)] - --> $DIR/union.rs:55:10 + --> $DIR/union.rs:54:10 | -55 | #[derive(IntoBytes)] +54 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)] - --> $DIR/union.rs:63:10 + --> $DIR/union.rs:62:10 | -63 | #[derive(IntoBytes)] +62 | #[derive(IntoBytes)] | ^^^^^^^^^ | = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot derive `Unaligned` on type with alignment greater than 1 - --> $DIR/union.rs:77:11 + --> $DIR/union.rs:76:11 | -77 | #[repr(C, align(2))] +76 | #[repr(C, align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:95:16 + --> $DIR/union.rs:94:16 | -95 | #[repr(packed, align(2))] +94 | #[repr(packed, align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:104:18 + --> $DIR/union.rs:103:18 | -104 | #[repr(align(1), align(2))] +103 | #[repr(align(1), align(2))] | ^^^^^ error: this conflicts with another representation hint - --> $DIR/union.rs:112:18 + --> $DIR/union.rs:111:18 | -112 | #[repr(align(2), align(4))] +111 | #[repr(align(2), align(4))] | ^^^^^ error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/union.rs:118:10 + --> $DIR/union.rs:117:10 | -118 | #[derive(Unaligned)] +117 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment - --> $DIR/union.rs:126:10 + --> $DIR/union.rs:125:10 | -126 | #[derive(Unaligned)] +125 | #[derive(Unaligned)] | ^^^^^^^^^ | = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -94,23 +94,23 @@ error[E0277]: `IntoBytes2` has 1 total byte(s) of padding = note: consider using `#[repr(packed)]` to remove padding help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it - --> $WORKSPACE/src/util/macro_util.rs:62:1 + --> $WORKSPACE/src/util/macro_util.rs:59:1 | -62 | impl PaddingFree for () {} +59 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0587]: type has conflicting packed and align representation hints - --> $DIR/union.rs:97:1 + --> $DIR/union.rs:96:1 | -97 | union Unaligned3 { +96 | union Unaligned3 { | ^^^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type - --> $DIR/union.rs:130:1 + --> $DIR/union.rs:129:1 | -130 | union Unaligned7 { +129 | union Unaligned7 { | ^^^^^^^^^^^^^^^^ | note: `AU16` has a `#[repr(align)]` attribute