diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-06-10 22:15:42 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-06-10 22:15:42 +0000 |
commit | c37d137d0d5455fcabb2e9ef1ca991339060f114 (patch) | |
tree | 507dbbee077c22e982dea44acd706b5e9a0fb40a | |
parent | 75f4a992e8ff5eb0b6bac567ef68b02b908e81fe (diff) | |
parent | 0828b80ba46d28c958c4d4530a1c5a75f38eedb1 (diff) | |
download | zerocopy-build-tools-release.tar.gz |
Snap for 11949379 from 0828b80ba46d28c958c4d4530a1c5a75f38eedb1 to build-tools-releasebuild-tools-release
Change-Id: I079a31cd706273aee62cf4fd72e19f5aafdc3368
42 files changed, 529 insertions, 547 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 80e9fc6..d82b54c 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "5b76223e0eddea87e0f81429e218d12de94cd954" + "sha1": "4147d951c9003b16affbb32ba24d744a01178331" }, "path_in_vcs": "" }
\ No newline at end of file @@ -25,7 +25,7 @@ rust_library { host_supported: true, crate_name: "zerocopy", cargo_env_compat: true, - cargo_pkg_version: "0.7.29", + cargo_pkg_version: "0.7.34", crate_root: "src/lib.rs", edition: "2018", features: [ @@ -48,7 +48,7 @@ rust_library_rlib { name: "libzerocopy_nostd", crate_name: "zerocopy", cargo_env_compat: true, - cargo_pkg_version: "0.7.29", + cargo_pkg_version: "0.7.34", crate_root: "src/lib.rs", edition: "2018", features: [ @@ -79,7 +79,7 @@ rust_library_rlib { name: "libzerocopy_nostd_noalloc", crate_name: "zerocopy", cargo_env_compat: true, - cargo_pkg_version: "0.7.29", + cargo_pkg_version: "0.7.34", crate_root: "src/lib.rs", edition: "2018", features: [ @@ -13,17 +13,31 @@ edition = "2018" rust-version = "1.60.0" name = "zerocopy" -version = "0.7.29" +version = "0.7.34" authors = ["Joshua Liebow-Feeser <joshlf@google.com>"] exclude = [".*"] description = "Utilities for zero-copy parsing and serialization" readme = "README.md" +keywords = [ + "cast", + "convert", + "transmute", + "transmutation", + "type-punning", +] +categories = [ + "embedded", + "encoding", + "no-std::no-alloc", + "parsing", + "rust-patterns", +] license = "BSD-2-Clause OR Apache-2.0 OR MIT" repository = "https://github.com/google/zerocopy" [package.metadata.ci] -pinned-nightly = "nightly-2023-12-04" -pinned-stable = "1.74.0" +pinned-nightly = "nightly-2024-05-05" +pinned-stable = "1.78.0" [package.metadata.docs.rs] all-features = true @@ -42,7 +56,7 @@ optional = true default-features = false [dependencies.zerocopy-derive] -version = "=0.7.29" +version = "=0.7.34" optional = true [dev-dependencies.assert_matches] @@ -69,7 +83,7 @@ version = "=1.0.85" features = ["diff"] [dev-dependencies.zerocopy-derive] -version = "=0.7.29" +version = "=0.7.34" [features] __internal_use_only_features_that_work_on_stable = [ @@ -84,4 +98,4 @@ simd = [] simd-nightly = ["simd"] [target."cfg(any())".dependencies.zerocopy-derive] -version = "=0.7.29" +version = "=0.7.34" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 9355f08..b2c19b6 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -15,9 +15,11 @@ [package] edition = "2018" name = "zerocopy" -version = "0.7.29" +version = "0.7.34" authors = ["Joshua Liebow-Feeser <joshlf@google.com>"] description = "Utilities for zero-copy parsing and serialization" +categories = ["embedded", "encoding", "no-std::no-alloc", "parsing", "rust-patterns"] +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.60.0" @@ -30,8 +32,8 @@ rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"] [package.metadata.ci] # The versions of the stable and nightly compiler toolchains to use in CI. -pinned-stable = "1.74.0" -pinned-nightly = "nightly-2023-12-04" +pinned-stable = "1.78.0" +pinned-nightly = "nightly-2024-05-05" [package.metadata.playground] features = ["__internal_use_only_features_that_work_on_stable"] @@ -49,7 +51,7 @@ simd-nightly = ["simd"] __internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd"] [dependencies] -zerocopy-derive = { version = "=0.7.29", path = "zerocopy-derive", optional = true } +zerocopy-derive = { version = "=0.7.34", path = "zerocopy-derive", optional = true } [dependencies.byteorder] version = "1.3" @@ -60,7 +62,7 @@ optional = true # 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.7.29", path = "zerocopy-derive" } +zerocopy-derive = { version = "=0.7.34", path = "zerocopy-derive" } [dev-dependencies] assert_matches = "1.5" @@ -75,6 +77,6 @@ testutil = { path = "testutil" } # CI test failures. trybuild = { version = "=1.0.85", features = ["diff"] } # In tests, unlike in production, zerocopy-derive is not optional -zerocopy-derive = { version = "=0.7.29", path = "zerocopy-derive" } +zerocopy-derive = { version = "=0.7.34", path = "zerocopy-derive" } # TODO(#381) Remove this dependency once we have our own layout gadgets. elain = "0.3.0" @@ -1,5 +1,5 @@ # This project was upgraded with external_updater. -# Usage: tools/external_updater/updater.sh update rust/crates/zerocopy +# Usage: tools/external_updater/updater.sh update external/rust/crates/zerocopy # For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md name: "zerocopy" @@ -7,9 +7,9 @@ description: "Utilities for zero-copy parsing and serialization" third_party { license_type: NOTICE last_upgrade_date { - year: 2023 - month: 12 - day: 5 + year: 2024 + month: 6 + day: 4 } identifier { type: "crates.io" @@ -18,7 +18,7 @@ third_party { } identifier { type: "Archive" - value: "https://static.crates.io/crates/zerocopy/zerocopy-0.7.29.crate" - version: "0.7.29" + value: "https://static.crates.io/crates/zerocopy/zerocopy-0.7.34.crate" + version: "0.7.34" } } diff --git a/POLICIES.md b/POLICIES.md index a2f175c..a9d9cc5 100644 --- a/POLICIES.md +++ b/POLICIES.md @@ -93,3 +93,11 @@ Our minimum supported Rust version (MSRV) is encoded in our `Cargo.toml` file. 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). + +## Yanking + +Whenever a bug or regression is identified, we will yank any affected versions +which are part of the current version train. For example, if the most recent +version is 0.10.20 and a bug is uncovered, we will release a fix in 0.10.21 and +yank all 0.10.X versions which are affected. We *may* also yank versions in previous +version trains on a case-by-case basis, but we don't guarantee it. @@ -143,6 +143,12 @@ See our [MSRV policy]. [MSRV policy]: https://github.com/google/zerocopy/blob/main/POLICIES.md#msrv +## Changelog + +Zerocopy uses [GitHub Releases]. + +[GitHub Releases]: https://github.com/google/zerocopy/releases + ## Disclaimer Disclaimer: Zerocopy is not an officially supported Google product. diff --git a/cargo2rulesmk.json b/cargo2rulesmk.json index a9e982a..5a7f099 100644 --- a/cargo2rulesmk.json +++ b/cargo2rulesmk.json @@ -1,3 +1,4 @@ { - "features": "default,derive,alloc" + "features": "default,derive,alloc", + "patch": "patches/rules.mk.diff" } diff --git a/patches/rules.mk.diff b/patches/rules.mk.diff index ecea77e..967fbc8 100644 --- a/patches/rules.mk.diff +++ b/patches/rules.mk.diff @@ -1,14 +1,12 @@ diff --git a/rules.mk b/rules.mk -index 05e4383..9e71d6d 100644 +index 6290e64..959d61c 100644 --- a/rules.mk +++ b/rules.mk -@@ -8,8 +8,8 @@ MODULE_SRCS := \ - $(LOCAL_DIR)/src/lib.rs \ +@@ -16,6 +16,7 @@ MODULE_RUSTFLAGS += \ + --cfg 'feature="zerocopy-derive"' \ - MODULE_RUST_EDITION := 2018 -+# TODO(b/316076550): Remove rules.mk patch when cargo2rulesmk.py is fixed - MODULE_RUSTFLAGS += \ -- --cfg 'feature="byteorder"' \ - --cfg 'feature="default"' \ - --cfg 'feature="derive"' \ - --cfg 'feature="zerocopy-derive"' \ + MODULE_LIBRARY_DEPS := \ ++ $(call FIND_CRATE,liballoc) \ + external/rust/crates/byteorder \ + external/rust/crates/zerocopy-derive \ + diff --git a/src/byteorder.rs b/src/byteorder.rs index 2769410..376c981 100644 --- a/src/byteorder.rs +++ b/src/byteorder.rs @@ -653,6 +653,7 @@ mod tests { use compatibility::*; // A native integer type (u16, i32, etc). + #[cfg_attr(kani, allow(dead_code))] trait Native: Arbitrary + FromBytes + AsBytes + Copy + PartialEq + Debug { const ZERO: Self; const MAX_VALUE: Self; @@ -664,11 +665,6 @@ mod tests { rng.sample(Self::DIST) } - #[cfg(kani)] - fn any() -> Self { - kani::any() - } - fn checked_add(self, rhs: Self) -> Option<Self>; fn checked_div(self, rhs: Self) -> Option<Self>; fn checked_mul(self, rhs: Self) -> Option<Self>; @@ -142,17 +142,24 @@ //! See our [MSRV policy]. //! //! [MSRV policy]: https://github.com/google/zerocopy/blob/main/POLICIES.md#msrv +//! +//! # Changelog +//! +//! Zerocopy uses [GitHub Releases]. +//! +//! [GitHub Releases]: https://github.com/google/zerocopy/releases // Sometimes we want to use lints which were added after our MSRV. // `unknown_lints` is `warn` by default and we deny warnings in CI, so without // this attribute, any unknown lint would cause a CI failure when testing with // our MSRV. -#![allow(unknown_lints)] +// +// TODO(#1201): Remove `unexpected_cfgs` +#![allow(unknown_lints, non_local_definitions, unexpected_cfgs)] #![deny(renamed_and_removed_lints)] #![deny( anonymous_parameters, deprecated_in_future, - illegal_floating_point_literal_pattern, late_bound_lifetime_arguments, missing_copy_implementations, missing_debug_implementations, @@ -222,7 +229,18 @@ clippy::indexing_slicing, ))] #![cfg_attr(not(test), no_std)] -#![cfg_attr(feature = "simd-nightly", feature(stdsimd))] +#![cfg_attr( + all(feature = "simd-nightly", any(target_arch = "x86", target_arch = "x86_64")), + feature(stdarch_x86_avx512) +)] +#![cfg_attr( + all(feature = "simd-nightly", target_arch = "arm"), + feature(stdarch_arm_dsp, stdarch_arm_neon_intrinsics) +)] +#![cfg_attr( + all(feature = "simd-nightly", any(target_arch = "powerpc", target_arch = "powerpc64")), + feature(stdarch_powerpc) +)] #![cfg_attr(doc_cfg, feature(doc_cfg))] #![cfg_attr( __INTERNAL_USE_ONLY_NIGHLTY_FEATURES_IN_TESTS, @@ -243,6 +261,7 @@ mod macros; pub mod byteorder; #[doc(hidden)] pub mod macro_util; +mod post_monomorphization_compile_fail_tests; mod util; // TODO(#252): If we make this pub, come up with a better name. mod wrappers; @@ -1346,8 +1365,8 @@ pub unsafe trait TryFromBytes { )] #[cfg_attr( not(feature = "derive"), - doc = concat!("[derive]: https://docs.rs/zerocopy/", "0.7.29", "/zerocopy/derive.FromZeroes.html"), - doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", "0.7.29", "/zerocopy/derive.FromZeroes.html#analysis"), + doc = concat!("[derive]: https://docs.rs/zerocopy/", "0.7.34", "/zerocopy/derive.FromZeroes.html"), + doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", "0.7.34", "/zerocopy/derive.FromZeroes.html#analysis"), )] pub unsafe trait FromZeroes { // The `Self: Sized` bound makes it so that `FromZeroes` is still object @@ -1790,8 +1809,8 @@ pub use zerocopy_derive::FromBytes; )] #[cfg_attr( not(feature = "derive"), - doc = concat!("[derive]: https://docs.rs/zerocopy/", "0.7.29", "/zerocopy/derive.FromBytes.html"), - doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", "0.7.29", "/zerocopy/derive.FromBytes.html#analysis"), + doc = concat!("[derive]: https://docs.rs/zerocopy/", "0.7.34", "/zerocopy/derive.FromBytes.html"), + doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", "0.7.34", "/zerocopy/derive.FromBytes.html#analysis"), )] pub unsafe trait FromBytes: FromZeroes { // The `Self: Sized` bound makes it so that `FromBytes` is still object @@ -2642,8 +2661,8 @@ pub use zerocopy_derive::AsBytes; )] #[cfg_attr( not(feature = "derive"), - doc = concat!("[derive]: https://docs.rs/zerocopy/", "0.7.29", "/zerocopy/derive.AsBytes.html"), - doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", "0.7.29", "/zerocopy/derive.AsBytes.html#analysis"), + doc = concat!("[derive]: https://docs.rs/zerocopy/", "0.7.34", "/zerocopy/derive.AsBytes.html"), + doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", "0.7.34", "/zerocopy/derive.AsBytes.html#analysis"), )] pub unsafe trait AsBytes { // The `Self: Sized` bound makes it so that this function doesn't prevent @@ -3783,7 +3802,7 @@ macro_rules! transmute { // problem for 2018 edition crates. unsafe { // Clippy: It's okay to transmute a type to itself. - #[allow(clippy::useless_transmute)] + #[allow(clippy::useless_transmute, clippy::missing_transmute_annotations)] $crate::macro_util::core_reexport::mem::transmute(e) } } @@ -4638,12 +4657,12 @@ where /// `into_ref` consumes the `Ref`, and returns a reference to `T`. #[inline(always)] pub fn into_ref(self) -> &'a T { - // SAFETY: This is sound because `B` is guaranteed to live for the - // lifetime `'a`, meaning that a) the returned reference cannot outlive - // the `B` from which `self` was constructed and, b) no mutable methods - // on that `B` can be called during the lifetime of the returned - // reference. See the documentation on `deref_helper` for what - // invariants we are required to uphold. + assert!(B::INTO_REF_INTO_MUT_ARE_SOUND); + + // SAFETY: According to the safety preconditions on + // `ByteSlice::INTO_REF_INTO_MUT_ARE_SOUND`, the preceding assert + // ensures that, given `B: 'a`, it is sound to drop `self` and still + // access the underlying memory using reads for `'a`. unsafe { self.deref_helper() } } } @@ -4658,12 +4677,13 @@ where /// `into_mut` consumes the `Ref`, and returns a mutable reference to `T`. #[inline(always)] pub fn into_mut(mut self) -> &'a mut T { - // SAFETY: This is sound because `B` is guaranteed to live for the - // lifetime `'a`, meaning that a) the returned reference cannot outlive - // the `B` from which `self` was constructed and, b) no other methods - - // mutable or immutable - on that `B` can be called during the lifetime - // of the returned reference. See the documentation on - // `deref_mut_helper` for what invariants we are required to uphold. + assert!(B::INTO_REF_INTO_MUT_ARE_SOUND); + + // SAFETY: According to the safety preconditions on + // `ByteSlice::INTO_REF_INTO_MUT_ARE_SOUND`, the preceding assert + // ensures that, given `B: 'a + ByteSliceMut`, it is sound to drop + // `self` and still access the underlying memory using both reads and + // writes for `'a`. unsafe { self.deref_mut_helper() } } } @@ -4678,12 +4698,12 @@ where /// `into_slice` consumes the `Ref`, and returns a reference to `[T]`. #[inline(always)] pub fn into_slice(self) -> &'a [T] { - // SAFETY: This is sound because `B` is guaranteed to live for the - // lifetime `'a`, meaning that a) the returned reference cannot outlive - // the `B` from which `self` was constructed and, b) no mutable methods - // on that `B` can be called during the lifetime of the returned - // reference. See the documentation on `deref_slice_helper` for what - // invariants we are required to uphold. + assert!(B::INTO_REF_INTO_MUT_ARE_SOUND); + + // SAFETY: According to the safety preconditions on + // `ByteSlice::INTO_REF_INTO_MUT_ARE_SOUND`, the preceding assert + // ensures that, given `B: 'a`, it is sound to drop `self` and still + // access the underlying memory using reads for `'a`. unsafe { self.deref_slice_helper() } } } @@ -4699,13 +4719,13 @@ where /// `[T]`. #[inline(always)] pub fn into_mut_slice(mut self) -> &'a mut [T] { - // SAFETY: This is sound because `B` is guaranteed to live for the - // lifetime `'a`, meaning that a) the returned reference cannot outlive - // the `B` from which `self` was constructed and, b) no other methods - - // mutable or immutable - on that `B` can be called during the lifetime - // of the returned reference. See the documentation on - // `deref_mut_slice_helper` for what invariants we are required to - // uphold. + assert!(B::INTO_REF_INTO_MUT_ARE_SOUND); + + // SAFETY: According to the safety preconditions on + // `ByteSlice::INTO_REF_INTO_MUT_ARE_SOUND`, the preceding assert + // ensures that, given `B: 'a + ByteSliceMut`, it is sound to drop + // `self` and still access the underlying memory using both reads and + // writes for `'a`. unsafe { self.deref_mut_slice_helper() } } } @@ -5118,9 +5138,30 @@ mod sealed { not(feature = "alloc"), doc = "[`Vec<u8>`]: https://doc.rust-lang.org/std/vec/struct.Vec.html" )] -pub unsafe trait ByteSlice: - Deref<Target = [u8]> + Sized + self::sealed::ByteSliceSealed -{ +pub unsafe trait ByteSlice: Deref<Target = [u8]> + Sized + sealed::ByteSliceSealed { + /// Are the [`Ref::into_ref`] and [`Ref::into_mut`] methods sound when used + /// with `Self`? If not, evaluating this constant must panic at compile + /// time. + /// + /// This exists to work around #716 on versions of zerocopy prior to 0.8. + /// + /// # Safety + /// + /// This may only be set to true if the following holds: Given the + /// following: + /// - `Self: 'a` + /// - `bytes: Self` + /// - `let ptr = bytes.as_ptr()` + /// + /// ...then: + /// - Using `ptr` to read the memory previously addressed by `bytes` is + /// sound for `'a` even after `bytes` has been dropped. + /// - If `Self: ByteSliceMut`, using `ptr` to write the memory previously + /// addressed by `bytes` is sound for `'a` even after `bytes` has been + /// dropped. + #[doc(hidden)] + const INTO_REF_INTO_MUT_ARE_SOUND: bool; + /// Gets a raw pointer to the first byte in the slice. #[inline] fn as_ptr(&self) -> *const u8 { @@ -5155,6 +5196,10 @@ impl<'a> sealed::ByteSliceSealed for &'a [u8] {} // TODO(#429): Add a "SAFETY" comment and remove this `allow`. #[allow(clippy::undocumented_unsafe_blocks)] unsafe impl<'a> ByteSlice for &'a [u8] { + // SAFETY: If `&'b [u8]: 'a`, then the underlying memory is treated as + // borrowed immutably for `'a` even if the slice itself is dropped. + const INTO_REF_INTO_MUT_ARE_SOUND: bool = true; + #[inline] fn split_at(self, mid: usize) -> (Self, Self) { <[u8]>::split_at(self, mid) @@ -5165,6 +5210,10 @@ impl<'a> sealed::ByteSliceSealed for &'a mut [u8] {} // TODO(#429): Add a "SAFETY" comment and remove this `allow`. #[allow(clippy::undocumented_unsafe_blocks)] unsafe impl<'a> ByteSlice for &'a mut [u8] { + // SAFETY: If `&'b mut [u8]: 'a`, then the underlying memory is treated as + // borrowed mutably for `'a` even if the slice itself is dropped. + const INTO_REF_INTO_MUT_ARE_SOUND: bool = true; + #[inline] fn split_at(self, mid: usize) -> (Self, Self) { <[u8]>::split_at_mut(self, mid) @@ -5175,6 +5224,16 @@ impl<'a> sealed::ByteSliceSealed for cell::Ref<'a, [u8]> {} // TODO(#429): Add a "SAFETY" comment and remove this `allow`. #[allow(clippy::undocumented_unsafe_blocks)] unsafe impl<'a> ByteSlice for cell::Ref<'a, [u8]> { + const INTO_REF_INTO_MUT_ARE_SOUND: bool = if !cfg!(doc) { + panic!("Ref::into_ref and Ref::into_mut are unsound when used with core::cell::Ref; see https://github.com/google/zerocopy/issues/716") + } else { + // When compiling documentation, allow the evaluation of this constant + // to succeed. This doesn't represent a soundness hole - it just delays + // any error to runtime. The reason we need this is that, otherwise, + // `rustdoc` will fail when trying to document this item. + false + }; + #[inline] fn split_at(self, mid: usize) -> (Self, Self) { cell::Ref::map_split(self, |slice| <[u8]>::split_at(slice, mid)) @@ -5185,6 +5244,16 @@ impl<'a> sealed::ByteSliceSealed for RefMut<'a, [u8]> {} // TODO(#429): Add a "SAFETY" comment and remove this `allow`. #[allow(clippy::undocumented_unsafe_blocks)] unsafe impl<'a> ByteSlice for RefMut<'a, [u8]> { + const INTO_REF_INTO_MUT_ARE_SOUND: bool = if !cfg!(doc) { + panic!("Ref::into_ref and Ref::into_mut are unsound when used with core::cell::RefMut; see https://github.com/google/zerocopy/issues/716") + } else { + // When compiling documentation, allow the evaluation of this constant + // to succeed. This doesn't represent a soundness hole - it just delays + // any error to runtime. The reason we need this is that, otherwise, + // `rustdoc` will fail when trying to document this item. + false + }; + #[inline] fn split_at(self, mid: usize) -> (Self, Self) { RefMut::map_split(self, |slice| <[u8]>::split_at_mut(slice, mid)) @@ -6354,6 +6423,7 @@ mod tests { // | `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name | // | N | N | N | Y | KL01 | #[derive(KnownLayout)] + #[allow(dead_code)] // fields are never read struct KL01(NotKnownLayout<AU32>, NotKnownLayout<AU16>); let expected = DstLayout::for_type::<KL01>(); @@ -6364,6 +6434,7 @@ mod tests { // ...with `align(N)`: #[derive(KnownLayout)] #[repr(align(64))] + #[allow(dead_code)] // fields are never read struct KL01Align(NotKnownLayout<AU32>, NotKnownLayout<AU16>); let expected = DstLayout::for_type::<KL01Align>(); @@ -6374,6 +6445,7 @@ mod tests { // ...with `packed`: #[derive(KnownLayout)] #[repr(packed)] + #[allow(dead_code)] // fields are never read struct KL01Packed(NotKnownLayout<AU32>, NotKnownLayout<AU16>); let expected = DstLayout::for_type::<KL01Packed>(); @@ -6384,6 +6456,7 @@ mod tests { // ...with `packed(N)`: #[derive(KnownLayout)] #[repr(packed(2))] + #[allow(dead_code)] // fields are never read struct KL01PackedN(NotKnownLayout<AU32>, NotKnownLayout<AU16>); assert_impl_all!(KL01PackedN: KnownLayout); @@ -6396,6 +6469,7 @@ mod tests { // | `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name | // | N | N | Y | Y | KL03 | #[derive(KnownLayout)] + #[allow(dead_code)] // fields are never read struct KL03(NotKnownLayout, u8); let expected = DstLayout::for_type::<KL03>(); @@ -6406,6 +6480,7 @@ mod tests { // ... with `align(N)` #[derive(KnownLayout)] #[repr(align(64))] + #[allow(dead_code)] // fields are never read struct KL03Align(NotKnownLayout<AU32>, u8); let expected = DstLayout::for_type::<KL03Align>(); @@ -6416,6 +6491,7 @@ mod tests { // ... with `packed`: #[derive(KnownLayout)] #[repr(packed)] + #[allow(dead_code)] // fields are never read struct KL03Packed(NotKnownLayout<AU32>, u8); let expected = DstLayout::for_type::<KL03Packed>(); @@ -6426,6 +6502,7 @@ mod tests { // ... with `packed(N)` #[derive(KnownLayout)] #[repr(packed(2))] + #[allow(dead_code)] // fields are never read struct KL03PackedN(NotKnownLayout<AU32>, u8); assert_impl_all!(KL03PackedN: KnownLayout); @@ -6438,6 +6515,7 @@ mod tests { // | `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name | // | N | Y | N | Y | KL05 | #[derive(KnownLayout)] + #[allow(dead_code)] // fields are never read struct KL05<T>(u8, T); fn _test_kl05<T>(t: T) -> impl KnownLayout { @@ -6447,6 +6525,7 @@ mod tests { // | `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name | // | N | Y | Y | Y | KL07 | #[derive(KnownLayout)] + #[allow(dead_code)] // fields are never read struct KL07<T: KnownLayout>(u8, T); fn _test_kl07<T: KnownLayout>(t: T) -> impl KnownLayout { @@ -7597,6 +7676,7 @@ mod tests { fn test_transparent_packed_generic_struct() { #[derive(AsBytes, FromZeroes, FromBytes, Unaligned)] #[repr(transparent)] + #[allow(dead_code)] // for the unused fields struct Foo<T> { _t: T, _phantom: PhantomData<()>, @@ -7607,6 +7687,7 @@ mod tests { #[derive(AsBytes, FromZeroes, FromBytes, Unaligned)] #[repr(packed)] + #[allow(dead_code)] // for the unused fields struct Bar<T, U> { _t: T, _u: U, diff --git a/src/macro_util.rs b/src/macro_util.rs index 24fec4f..4d4c020 100644 --- a/src/macro_util.rs +++ b/src/macro_util.rs @@ -294,6 +294,7 @@ macro_rules! assert_align_gt_eq { ($t:ident, $u: ident) => {{ // The comments here should be read in the context of this macro's // invocations in `transmute_ref!` and `transmute_mut!`. + #[allow(clippy::missing_transmute_annotations)] if false { // The type wildcard in this bound is inferred to be `T` because // `align_of.into_t()` is assigned to `t` (which has type `T`). @@ -328,7 +329,7 @@ macro_rules! assert_size_eq { // SAFETY: This code is never run. $u = unsafe { // Clippy: It's okay to transmute a type to itself. - #[allow(clippy::useless_transmute)] + #[allow(clippy::useless_transmute, clippy::missing_transmute_annotations)] $crate::macro_util::core_reexport::mem::transmute($t) }; } else { @@ -478,6 +479,7 @@ mod tests { macro_rules! test { (#[$cfg:meta] ($($ts:ty),* ; $trailing_field_ty:ty) => $expect:expr) => {{ #[$cfg] + #[allow(dead_code)] // fields are never read struct Test($($ts,)* $trailing_field_ty); assert_eq!(test!(@offset $($ts),* ; $trailing_field_ty), $expect); }}; @@ -617,6 +619,7 @@ mod tests { macro_rules! test { (#[$cfg:meta] ($($ts:ty),*) => $expect:expr) => {{ #[$cfg] + #[allow(dead_code)] // fields are never read struct Test($($ts),*); assert_eq!(struct_has_padding!(Test, $($ts),*), $expect); }}; diff --git a/src/post_monomorphization_compile_fail_tests.rs b/src/post_monomorphization_compile_fail_tests.rs new file mode 100644 index 0000000..32505b6 --- /dev/null +++ b/src/post_monomorphization_compile_fail_tests.rs @@ -0,0 +1,118 @@ +// Copyright 2018 The Fuchsia Authors +// +// Licensed under the 2-Clause BSD License <LICENSE-BSD or +// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0 +// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT +// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. +// This file may not be copied, modified, or distributed except according to +// those terms. + +//! Code that should fail to compile during the post-monomorphization compiler +//! pass. +//! +//! Due to [a limitation with the `trybuild` crate][trybuild-issue], we cannot +//! use our UI testing framework to test compilation failures that are +//! encountered after monomorphization has complated. This module has one item +//! for each such test we would prefer to have as a UI test, with the code in +//! question appearing as a rustdoc example which is marked with `compile_fail`. +//! This has the effect of causing doctests to fail if any of these examples +//! compile successfully. +//! +//! This is very much a hack and not a complete replacement for UI tests - most +//! notably because this only provides a single "compile vs fail" bit of +//! information, but does not allow us to depend upon the specific error that +//! causes compilation to fail. +//! +//! [trybuild-issue]: https://github.com/dtolnay/trybuild/issues/241 + +// Miri doesn't detect post-monimorphization failures as compile-time failures, +// but instead as runtime failures. +#![cfg(not(miri))] + +/// ```compile_fail +/// use core::cell::{Ref, RefCell}; +/// +/// let refcell = RefCell::new([0u8, 1, 2, 3]); +/// let core_ref = refcell.borrow(); +/// let core_ref = Ref::map(core_ref, |bytes| &bytes[..]); +/// +/// // `zc_ref` now stores `core_ref` internally. +/// let zc_ref = zerocopy::Ref::<_, u32>::new(core_ref).unwrap(); +/// +/// // This causes `core_ref` to get dropped and synthesizes a Rust +/// // reference to the memory `core_ref` was pointing at. +/// let rust_ref = zc_ref.into_ref(); +/// +/// // UB!!! This mutates `rust_ref`'s referent while it's alive. +/// *refcell.borrow_mut() = [0, 0, 0, 0]; +/// +/// println!("{}", rust_ref); +/// ``` +#[allow(unused)] +const REFCELL_REF_INTO_REF: () = (); + +/// ```compile_fail +/// use core::cell::{RefCell, RefMut}; +/// +/// let refcell = RefCell::new([0u8, 1, 2, 3]); +/// let core_ref_mut = refcell.borrow_mut(); +/// let core_ref_mut = RefMut::map(core_ref_mut, |bytes| &mut bytes[..]); +/// +/// // `zc_ref` now stores `core_ref_mut` internally. +/// let zc_ref = zerocopy::Ref::<_, u32>::new(core_ref_mut).unwrap(); +/// +/// // This causes `core_ref_mut` to get dropped and synthesizes a Rust +/// // reference to the memory `core_ref` was pointing at. +/// let rust_ref_mut = zc_ref.into_mut(); +/// +/// // UB!!! This mutates `rust_ref_mut`'s referent while it's alive. +/// *refcell.borrow_mut() = [0, 0, 0, 0]; +/// +/// println!("{}", rust_ref_mut); +/// ``` +#[allow(unused)] +const REFCELL_REFMUT_INTO_MUT: () = (); + +/// ```compile_fail +/// use core::cell::{Ref, RefCell}; +/// +/// let refcell = RefCell::new([0u8, 1, 2, 3]); +/// let core_ref = refcell.borrow(); +/// let core_ref = Ref::map(core_ref, |bytes| &bytes[..]); +/// +/// // `zc_ref` now stores `core_ref` internally. +/// let zc_ref = zerocopy::Ref::<_, [u16]>::new_slice(core_ref).unwrap(); +/// +/// // This causes `core_ref` to get dropped and synthesizes a Rust +/// // reference to the memory `core_ref` was pointing at. +/// let rust_ref = zc_ref.into_slice(); +/// +/// // UB!!! This mutates `rust_ref`'s referent while it's alive. +/// *refcell.borrow_mut() = [0, 0, 0, 0]; +/// +/// println!("{:?}", rust_ref); +/// ``` +#[allow(unused)] +const REFCELL_REFMUT_INTO_SLICE: () = (); + +/// ```compile_fail +/// use core::cell::{RefCell, RefMut}; +/// +/// let refcell = RefCell::new([0u8, 1, 2, 3]); +/// let core_ref_mut = refcell.borrow_mut(); +/// let core_ref_mut = RefMut::map(core_ref_mut, |bytes| &mut bytes[..]); +/// +/// // `zc_ref` now stores `core_ref_mut` internally. +/// let zc_ref = zerocopy::Ref::<_, [u16]>::new_slice(core_ref_mut).unwrap(); +/// +/// // This causes `core_ref_mut` to get dropped and synthesizes a Rust +/// // reference to the memory `core_ref` was pointing at. +/// let rust_ref_mut = zc_ref.into_mut_slice(); +/// +/// // UB!!! This mutates `rust_ref_mut`'s referent while it's alive. +/// *refcell.borrow_mut() = [0, 0, 0, 0]; +/// +/// println!("{:?}", rust_ref_mut); +/// ``` +#[allow(unused)] +const REFCELL_REFMUT_INTO_MUT_SLICE: () = (); diff --git a/src/util.rs b/src/util.rs index b35cc07..50cad1f 100644 --- a/src/util.rs +++ b/src/util.rs @@ -652,10 +652,12 @@ pub(crate) mod polyfills { // MSRV is 1.70, when that function was stabilized. // // TODO(#67): Once our MSRV is 1.70, remove this. + #[allow(unused)] pub(crate) trait NonNullExt<T> { fn slice_from_raw_parts(data: Self, len: usize) -> NonNull<[T]>; } + #[allow(unused)] impl<T> NonNullExt<T> for NonNull<T> { #[inline(always)] fn slice_from_raw_parts(data: Self, len: usize) -> NonNull<[T]> { diff --git a/src/wrappers.rs b/src/wrappers.rs index 532d872..6532bb4 100644 --- a/src/wrappers.rs +++ b/src/wrappers.rs @@ -134,7 +134,7 @@ impl<T> Unalign<T> { /// may prefer [`Deref::deref`], which is infallible. #[inline(always)] pub fn try_deref(&self) -> Option<&T> { - if !crate::util::aligned_to::<_, T>(self) { + if !util::aligned_to::<_, T>(self) { return None; } @@ -154,7 +154,7 @@ impl<T> Unalign<T> { /// callers may prefer [`DerefMut::deref_mut`], which is infallible. #[inline(always)] pub fn try_deref_mut(&mut self) -> Option<&mut T> { - if !crate::util::aligned_to::<_, T>(&*self) { + if !util::aligned_to::<_, T>(&*self) { return None; } diff --git a/tests/ui-nightly/include_value_not_from_bytes.stderr b/tests/ui-nightly/include_value_not_from_bytes.stderr index d948a0d..f7c7fdd 100644 --- a/tests/ui-nightly/include_value_not_from_bytes.stderr +++ b/tests/ui-nightly/include_value_not_from_bytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `UnsafeCell<u32>: FromBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 + () + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> + ManuallyDrop<T> and $N others note: required by a bound in `AssertIsFromBytes` --> tests/ui-nightly/include_value_not_from_bytes.rs:12:5 diff --git a/tests/ui-nightly/invalid-impls/invalid-impls.stderr b/tests/ui-nightly/invalid-impls/invalid-impls.stderr index e5651d1..1c91309 100644 --- a/tests/ui-nightly/invalid-impls/invalid-impls.stderr +++ b/tests/ui-nightly/invalid-impls/invalid-impls.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: zerocopy::FromZeroes` is not satisfied --> tests/ui-nightly/invalid-impls/invalid-impls.rs:26:37 | 26 | impl_or_verify!(T => FromZeroes for Foo<T>); - | ^^^^^^ the trait `zerocopy::FromZeroes` is not implemented for `T` + | ^^^^^^ the trait `zerocopy::FromZeroes` is not implemented for `T`, which is required by `Foo<T>: zerocopy::FromZeroes` | note: required for `Foo<T>` to implement `zerocopy::FromZeroes` --> tests/ui-nightly/invalid-impls/invalid-impls.rs:22:10 @@ -29,7 +29,7 @@ error[E0277]: the trait bound `T: zerocopy::FromBytes` is not satisfied --> tests/ui-nightly/invalid-impls/invalid-impls.rs:27:36 | 27 | impl_or_verify!(T => FromBytes for Foo<T>); - | ^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `T` + | ^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `T`, which is required by `Foo<T>: zerocopy::FromBytes` | note: required for `Foo<T>` to implement `zerocopy::FromBytes` --> tests/ui-nightly/invalid-impls/invalid-impls.rs:22:22 @@ -56,7 +56,7 @@ error[E0277]: the trait bound `T: zerocopy::AsBytes` is not satisfied --> tests/ui-nightly/invalid-impls/invalid-impls.rs:28:34 | 28 | impl_or_verify!(T => AsBytes for Foo<T>); - | ^^^^^^ the trait `zerocopy::AsBytes` is not implemented for `T` + | ^^^^^^ the trait `zerocopy::AsBytes` is not implemented for `T`, which is required by `Foo<T>: zerocopy::AsBytes` | note: required for `Foo<T>` to implement `zerocopy::AsBytes` --> tests/ui-nightly/invalid-impls/invalid-impls.rs:22:33 @@ -83,7 +83,7 @@ error[E0277]: the trait bound `T: zerocopy::Unaligned` is not satisfied --> tests/ui-nightly/invalid-impls/invalid-impls.rs:29:36 | 29 | impl_or_verify!(T => Unaligned for Foo<T>); - | ^^^^^^ the trait `zerocopy::Unaligned` is not implemented for `T` + | ^^^^^^ the trait `zerocopy::Unaligned` is not implemented for `T`, which is required by `Foo<T>: zerocopy::Unaligned` | note: required for `Foo<T>` to implement `zerocopy::Unaligned` --> tests/ui-nightly/invalid-impls/invalid-impls.rs:22:42 diff --git a/tests/ui-nightly/max-align.stderr b/tests/ui-nightly/max-align.stderr index 0cadb9a..c11eed5 100644 --- a/tests/ui-nightly/max-align.stderr +++ b/tests/ui-nightly/max-align.stderr @@ -1,5 +1,5 @@ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> tests/ui-nightly/max-align.rs:96:11 + --> tests/ui-nightly/max-align.rs:96:17 | 96 | #[repr(C, align(1073741824))] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ diff --git a/tests/ui-nightly/transmute-dst-not-frombytes.stderr b/tests/ui-nightly/transmute-dst-not-frombytes.stderr index a9f1f7b..70bec21 100644 --- a/tests/ui-nightly/transmute-dst-not-frombytes.stderr +++ b/tests/ui-nightly/transmute-dst-not-frombytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 + () + AU16 + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertIsFromBytes` --> tests/ui-nightly/transmute-dst-not-frombytes.rs:18:41 diff --git a/tests/ui-nightly/transmute-mut-const.stderr b/tests/ui-nightly/transmute-mut-const.stderr index fa53ed0..b4abf97 100644 --- a/tests/ui-nightly/transmute-mut-const.stderr +++ b/tests/ui-nightly/transmute-mut-const.stderr @@ -21,6 +21,7 @@ error[E0658]: mutable references are not allowed in constants | = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + = note: this compiler was built on 2024-05-04; consider upgrading it if it is out of date error[E0015]: cannot call non-const fn `transmute_mut::<'_, '_, [u8; 2], [u8; 2]>` in constants --> tests/ui-nightly/transmute-mut-const.rs:20:37 @@ -30,13 +31,3 @@ error[E0015]: cannot call non-const fn `transmute_mut::<'_, '_, [u8; 2], [u8; 2] | = 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 - --> tests/ui-nightly/transmute-mut-const.rs:20:57 - | -20 | const CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); - | --------------------^^^^^^^^^^^^- - | | | - | | creates a temporary value 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` diff --git a/tests/ui-nightly/transmute-mut-dst-not-asbytes.stderr b/tests/ui-nightly/transmute-mut-dst-not-asbytes.stderr index 54c8e60..7de5da6 100644 --- a/tests/ui-nightly/transmute-mut-dst-not-asbytes.stderr +++ b/tests/ui-nightly/transmute-mut-dst-not-asbytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `Dst: AsBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 + () + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> + ManuallyDrop<T> and $N others note: required by a bound in `AssertDstIsAsBytes` --> tests/ui-nightly/transmute-mut-dst-not-asbytes.rs:24:36 diff --git a/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr b/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr index ea2123b..9df4ebc 100644 --- a/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr +++ b/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `Dst: FromBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 + () + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> + ManuallyDrop<T> and $N others note: required by a bound in `AssertDstIsFromBytes` --> tests/ui-nightly/transmute-mut-dst-not-frombytes.rs:24:38 diff --git a/tests/ui-nightly/transmute-mut-dst-unsized.stderr b/tests/ui-nightly/transmute-mut-dst-unsized.stderr index a670e25..5e3fbb4 100644 --- a/tests/ui-nightly/transmute-mut-dst-unsized.stderr +++ b/tests/ui-nightly/transmute-mut-dst-unsized.stderr @@ -50,11 +50,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -64,11 +64,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` +note: required by an implicit `Sized` bound in `transmute` --> $RUST/core/src/intrinsics.rs | | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute` = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -78,9 +78,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_mut` +note: required by an implicit `Sized` bound in `transmute_mut` --> src/macro_util.rs | | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_mut` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-nightly/transmute-mut-src-dst-unsized.stderr b/tests/ui-nightly/transmute-mut-src-dst-unsized.stderr index 0f41a42..2fe6658 100644 --- a/tests/ui-nightly/transmute-mut-src-dst-unsized.stderr +++ b/tests/ui-nightly/transmute-mut-src-dst-unsized.stderr @@ -139,11 +139,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -153,11 +153,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -167,11 +167,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -192,11 +192,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` +note: required by an implicit `Sized` bound in `transmute` --> $RUST/core/src/intrinsics.rs | | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute` = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -209,11 +209,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_mut` +note: required by an implicit `Sized` bound in `transmute_mut` --> src/macro_util.rs | | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_mut` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -223,9 +223,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_mut` +note: required by an implicit `Sized` bound in `transmute_mut` --> src/macro_util.rs | | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_mut` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-nightly/transmute-mut-src-not-asbytes.stderr b/tests/ui-nightly/transmute-mut-src-not-asbytes.stderr index b755d3c..0b4154b 100644 --- a/tests/ui-nightly/transmute-mut-src-not-asbytes.stderr +++ b/tests/ui-nightly/transmute-mut-src-not-asbytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `Src: AsBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 + () + Dst + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertSrcIsAsBytes` --> tests/ui-nightly/transmute-mut-src-not-asbytes.rs:24:36 @@ -31,14 +31,14 @@ error[E0277]: the trait bound `Src: AsBytes` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src` | = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 + () + Dst + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertSrcIsAsBytes` --> tests/ui-nightly/transmute-mut-src-not-asbytes.rs:24:36 diff --git a/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr b/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr index 5a9f0a7..858fc50 100644 --- a/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr +++ b/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `Src: FromBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 + () + Dst + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertSrcIsFromBytes` --> tests/ui-nightly/transmute-mut-src-not-frombytes.rs:24:38 @@ -31,14 +31,14 @@ error[E0277]: the trait bound `Src: FromBytes` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `Src` | = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 + () + Dst + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertSrcIsFromBytes` --> tests/ui-nightly/transmute-mut-src-not-frombytes.rs:24:38 diff --git a/tests/ui-nightly/transmute-mut-src-unsized.stderr b/tests/ui-nightly/transmute-mut-src-unsized.stderr index 99475ad..b859994 100644 --- a/tests/ui-nightly/transmute-mut-src-unsized.stderr +++ b/tests/ui-nightly/transmute-mut-src-unsized.stderr @@ -105,11 +105,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -119,11 +119,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -133,11 +133,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -150,9 +150,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_mut` +note: required by an implicit `Sized` bound in `transmute_mut` --> src/macro_util.rs | | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_mut` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr b/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr index e4791d7..a09f996 100644 --- a/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr +++ b/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 + () + AU16 + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertIsFromBytes` --> tests/ui-nightly/transmute-ref-dst-not-frombytes.rs:18:42 diff --git a/tests/ui-nightly/transmute-ref-dst-unsized.stderr b/tests/ui-nightly/transmute-ref-dst-unsized.stderr index 3d0f6d0..1e97b5b 100644 --- a/tests/ui-nightly/transmute-ref-dst-unsized.stderr +++ b/tests/ui-nightly/transmute-ref-dst-unsized.stderr @@ -33,11 +33,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -47,11 +47,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` +note: required by an implicit `Sized` bound in `transmute` --> $RUST/core/src/intrinsics.rs | | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute` = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -61,9 +61,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_ref` +note: required by an implicit `Sized` bound in `transmute_ref` --> src/macro_util.rs | | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_ref` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-nightly/transmute-ref-src-dst-unsized.stderr b/tests/ui-nightly/transmute-ref-src-dst-unsized.stderr index 02e62bc..cb1e443 100644 --- a/tests/ui-nightly/transmute-ref-src-dst-unsized.stderr +++ b/tests/ui-nightly/transmute-ref-src-dst-unsized.stderr @@ -91,11 +91,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -105,11 +105,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -119,11 +119,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -144,11 +144,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` +note: required by an implicit `Sized` bound in `transmute` --> $RUST/core/src/intrinsics.rs | | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute` = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -161,11 +161,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_ref` +note: required by an implicit `Sized` bound in `transmute_ref` --> src/macro_util.rs | | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_ref` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -175,9 +175,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_ref` +note: required by an implicit `Sized` bound in `transmute_ref` --> src/macro_util.rs | | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_ref` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-nightly/transmute-ref-src-not-asbytes.stderr b/tests/ui-nightly/transmute-ref-src-not-asbytes.stderr index eb28ccf..5ae6b5a 100644 --- a/tests/ui-nightly/transmute-ref-src-not-asbytes.stderr +++ b/tests/ui-nightly/transmute-ref-src-not-asbytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 + () + AU16 + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertIsAsBytes` --> tests/ui-nightly/transmute-ref-src-not-asbytes.rs:18:33 @@ -31,14 +31,14 @@ error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>` | = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 + () + AU16 + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertIsAsBytes` --> tests/ui-nightly/transmute-ref-src-not-asbytes.rs:18:33 diff --git a/tests/ui-nightly/transmute-ref-src-unsized.stderr b/tests/ui-nightly/transmute-ref-src-unsized.stderr index b280429..3ce31ca 100644 --- a/tests/ui-nightly/transmute-ref-src-unsized.stderr +++ b/tests/ui-nightly/transmute-ref-src-unsized.stderr @@ -74,11 +74,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -88,11 +88,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -102,11 +102,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -119,9 +119,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_ref` +note: required by an implicit `Sized` bound in `transmute_ref` --> src/macro_util.rs | | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_ref` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-nightly/transmute-src-not-asbytes.stderr b/tests/ui-nightly/transmute-src-not-asbytes.stderr index b36a820..20f1b18 100644 --- a/tests/ui-nightly/transmute-src-not-asbytes.stderr +++ b/tests/ui-nightly/transmute-src-not-asbytes.stderr @@ -8,14 +8,14 @@ error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 + () + AU16 + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertIsAsBytes` --> tests/ui-nightly/transmute-src-not-asbytes.rs:18:32 @@ -31,14 +31,14 @@ error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>` | = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 + () + AU16 + F32<O> + F64<O> + I128<O> + I16<O> + I32<O> + I64<O> and $N others note: required by a bound in `AssertIsAsBytes` --> tests/ui-nightly/transmute-src-not-asbytes.rs:18:32 diff --git a/tests/ui-stable/invalid-impls/invalid-impls.stderr b/tests/ui-stable/invalid-impls/invalid-impls.stderr index 7737d67..c7ba84b 100644 --- a/tests/ui-stable/invalid-impls/invalid-impls.stderr +++ b/tests/ui-stable/invalid-impls/invalid-impls.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: zerocopy::FromZeroes` is not satisfied --> tests/ui-stable/invalid-impls/invalid-impls.rs:26:37 | 26 | impl_or_verify!(T => FromZeroes for Foo<T>); - | ^^^^^^ the trait `zerocopy::FromZeroes` is not implemented for `T` + | ^^^^^^ the trait `zerocopy::FromZeroes` is not implemented for `T`, which is required by `Foo<T>: zerocopy::FromZeroes` | note: required for `Foo<T>` to implement `zerocopy::FromZeroes` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:10 @@ -29,7 +29,7 @@ error[E0277]: the trait bound `T: zerocopy::FromBytes` is not satisfied --> tests/ui-stable/invalid-impls/invalid-impls.rs:27:36 | 27 | impl_or_verify!(T => FromBytes for Foo<T>); - | ^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `T` + | ^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `T`, which is required by `Foo<T>: zerocopy::FromBytes` | note: required for `Foo<T>` to implement `zerocopy::FromBytes` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:22 @@ -56,7 +56,7 @@ error[E0277]: the trait bound `T: zerocopy::AsBytes` is not satisfied --> tests/ui-stable/invalid-impls/invalid-impls.rs:28:34 | 28 | impl_or_verify!(T => AsBytes for Foo<T>); - | ^^^^^^ the trait `zerocopy::AsBytes` is not implemented for `T` + | ^^^^^^ the trait `zerocopy::AsBytes` is not implemented for `T`, which is required by `Foo<T>: zerocopy::AsBytes` | note: required for `Foo<T>` to implement `zerocopy::AsBytes` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:33 @@ -83,7 +83,7 @@ error[E0277]: the trait bound `T: zerocopy::Unaligned` is not satisfied --> tests/ui-stable/invalid-impls/invalid-impls.rs:29:36 | 29 | impl_or_verify!(T => Unaligned for Foo<T>); - | ^^^^^^ the trait `zerocopy::Unaligned` is not implemented for `T` + | ^^^^^^ the trait `zerocopy::Unaligned` is not implemented for `T`, which is required by `Foo<T>: zerocopy::Unaligned` | note: required for `Foo<T>` to implement `zerocopy::Unaligned` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:42 diff --git a/tests/ui-stable/max-align.stderr b/tests/ui-stable/max-align.stderr index ea472f2..7e83b2f 100644 --- a/tests/ui-stable/max-align.stderr +++ b/tests/ui-stable/max-align.stderr @@ -1,5 +1,5 @@ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> tests/ui-stable/max-align.rs:96:11 + --> tests/ui-stable/max-align.rs:96:17 | 96 | #[repr(C, align(1073741824))] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ diff --git a/tests/ui-stable/transmute-mut-const.stderr b/tests/ui-stable/transmute-mut-const.stderr index a89ea67..076dcf5 100644 --- a/tests/ui-stable/transmute-mut-const.stderr +++ b/tests/ui-stable/transmute-mut-const.stderr @@ -29,13 +29,3 @@ error[E0015]: cannot call non-const fn `transmute_mut::<'_, '_, [u8; 2], [u8; 2] | = 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 - --> tests/ui-stable/transmute-mut-const.rs:20:57 - | -20 | const CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); - | --------------------^^^^^^^^^^^^- - | | | - | | creates a temporary value 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` diff --git a/tests/ui-stable/transmute-mut-dst-unsized.stderr b/tests/ui-stable/transmute-mut-dst-unsized.stderr index 0772785..19b88e7 100644 --- a/tests/ui-stable/transmute-mut-dst-unsized.stderr +++ b/tests/ui-stable/transmute-mut-dst-unsized.stderr @@ -50,11 +50,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -64,43 +64,23 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` +note: required by an implicit `Sized` bound in `transmute` --> $RUST/core/src/intrinsics.rs | | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute` = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> tests/ui-stable/transmute-mut-dst-unsized.rs:17:32 | 17 | const DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8; 1]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf::<T, U>::new` - --> src/macro_util.rs - | - | impl<T, U> MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf::<T, U>::new` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn new(_t: T, _u: U) -> MaxAlignsOf<T, U> { - | --- required by a bound in this associated function - = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-mut-dst-unsized.rs:17:32 - | -17 | const DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8; 1]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_mut` +note: required by an implicit `Sized` bound in `transmute_mut` --> src/macro_util.rs | | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_mut` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-mut-src-dst-unsized.stderr b/tests/ui-stable/transmute-mut-src-dst-unsized.stderr index 8cf7664..0cb8362 100644 --- a/tests/ui-stable/transmute-mut-src-dst-unsized.stderr +++ b/tests/ui-stable/transmute-mut-src-dst-unsized.stderr @@ -109,23 +109,6 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> tests/ui-stable/transmute-mut-src-dst-unsized.rs:17:36 | 17 | const SRC_DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` - --> $RUST/core/src/intrinsics.rs - | - | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` - = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-mut-src-dst-unsized.rs:17:36 - | -17 | const SRC_DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8][..]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` @@ -156,31 +139,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` - = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-mut-src-dst-unsized.rs:17:36 - | -17 | const SRC_DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf::<T, U>::new` - --> src/macro_util.rs - | - | impl<T, U> MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf::<T, U>::new` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn new(_t: T, _u: U) -> MaxAlignsOf<T, U> { - | --- required by a bound in this associated function + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -190,11 +153,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -204,11 +167,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -229,11 +192,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` +note: required by an implicit `Sized` bound in `transmute` --> $RUST/core/src/intrinsics.rs | | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute` = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -246,31 +209,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf::<T, U>::new` - --> src/macro_util.rs - | - | impl<T, U> MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf::<T, U>::new` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn new(_t: T, _u: U) -> MaxAlignsOf<T, U> { - | --- required by a bound in this associated function - = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-mut-src-dst-unsized.rs:17:36 - | -17 | const SRC_DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_mut` +note: required by an implicit `Sized` bound in `transmute_mut` --> src/macro_util.rs | | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_mut` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -280,9 +223,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_mut` +note: required by an implicit `Sized` bound in `transmute_mut` --> src/macro_util.rs | | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_mut` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-mut-src-unsized.stderr b/tests/ui-stable/transmute-mut-src-unsized.stderr index 7f6def9..07069ec 100644 --- a/tests/ui-stable/transmute-mut-src-unsized.stderr +++ b/tests/ui-stable/transmute-mut-src-unsized.stderr @@ -75,23 +75,6 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> tests/ui-stable/transmute-mut-src-unsized.rs:16:35 | 16 | const SRC_UNSIZED: &mut [u8; 1] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` - --> $RUST/core/src/intrinsics.rs - | - | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` - = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-mut-src-unsized.rs:16:35 - | -16 | const SRC_UNSIZED: &mut [u8; 1] = transmute_mut!(&mut [0u8][..]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` @@ -122,31 +105,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` - = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-mut-src-unsized.rs:16:35 - | -16 | const SRC_UNSIZED: &mut [u8; 1] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf::<T, U>::new` - --> src/macro_util.rs - | - | impl<T, U> MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf::<T, U>::new` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn new(_t: T, _u: U) -> MaxAlignsOf<T, U> { - | --- required by a bound in this associated function + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -156,11 +119,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -170,11 +133,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -187,9 +150,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_mut` +note: required by an implicit `Sized` bound in `transmute_mut` --> src/macro_util.rs | | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_mut` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_mut` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-dst-unsized.stderr b/tests/ui-stable/transmute-ref-dst-unsized.stderr index 8a0c761..71cae85 100644 --- a/tests/ui-stable/transmute-ref-dst-unsized.stderr +++ b/tests/ui-stable/transmute-ref-dst-unsized.stderr @@ -33,11 +33,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -47,43 +47,23 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` +note: required by an implicit `Sized` bound in `transmute` --> $RUST/core/src/intrinsics.rs | | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute` = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> tests/ui-stable/transmute-ref-dst-unsized.rs:17:28 | 17 | const DST_UNSIZED: &[u8] = transmute_ref!(&[0u8; 1]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf::<T, U>::new` - --> src/macro_util.rs - | - | impl<T, U> MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf::<T, U>::new` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn new(_t: T, _u: U) -> MaxAlignsOf<T, U> { - | --- required by a bound in this associated function - = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-ref-dst-unsized.rs:17:28 - | -17 | const DST_UNSIZED: &[u8] = transmute_ref!(&[0u8; 1]); | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_ref` +note: required by an implicit `Sized` bound in `transmute_ref` --> src/macro_util.rs | | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_ref` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-src-dst-unsized.stderr b/tests/ui-stable/transmute-ref-src-dst-unsized.stderr index ca62fcf..7017c2f 100644 --- a/tests/ui-stable/transmute-ref-src-dst-unsized.stderr +++ b/tests/ui-stable/transmute-ref-src-dst-unsized.stderr @@ -61,23 +61,6 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> tests/ui-stable/transmute-ref-src-dst-unsized.rs:17:32 | 17 | const SRC_DST_UNSIZED: &[u8] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` - --> $RUST/core/src/intrinsics.rs - | - | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` - = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-ref-src-dst-unsized.rs:17:32 - | -17 | const SRC_DST_UNSIZED: &[u8] = transmute_ref!(&[0u8][..]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` @@ -108,31 +91,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` - = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-ref-src-dst-unsized.rs:17:32 - | -17 | const SRC_DST_UNSIZED: &[u8] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf::<T, U>::new` - --> src/macro_util.rs - | - | impl<T, U> MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf::<T, U>::new` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn new(_t: T, _u: U) -> MaxAlignsOf<T, U> { - | --- required by a bound in this associated function + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -142,11 +105,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -156,11 +119,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -181,11 +144,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` +note: required by an implicit `Sized` bound in `transmute` --> $RUST/core/src/intrinsics.rs | | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute` = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -198,31 +161,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf::<T, U>::new` - --> src/macro_util.rs - | - | impl<T, U> MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf::<T, U>::new` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn new(_t: T, _u: U) -> MaxAlignsOf<T, U> { - | --- required by a bound in this associated function - = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-ref-src-dst-unsized.rs:17:32 - | -17 | const SRC_DST_UNSIZED: &[u8] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_ref` +note: required by an implicit `Sized` bound in `transmute_ref` --> src/macro_util.rs | | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_ref` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -232,9 +175,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_ref` +note: required by an implicit `Sized` bound in `transmute_ref` --> src/macro_util.rs | | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_ref` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-src-unsized.stderr b/tests/ui-stable/transmute-ref-src-unsized.stderr index b194d67..73984d0 100644 --- a/tests/ui-stable/transmute-ref-src-unsized.stderr +++ b/tests/ui-stable/transmute-ref-src-unsized.stderr @@ -44,23 +44,6 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> tests/ui-stable/transmute-ref-src-unsized.rs:16:31 | 16 | const SRC_UNSIZED: &[u8; 1] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute` - --> $RUST/core/src/intrinsics.rs - | - | pub fn transmute<Src, Dst>(src: Src) -> Dst; - | ^^^ required by this bound in `transmute` - = note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-ref-src-unsized.rs:16:31 - | -16 | const SRC_UNSIZED: &[u8; 1] = transmute_ref!(&[0u8][..]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` @@ -91,31 +74,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` - = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> tests/ui-stable/transmute-ref-src-unsized.rs:16:31 - | -16 | const SRC_UNSIZED: &[u8; 1] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf::<T, U>::new` - --> src/macro_util.rs - | - | impl<T, U> MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf::<T, U>::new` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn new(_t: T, _u: U) -> MaxAlignsOf<T, U> { - | --- required by a bound in this associated function + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -125,11 +88,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `MaxAlignsOf` +note: required by an implicit `Sized` bound in `MaxAlignsOf` --> src/macro_util.rs | | pub union MaxAlignsOf<T, U> { - | ^ required by this bound in `MaxAlignsOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `MaxAlignsOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -139,11 +102,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AlignOf` +note: required by an implicit `Sized` bound in `AlignOf` --> src/macro_util.rs | | pub struct AlignOf<T> { - | ^ required by this bound in `AlignOf` + | ^ required by the implicit `Sized` requirement on this type parameter in `AlignOf` = note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -156,9 +119,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `transmute_ref` +note: required by an implicit `Sized` bound in `transmute_ref` --> src/macro_util.rs | | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( - | ^^^ required by this bound in `transmute_ref` + | ^^^ required by the implicit `Sized` requirement on this type parameter in `transmute_ref` = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) |