From be8fdd70ec770fde7d1ce71656ae1f86641e1ecc Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Thu, 8 Feb 2024 13:20:19 -0800 Subject: [PATCH] Lower MSRV to 1.56 Makes progress on #554 --- Cargo.toml | 5 +- src/lib.rs | 48 +++---- src/macros.rs | 40 ++++++ src/util.rs | 8 ++ src/wrappers.rs | 2 +- .../include_value_not_from_bytes.stderr | 21 +-- .../ui-stable/include_value_wrong_size.stderr | 2 +- .../invalid-impls/invalid-impls.stderr | 95 +++++++++----- .../transmute-dst-not-frombytes.stderr | 19 +-- .../transmute-mut-alignment-increase.stderr | 37 +++++- tests/ui-stable/transmute-mut-const.stderr | 18 ++- .../transmute-mut-dst-generic.stderr | 4 +- .../transmute-mut-dst-not-frombytes.stderr | 19 +-- .../transmute-mut-dst-not-intobytes.stderr | 21 +-- .../transmute-mut-dst-not-nocell.stderr | 19 +-- .../transmute-mut-dst-unsized.stderr | 43 ++++-- .../transmute-mut-illegal-lifetime.stderr | 3 - .../transmute-mut-size-decrease.stderr | 37 +++++- .../transmute-mut-size-increase.stderr | 37 +++++- .../transmute-mut-src-dst-generic.stderr | 4 +- ...ransmute-mut-src-dst-not-references.stderr | 5 +- .../transmute-mut-src-dst-unsized.stderr | 97 +++++++++----- .../transmute-mut-src-generic.stderr | 4 +- .../transmute-mut-src-not-a-reference.stderr | 5 +- .../transmute-mut-src-not-frombytes.stderr | 29 +--- .../transmute-mut-src-not-intobytes.stderr | 35 +---- .../transmute-mut-src-not-nocell.stderr | 29 +--- .../transmute-mut-src-unsized.stderr | 92 +++++++++---- tests/ui-stable/transmute-ptr-to-usize.stderr | 11 +- .../transmute-ref-alignment-increase.stderr | 2 +- .../transmute-ref-dst-generic.stderr | 4 +- .../transmute-ref-dst-not-a-reference.stderr | 10 +- .../transmute-ref-dst-not-frombytes.stderr | 19 +-- .../transmute-ref-dst-not-nocell.stderr | 19 +-- .../transmute-ref-dst-unsized.stderr | 43 ++++-- .../transmute-ref-illegal-lifetime.stderr | 3 - .../transmute-ref-size-decrease.stderr | 2 +- .../transmute-ref-size-increase.stderr | 2 +- .../transmute-ref-src-dst-generic.stderr | 4 +- ...ransmute-ref-src-dst-not-references.stderr | 17 +-- .../transmute-ref-src-dst-unsized.stderr | 97 +++++++++----- .../transmute-ref-src-generic.stderr | 4 +- .../transmute-ref-src-not-a-reference.stderr | 7 +- .../transmute-ref-src-not-intobytes.stderr | 35 +---- .../transmute-ref-src-not-nocell.stderr | 29 +--- .../transmute-ref-src-unsized.stderr | 92 +++++++++---- .../transmute-src-not-intobytes.stderr | 29 +--- zerocopy-derive/Cargo.toml | 2 +- .../tests/ui-stable/derive_transparent.stderr | 124 ++++++------------ zerocopy-derive/tests/ui-stable/enum.stderr | 24 +--- .../tests/ui-stable/late_compile_pass.stderr | 86 +----------- .../tests/ui-stable/mid_compile_pass.stderr | 32 ++--- zerocopy-derive/tests/ui-stable/struct.stderr | 102 +------------- zerocopy-derive/tests/ui-stable/union.stderr | 21 +-- 54 files changed, 737 insertions(+), 861 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index aa2392fdee..ec8405c596 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ authors = ["Joshua Liebow-Feeser "] description = "Utilities for zero-copy parsing and serialization" license = "BSD-2-Clause OR Apache-2.0 OR MIT" repository = "https://github.com/google/zerocopy" -rust-version = "1.57.0" +rust-version = "1.56.0" exclude = [".*"] @@ -35,6 +35,9 @@ exclude = [".*"] # versions, these types require the "simd-nightly" feature. zerocopy-aarch64-simd = "1.59.0" +# Permit panicking in `const fn`s. +zerocopy-panic-in-const = "1.57.0" + [package.metadata.ci] # The versions of the stable and nightly compiler toolchains to use in CI. pinned-stable = "1.75.0" diff --git a/src/lib.rs b/src/lib.rs index 43246b6548..d8fc52b2cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -363,13 +363,15 @@ pub struct DstLayout { size_info: SizeInfo, } -#[cfg_attr(any(kani, test), derive(Copy, Clone, Debug, PartialEq, Eq))] +#[cfg_attr(any(kani, test), derive(Debug, PartialEq, Eq))] +#[derive(Copy, Clone)] enum SizeInfo { Sized { _size: usize }, SliceDst(TrailingSliceLayout), } -#[cfg_attr(any(kani, test), derive(Copy, Clone, Debug, PartialEq, Eq))] +#[cfg_attr(any(kani, test), derive(Debug, PartialEq, Eq))] +#[derive(Copy, Clone)] struct TrailingSliceLayout { // The offset of the first byte of the trailing slice field. Note that this // is NOT the same as the minimum size of the type. For example, consider @@ -419,7 +421,7 @@ impl DstLayout { /// The minimum possible alignment of a type. const MIN_ALIGN: NonZeroUsize = match NonZeroUsize::new(1) { Some(min_align) => min_align, - None => unreachable!(), + None => loop {}, }; /// The maximum theoretic possible alignment of a type. @@ -430,7 +432,7 @@ impl DstLayout { const THEORETICAL_MAX_ALIGN: NonZeroUsize = match NonZeroUsize::new(1 << (POINTER_WIDTH_BITS - 1)) { Some(max_align) => max_align, - None => unreachable!(), + None => loop {}, }; /// The current, documented max alignment of a type \[1\]. @@ -439,10 +441,10 @@ impl DstLayout { /// /// The alignment value must be a power of two from 1 up to /// 229. - #[cfg(not(kani))] + #[cfg(all(not(kani), any(test, zerocopy_panic_in_const)))] const CURRENT_MAX_ALIGN: NonZeroUsize = match NonZeroUsize::new(1 << 28) { Some(max_align) => max_align, - None => unreachable!(), + None => loop {}, }; /// Constructs a `DstLayout` for a zero-sized type with `repr_align` @@ -464,7 +466,7 @@ impl DstLayout { None => Self::MIN_ALIGN, }; - assert!(align.get().is_power_of_two()); + const_assert!(align.get().is_power_of_two()); DstLayout { align, size_info: SizeInfo::Sized { _size: 0 } } } @@ -483,7 +485,7 @@ impl DstLayout { DstLayout { align: match NonZeroUsize::new(mem::align_of::()) { Some(align) => align, - None => unreachable!(), + None => loop {}, }, size_info: SizeInfo::Sized { _size: mem::size_of::() }, } @@ -506,7 +508,7 @@ impl DstLayout { DstLayout { align: match NonZeroUsize::new(mem::align_of::()) { Some(align) => align, - None => unreachable!(), + None => loop {}, }, size_info: SizeInfo::SliceDst(TrailingSliceLayout { _offset: 0, @@ -552,12 +554,12 @@ impl DstLayout { None => Self::THEORETICAL_MAX_ALIGN, }; - assert!(max_align.get().is_power_of_two()); + const_assert!(max_align.get().is_power_of_two()); // We use Kani to prove that this method is robust to future increases // in Rust's maximum allowed alignment. However, if such a change ever // actually occurs, we'd like to be notified via assertion failures. - #[cfg(not(kani))] + #[cfg(all(not(kani), zerocopy_panic_in_const))] { debug_assert!(self.align.get() <= DstLayout::CURRENT_MAX_ALIGN.get()); debug_assert!(field.align.get() <= DstLayout::CURRENT_MAX_ALIGN.get()); @@ -583,7 +585,7 @@ impl DstLayout { let size_info = match self.size_info { // If the layout is already a DST, we panic; DSTs cannot be extended // with additional fields. - SizeInfo::SliceDst(..) => panic!("Cannot extend a DST with additional fields."), + SizeInfo::SliceDst(..) => const_panic!("Cannot extend a DST with additional fields."), SizeInfo::Sized { _size: preceding_size } => { // Compute the minimum amount of inter-field padding needed to @@ -604,7 +606,7 @@ impl DstLayout { // exceeding `isize::MAX`). let offset = match preceding_size.checked_add(padding) { Some(offset) => offset, - None => panic!("Adding padding to `self`'s size overflows `usize`."), + None => const_panic!("Adding padding to `self`'s size overflows `usize`."), }; match field.size_info { @@ -622,7 +624,7 @@ impl DstLayout { // `usize::MAX`). let size = match offset.checked_add(field_size) { Some(size) => size, - None => panic!("`field` cannot be appended without the total size overflowing `usize`"), + None => const_panic!("`field` cannot be appended without the total size overflowing `usize`"), }; SizeInfo::Sized { _size: size } } @@ -644,7 +646,7 @@ impl DstLayout { // `usize::MAX`). let offset = match offset.checked_add(trailing_offset) { Some(offset) => offset, - None => panic!("`field` cannot be appended without the total size overflowing `usize`"), + None => const_panic!("`field` cannot be appended without the total size overflowing `usize`"), }; SizeInfo::SliceDst(TrailingSliceLayout { _offset: offset, _elem_size }) } @@ -691,7 +693,7 @@ impl DstLayout { let padding = padding_needed_for(unpadded_size, self.align); let size = match unpadded_size.checked_add(padding) { Some(size) => size, - None => panic!("Adding padding caused size to overflow `usize`."), + None => const_panic!("Adding padding caused size to overflow `usize`."), }; SizeInfo::Sized { _size: size } } @@ -776,9 +778,11 @@ impl DstLayout { bytes_len: usize, cast_type: _CastType, ) -> Option<(usize, usize)> { - // `debug_assert!`, but with `#[allow(clippy::arithmetic_side_effects)]`. + // `debug_assert!`, but with `#[allow(clippy::arithmetic_side_effects)]` + // and `#[cfg(zerocopy_panic_in_const)]`. macro_rules! __debug_assert { ($e:expr $(, $msg:expr)?) => { + #[cfg(zerocopy_panic_in_const)] debug_assert!({ #[allow(clippy::arithmetic_side_effects)] let e = $e; @@ -798,7 +802,7 @@ impl DstLayout { // https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html#let-else-statements let size_info = match self.size_info.try_to_nonzero_elem_size() { Some(size_info) => size_info, - None => panic!("attempted to cast to slice type with zero-sized element"), + None => const_panic!("attempted to cast to slice type with zero-sized element"), }; // Precondition @@ -3953,7 +3957,7 @@ macro_rules! transmute_ref { // `t` is inferred to have type `T` because it's assigned to `e` (of // type `&T`) as `&t`. - let mut t = unreachable!(); + let mut t = loop {}; e = &t; // `u` is inferred to have type `U` because it's used as `&u` as the @@ -5326,7 +5330,7 @@ impl<'a> sealed::ByteSliceSealed for cell::Ref<'a, [u8]> {} #[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") + const_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 @@ -5346,7 +5350,7 @@ impl<'a> sealed::ByteSliceSealed for RefMut<'a, [u8]> {} #[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") + const_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 @@ -5812,7 +5816,7 @@ mod tests { // attempt to expose UB. #[test] #[cfg_attr(miri, ignore)] - fn testvalidate_cast_and_convert_metadata() { + fn test_validate_cast_and_convert_metadata() { impl From for SizeInfo { fn from(_size: usize) -> SizeInfo { SizeInfo::Sized { _size } diff --git a/src/macros.rs b/src/macros.rs index e14920534a..9fc59b9643 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -416,3 +416,43 @@ macro_rules! assert_unaligned { $(assert_unaligned!($ty);)* }; } + +/// Either panic (if the current Rust toolchain supports panicking in `const +/// fn`) or evaluate a constant that will cause an array indexing error whose +/// error message will include the format string. +/// +/// The type that this expression evaluates to must be `Copy`, or else the +/// non-panicking desugaring will fail to compile. +macro_rules! const_panic { + ($fmt:literal) => {{ + #[cfg(zerocopy_panic_in_const)] + panic!($fmt); + #[cfg(not(zerocopy_panic_in_const))] + const_panic!(@non_panic $fmt) + }}; + (@non_panic $fmt:expr) => {{ + // This will type check to whatever type is expected based on the call + // site. + let panic: [_; 0] = []; + // This will always fail (since we're indexing into an array of size 0. + #[allow(unconditional_panic)] + panic[0] + }} +} + +/// Either assert (if the current Rust toolchain supports panicking in `const +/// fn`) or evaluate the expression and, if it evaluates to `false`, call +/// `const_panic!`. +macro_rules! const_assert { + ($e:expr) => {{ + #[cfg(zerocopy_panic_in_const)] + assert!($e); + #[cfg(not(zerocopy_panic_in_const))] + { + let e = $e; + if !e { + let _: () = const_panic!(@non_panic concat!("assertion failed: ", stringify!($e))); + } + } + }} +} diff --git a/src/util.rs b/src/util.rs index 2ba2f94b48..0d3474b74a 100644 --- a/src/util.rs +++ b/src/util.rs @@ -129,6 +129,7 @@ pub(crate) const fn round_down_to_next_multiple_of_alignment( align: NonZeroUsize, ) -> usize { let align = align.get(); + #[cfg(zerocopy_panic_in_const)] debug_assert!(align.is_power_of_two()); // Subtraction can't underflow because `align.get() >= 1`. @@ -275,6 +276,13 @@ mod tests { } } } + + #[rustversion::since(1.57.0)] + #[test] + #[should_panic] + fn test_round_down_to_next_multiple_of_alignment_panic_in_const() { + round_down_to_next_multiple_of_alignment(0, NonZeroUsize::new(3).unwrap()); + } } #[cfg(kani)] diff --git a/src/wrappers.rs b/src/wrappers.rs index be5e0fedc1..a84ee3a0c8 100644 --- a/src/wrappers.rs +++ b/src/wrappers.rs @@ -477,7 +477,7 @@ mod tests { let au64 = unsafe { x.t.deref_unchecked() }; match au64 { AU64(123) => {} - _ => unreachable!(), + _ => loop {}, } }; } diff --git a/tests/ui-stable/include_value_not_from_bytes.stderr b/tests/ui-stable/include_value_not_from_bytes.stderr index 40f9439185..d91dc7a224 100644 --- a/tests/ui-stable/include_value_not_from_bytes.stderr +++ b/tests/ui-stable/include_value_not_from_bytes.stderr @@ -2,24 +2,11 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied --> tests/ui-stable/include_value_not_from_bytes.rs:13:42 | 13 | const NOT_FROM_BYTES: NotZerocopy = include_value!("../../testdata/include_value/data"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `FromBytes` is not implemented for `NotZerocopy` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 - and $N others -note: required by a bound in `AssertIsFromBytes` +note: required by `AssertIsFromBytes` --> tests/ui-stable/include_value_not_from_bytes.rs:13:42 | 13 | const NOT_FROM_BYTES: NotZerocopy = include_value!("../../testdata/include_value/data"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertIsFromBytes` - = note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `include_value` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `$crate::transmute` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/include_value_wrong_size.stderr b/tests/ui-stable/include_value_wrong_size.stderr index 956d74c505..1554faff5b 100644 --- a/tests/ui-stable/include_value_wrong_size.stderr +++ b/tests/ui-stable/include_value_wrong_size.stderr @@ -6,4 +6,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `[u8; 4]` (32 bits) = note: target type: `u64` (64 bits) - = note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `include_value` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::transmute` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/invalid-impls/invalid-impls.stderr b/tests/ui-stable/invalid-impls/invalid-impls.stderr index 9cfe7ee8bc..1467db2426 100644 --- a/tests/ui-stable/invalid-impls/invalid-impls.stderr +++ b/tests/ui-stable/invalid-impls/invalid-impls.stderr @@ -1,133 +1,158 @@ error[E0277]: the trait bound `T: zerocopy::TryFromBytes` is not satisfied - --> tests/ui-stable/invalid-impls/invalid-impls.rs:26:39 + --> tests/ui-stable/invalid-impls/../../../src/macros.rs + | + | impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {} + | ^^^^^^^^ the trait `zerocopy::TryFromBytes` is not implemented for `T` + | + ::: tests/ui-stable/invalid-impls/invalid-impls.rs:26:1 | 26 | impl_or_verify!(T => TryFromBytes for Foo); - | ^^^^^^ the trait `zerocopy::TryFromBytes` is not implemented for `T` + | ---------------------------------------------- in this macro invocation | -note: required for `Foo` to implement `zerocopy::TryFromBytes` +note: required because of the requirements on the impl of `zerocopy::TryFromBytes` for `Foo` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:10 | 22 | #[derive(TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned)] - | ^^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^^^^ note: required by a bound in `_::Subtrait` --> tests/ui-stable/invalid-impls/../../../src/macros.rs | | trait Subtrait: $trait {} - | ^^^^^^ required by this bound in `Subtrait` + | ^^^^^^ required by this bound in `_::Subtrait` | ::: tests/ui-stable/invalid-impls/invalid-impls.rs:26:1 | 26 | impl_or_verify!(T => TryFromBytes for Foo); - | --------------------------------------------- in this macro invocation - = note: this error originates in the derive macro `TryFromBytes` which comes from the expansion of the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) + | ---------------------------------------------- in this macro invocation + = note: this error originates in the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | 26 | impl_or_verify!(T: zerocopy::TryFromBytes => TryFromBytes for Foo); | ++++++++++++++++++++++++ error[E0277]: the trait bound `T: FromZeroes` is not satisfied - --> tests/ui-stable/invalid-impls/invalid-impls.rs:27:36 + --> tests/ui-stable/invalid-impls/../../../src/macros.rs + | + | impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {} + | ^^^^^^^^ the trait `FromZeroes` is not implemented for `T` + | + ::: tests/ui-stable/invalid-impls/invalid-impls.rs:27:1 | 27 | impl_or_verify!(T => FromZeros for Foo); - | ^^^^^^ the trait `FromZeroes` is not implemented for `T` + | ------------------------------------------- in this macro invocation | -note: required for `Foo` to implement `FromZeroes` +note: required because of the requirements on the impl of `FromZeroes` for `Foo` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:24 | 22 | #[derive(TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned)] - | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^ note: required by a bound in `_::Subtrait` --> tests/ui-stable/invalid-impls/../../../src/macros.rs | | trait Subtrait: $trait {} - | ^^^^^^ required by this bound in `Subtrait` + | ^^^^^^ required by this bound in `_::Subtrait` | ::: tests/ui-stable/invalid-impls/invalid-impls.rs:27:1 | 27 | impl_or_verify!(T => FromZeros for Foo); - | ------------------------------------------ in this macro invocation - = note: this error originates in the derive macro `FromZeros` which comes from the expansion of the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) + | ------------------------------------------- in this macro invocation + = note: this error originates in the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | 27 | impl_or_verify!(T: zerocopy::FromZeros => FromZeros for Foo); | +++++++++++++++++++++ error[E0277]: the trait bound `T: zerocopy::FromBytes` is not satisfied - --> tests/ui-stable/invalid-impls/invalid-impls.rs:28:36 + --> tests/ui-stable/invalid-impls/../../../src/macros.rs + | + | impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {} + | ^^^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `T` + | + ::: tests/ui-stable/invalid-impls/invalid-impls.rs:28:1 | 28 | impl_or_verify!(T => FromBytes for Foo); - | ^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `T` + | ------------------------------------------- in this macro invocation | -note: required for `Foo` to implement `zerocopy::FromBytes` +note: required because of the requirements on the impl of `zerocopy::FromBytes` for `Foo` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:35 | 22 | #[derive(TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned)] - | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^ note: required by a bound in `_::Subtrait` --> tests/ui-stable/invalid-impls/../../../src/macros.rs | | trait Subtrait: $trait {} - | ^^^^^^ required by this bound in `Subtrait` + | ^^^^^^ required by this bound in `_::Subtrait` | ::: tests/ui-stable/invalid-impls/invalid-impls.rs:28:1 | 28 | impl_or_verify!(T => FromBytes for Foo); - | ------------------------------------------ in this macro invocation - = note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) + | ------------------------------------------- in this macro invocation + = note: this error originates in the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | 28 | impl_or_verify!(T: zerocopy::FromBytes => FromBytes for Foo); | +++++++++++++++++++++ error[E0277]: the trait bound `T: AsBytes` is not satisfied - --> tests/ui-stable/invalid-impls/invalid-impls.rs:29:36 + --> tests/ui-stable/invalid-impls/../../../src/macros.rs + | + | impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {} + | ^^^^^^^^ the trait `AsBytes` is not implemented for `T` + | + ::: tests/ui-stable/invalid-impls/invalid-impls.rs:29:1 | 29 | impl_or_verify!(T => IntoBytes for Foo); - | ^^^^^^ the trait `AsBytes` is not implemented for `T` + | ------------------------------------------- in this macro invocation | -note: required for `Foo` to implement `AsBytes` +note: required because of the requirements on the impl of `AsBytes` for `Foo` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:46 | 22 | #[derive(TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned)] - | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^ note: required by a bound in `_::Subtrait` --> tests/ui-stable/invalid-impls/../../../src/macros.rs | | trait Subtrait: $trait {} - | ^^^^^^ required by this bound in `Subtrait` + | ^^^^^^ required by this bound in `_::Subtrait` | ::: tests/ui-stable/invalid-impls/invalid-impls.rs:29:1 | 29 | impl_or_verify!(T => IntoBytes for Foo); - | ------------------------------------------ in this macro invocation - = note: this error originates in the derive macro `IntoBytes` which comes from the expansion of the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) + | ------------------------------------------- in this macro invocation + = note: this error originates in the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | 29 | impl_or_verify!(T: zerocopy::IntoBytes => IntoBytes for Foo); | +++++++++++++++++++++ error[E0277]: the trait bound `T: zerocopy::Unaligned` is not satisfied - --> tests/ui-stable/invalid-impls/invalid-impls.rs:30:36 + --> tests/ui-stable/invalid-impls/../../../src/macros.rs + | + | impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {} + | ^^^^^^^^ the trait `zerocopy::Unaligned` is not implemented for `T` + | + ::: tests/ui-stable/invalid-impls/invalid-impls.rs:30:1 | 30 | impl_or_verify!(T => Unaligned for Foo); - | ^^^^^^ the trait `zerocopy::Unaligned` is not implemented for `T` + | ------------------------------------------- in this macro invocation | -note: required for `Foo` to implement `zerocopy::Unaligned` +note: required because of the requirements on the impl of `zerocopy::Unaligned` for `Foo` --> tests/ui-stable/invalid-impls/invalid-impls.rs:22:57 | 22 | #[derive(TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned)] - | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^ note: required by a bound in `_::Subtrait` --> tests/ui-stable/invalid-impls/../../../src/macros.rs | | trait Subtrait: $trait {} - | ^^^^^^ required by this bound in `Subtrait` + | ^^^^^^ required by this bound in `_::Subtrait` | ::: tests/ui-stable/invalid-impls/invalid-impls.rs:30:1 | 30 | impl_or_verify!(T => Unaligned for Foo); - | ------------------------------------------ in this macro invocation - = note: this error originates in the derive macro `Unaligned` which comes from the expansion of the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) + | ------------------------------------------- in this macro invocation + = note: this error originates in the macro `impl_or_verify` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | 30 | impl_or_verify!(T: zerocopy::Unaligned => Unaligned for Foo); diff --git a/tests/ui-stable/transmute-dst-not-frombytes.stderr b/tests/ui-stable/transmute-dst-not-frombytes.stderr index b008bcdb10..ca876dd32c 100644 --- a/tests/ui-stable/transmute-dst-not-frombytes.stderr +++ b/tests/ui-stable/transmute-dst-not-frombytes.stderr @@ -2,24 +2,11 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied --> tests/ui-stable/transmute-dst-not-frombytes.rs:18:41 | 18 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); - | ^^^^^^^^^^^^^^^^^^^ - | | - | the trait `FromBytes` is not implemented for `NotZerocopy` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 - and $N others -note: required by a bound in `AssertIsFromBytes` +note: required by `AssertIsFromBytes` --> tests/ui-stable/transmute-dst-not-frombytes.rs:18:41 | 18 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertIsFromBytes` + | ^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-mut-alignment-increase.stderr b/tests/ui-stable/transmute-mut-alignment-increase.stderr index 252fec9ef8..03bf5c26f1 100644 --- a/tests/ui-stable/transmute-mut-alignment-increase.stderr +++ b/tests/ui-stable/transmute-mut-alignment-increase.stderr @@ -6,4 +6,39 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `AlignOf<[u8; 2]>` (8 bits) = note: target type: `MaxAlignsOf<[u8; 2], AU16>` (16 bits) - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0658]: mutable references are not allowed in constants + --> tests/ui-stable/transmute-mut-alignment-increase.rs:19:54 + | +19 | const INCREASE_ALIGNMENT: &mut AU16 = transmute_mut!(&mut [0u8; 2]); + | ^^^^^^^^^^^^^ + | + = note: see issue #57349 for more information + +error[E0658]: panicking in constants is unstable + --> tests/ui-stable/transmute-mut-alignment-increase.rs:19:39 + | +19 | const INCREASE_ALIGNMENT: &mut AU16 = transmute_mut!(&mut [0u8; 2]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #51999 for more information + = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants + --> tests/ui-stable/transmute-mut-alignment-increase.rs:19:39 + | +19 | const INCREASE_ALIGNMENT: &mut AU16 = transmute_mut!(&mut [0u8; 2]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = 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-alignment-increase.rs:19:59 + | +19 | const INCREASE_ALIGNMENT: &mut AU16 = transmute_mut!(&mut [0u8; 2]); + | --------------------^^^^^^^^- + | | | + | | creates a temporary which is freed while still in use + | temporary value is freed at the end of this statement + | using this value as a constant requires that borrow lasts for `'static` diff --git a/tests/ui-stable/transmute-mut-const.stderr b/tests/ui-stable/transmute-mut-const.stderr index a89ea67558..2c2b74f099 100644 --- a/tests/ui-stable/transmute-mut-const.stderr +++ b/tests/ui-stable/transmute-mut-const.stderr @@ -4,14 +4,14 @@ warning: taking a mutable reference to a `const` item 20 | const CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); | ^^^^^^^^^^^^^^^^^ | + = note: `#[warn(const_item_mutation)]` on by default = note: each usage of a `const` item creates a new temporary = note: the mutable reference will refer to this temporary, not the original `const` item note: `const` item defined here --> tests/ui-stable/transmute-mut-const.rs:17:1 | 17 | const ARRAY_OF_U8S: [u8; 2] = [0u8; 2]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: `#[warn(const_item_mutation)]` on by default + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0658]: mutable references are not allowed in constants --> tests/ui-stable/transmute-mut-const.rs:20:52 @@ -21,13 +21,21 @@ error[E0658]: mutable references are not allowed in constants | = note: see issue #57349 for more information -error[E0015]: cannot call non-const fn `transmute_mut::<'_, '_, [u8; 2], [u8; 2]>` in constants +error[E0658]: panicking in constants is unstable + --> tests/ui-stable/transmute-mut-const.rs:20:37 + | +20 | const CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #51999 for more information + = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants --> tests/ui-stable/transmute-mut-const.rs:20:37 | 20 | const CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0716]: temporary value dropped while borrowed @@ -36,6 +44,6 @@ error[E0716]: temporary value dropped while borrowed 20 | const CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); | --------------------^^^^^^^^^^^^- | | | - | | creates a temporary value which is freed while still in use + | | creates a temporary which is freed while still in use | temporary value is freed at the end of this statement | using this value as a constant requires that borrow lasts for `'static` diff --git a/tests/ui-stable/transmute-mut-dst-generic.stderr b/tests/ui-stable/transmute-mut-dst-generic.stderr index 0000eb0bab..784ddbf1cf 100644 --- a/tests/ui-stable/transmute-mut-dst-generic.stderr +++ b/tests/ui-stable/transmute-mut-dst-generic.stderr @@ -6,7 +6,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `u8` (8 bits) = note: target type: `T` (this type does not have a fixed size) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> tests/ui-stable/transmute-mut-dst-generic.rs:17:5 @@ -16,4 +16,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `AlignOf` (8 bits) = note: target type: `MaxAlignsOf` (size can vary because of T) - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr b/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr index 39bb4fd96d..28ea99d105 100644 --- a/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr +++ b/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr @@ -2,24 +2,11 @@ error[E0277]: the trait bound `Dst: FromBytes` is not satisfied --> tests/ui-stable/transmute-mut-dst-not-frombytes.rs:24:38 | 24 | const DST_NOT_FROM_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `FromBytes` is not implemented for `Dst` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `Dst` | - = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 - and $N others -note: required by a bound in `AssertDstIsFromBytes` +note: required by `AssertDstIsFromBytes` --> tests/ui-stable/transmute-mut-dst-not-frombytes.rs:24:38 | 24 | const DST_NOT_FROM_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsFromBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^ = 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-dst-not-intobytes.stderr b/tests/ui-stable/transmute-mut-dst-not-intobytes.stderr index d7e6b9ae3f..76a120af30 100644 --- a/tests/ui-stable/transmute-mut-dst-not-intobytes.stderr +++ b/tests/ui-stable/transmute-mut-dst-not-intobytes.stderr @@ -1,25 +1,12 @@ -error[E0277]: the trait bound `Dst: AsBytes` is not satisfied +error[E0277]: the trait bound `Dst: IntoBytes` is not satisfied --> tests/ui-stable/transmute-mut-dst-not-intobytes.rs:24:36 | 24 | const DST_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `AsBytes` is not implemented for `Dst` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Dst` | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertDstIsIntoBytes` +note: required by `AssertDstIsIntoBytes` --> tests/ui-stable/transmute-mut-dst-not-intobytes.rs:24:36 | 24 | const DST_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsIntoBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^ = 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-dst-not-nocell.stderr b/tests/ui-stable/transmute-mut-dst-not-nocell.stderr index 27a12a0607..f7246dd8e8 100644 --- a/tests/ui-stable/transmute-mut-dst-not-nocell.stderr +++ b/tests/ui-stable/transmute-mut-dst-not-nocell.stderr @@ -2,24 +2,11 @@ error[E0277]: the trait bound `Dst: NoCell` is not satisfied --> tests/ui-stable/transmute-mut-dst-not-nocell.rs:24:35 | 24 | const DST_NOT_NO_CELL: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `NoCell` is not implemented for `Dst` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NoCell` is not implemented for `Dst` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertDstIsNoCell` +note: required by `AssertDstIsNoCell` --> tests/ui-stable/transmute-mut-dst-not-nocell.rs:24:35 | 24 | const DST_NOT_NO_CELL: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsNoCell` + | ^^^^^^^^^^^^^^^^^^^^^^^^ = 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-dst-unsized.stderr b/tests/ui-stable/transmute-mut-dst-unsized.stderr index 35b50bc6aa..1ffc26ded7 100644 --- a/tests/ui-stable/transmute-mut-dst-unsized.stderr +++ b/tests/ui-stable/transmute-mut-dst-unsized.stderr @@ -2,17 +2,14 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> 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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AssertDstIsSized` +note: required by `AssertDstIsSized` --> tests/ui-stable/transmute-mut-dst-unsized.rs:17:32 | 17 | const DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8; 1]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsSized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 @@ -38,7 +35,7 @@ note: required by a bound in `MaxAlignsOf` | | pub union MaxAlignsOf { | ^ required by this bound 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -48,11 +45,35 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `transmute` - --> $RUST/core/src/intrinsics.rs + = note: this error originates in the macro `$crate::assert_size_eq` (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 | - | pub fn transmute(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) +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 `MaxAlignsOf::::new` + --> src/macro_util.rs + | + | pub fn new(_t: T, _u: U) -> MaxAlignsOf { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 `MaxAlignsOf` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 diff --git a/tests/ui-stable/transmute-mut-illegal-lifetime.stderr b/tests/ui-stable/transmute-mut-illegal-lifetime.stderr index 7f128138f3..fc29e843a3 100644 --- a/tests/ui-stable/transmute-mut-illegal-lifetime.stderr +++ b/tests/ui-stable/transmute-mut-illegal-lifetime.stderr @@ -1,9 +1,6 @@ error[E0597]: `x` does not live long enough --> tests/ui-stable/transmute-mut-illegal-lifetime.rs:14:56 | -12 | let mut x = 0u64; - | ----- binding `x` declared here -13 | // It is illegal to increase the lifetime scope. 14 | let _: &'static mut u64 = zerocopy::transmute_mut!(&mut x); | ---------------- ^^^^^^ borrowed value does not live long enough | | diff --git a/tests/ui-stable/transmute-mut-size-decrease.stderr b/tests/ui-stable/transmute-mut-size-decrease.stderr index 239991357d..90f67fe95f 100644 --- a/tests/ui-stable/transmute-mut-size-decrease.stderr +++ b/tests/ui-stable/transmute-mut-size-decrease.stderr @@ -6,4 +6,39 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `[u8; 2]` (16 bits) = note: target type: `u8` (8 bits) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0658]: mutable references are not allowed in constants + --> tests/ui-stable/transmute-mut-size-decrease.rs:17:47 + | +17 | const DECREASE_SIZE: &mut u8 = transmute_mut!(&mut [0u8; 2]); + | ^^^^^^^^^^^^^ + | + = note: see issue #57349 for more information + +error[E0658]: panicking in constants is unstable + --> tests/ui-stable/transmute-mut-size-decrease.rs:17:32 + | +17 | const DECREASE_SIZE: &mut u8 = transmute_mut!(&mut [0u8; 2]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #51999 for more information + = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants + --> tests/ui-stable/transmute-mut-size-decrease.rs:17:32 + | +17 | const DECREASE_SIZE: &mut u8 = transmute_mut!(&mut [0u8; 2]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = 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-size-decrease.rs:17:52 + | +17 | const DECREASE_SIZE: &mut u8 = transmute_mut!(&mut [0u8; 2]); + | --------------------^^^^^^^^- + | | | + | | creates a temporary which is freed while still in use + | temporary value is freed at the end of this statement + | using this value as a constant requires that borrow lasts for `'static` diff --git a/tests/ui-stable/transmute-mut-size-increase.stderr b/tests/ui-stable/transmute-mut-size-increase.stderr index 1427c7b0e9..1f37f27eb6 100644 --- a/tests/ui-stable/transmute-mut-size-increase.stderr +++ b/tests/ui-stable/transmute-mut-size-increase.stderr @@ -6,4 +6,39 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `u8` (8 bits) = note: target type: `[u8; 2]` (16 bits) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0658]: mutable references are not allowed in constants + --> tests/ui-stable/transmute-mut-size-increase.rs:17:52 + | +17 | const INCREASE_SIZE: &mut [u8; 2] = transmute_mut!(&mut 0u8); + | ^^^^^^^^ + | + = note: see issue #57349 for more information + +error[E0658]: panicking in constants is unstable + --> tests/ui-stable/transmute-mut-size-increase.rs:17:37 + | +17 | const INCREASE_SIZE: &mut [u8; 2] = transmute_mut!(&mut 0u8); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #51999 for more information + = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants + --> tests/ui-stable/transmute-mut-size-increase.rs:17:37 + | +17 | const INCREASE_SIZE: &mut [u8; 2] = transmute_mut!(&mut 0u8); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = 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-size-increase.rs:17:57 + | +17 | const INCREASE_SIZE: &mut [u8; 2] = transmute_mut!(&mut 0u8); + | --------------------^^^- + | | | + | | creates a temporary which is freed while still in use + | temporary value is freed at the end of this statement + | using this value as a constant requires that borrow lasts for `'static` diff --git a/tests/ui-stable/transmute-mut-src-dst-generic.stderr b/tests/ui-stable/transmute-mut-src-dst-generic.stderr index 2fd87ed86b..f601a7323f 100644 --- a/tests/ui-stable/transmute-mut-src-dst-generic.stderr +++ b/tests/ui-stable/transmute-mut-src-dst-generic.stderr @@ -6,7 +6,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `T` (this type does not have a fixed size) = note: target type: `U` (this type does not have a fixed size) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> tests/ui-stable/transmute-mut-src-dst-generic.rs:20:5 @@ -16,4 +16,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `AlignOf` (size can vary because of T) = note: target type: `MaxAlignsOf` (size can vary because of T) - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-mut-src-dst-not-references.stderr b/tests/ui-stable/transmute-mut-src-dst-not-references.stderr index c0d9e0f0d3..6d30ce99f5 100644 --- a/tests/ui-stable/transmute-mut-src-dst-not-references.stderr +++ b/tests/ui-stable/transmute-mut-src-dst-not-references.stderr @@ -5,11 +5,8 @@ error[E0308]: mismatched types | ---------------^^^^^^- | | | | | expected `&mut _`, found `usize` + | | help: consider mutably borrowing here: `&mut 0usize` | expected due to this | = note: expected mutable reference `&mut _` found type `usize` -help: consider mutably borrowing here - | -17 | const SRC_DST_NOT_REFERENCES: &mut usize = transmute_mut!(&mut 0usize); - | ++++ diff --git a/tests/ui-stable/transmute-mut-src-dst-unsized.stderr b/tests/ui-stable/transmute-mut-src-dst-unsized.stderr index 52a0c49bd1..8cc5287622 100644 --- a/tests/ui-stable/transmute-mut-src-dst-unsized.stderr +++ b/tests/ui-stable/transmute-mut-src-dst-unsized.stderr @@ -2,17 +2,14 @@ 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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AssertSrcIsSized` +note: required by `AssertSrcIsSized` --> tests/ui-stable/transmute-mut-src-dst-unsized.rs:17:36 | 17 | const SRC_DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsSized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 @@ -33,17 +30,14 @@ 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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AssertDstIsSized` +note: required by `AssertDstIsSized` --> tests/ui-stable/transmute-mut-src-dst-unsized.rs:17:36 | 17 | const SRC_DST_UNSIZED: &mut [u8] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsSized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 @@ -64,15 +58,17 @@ 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::::into_t` - --> src/macro_util.rs +note: required by a bound in `transmute` + = note: this error originates in the macro `$crate::assert_size_eq` (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 | - | impl AlignOf { - | ^ required by this bound in `AlignOf::::into_t` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn into_t(self) -> T { - | ------ 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) + = help: the trait `Sized` is not implemented for `[u8]` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -82,7 +78,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | = help: the trait `Sized` is not implemented for `[u8]` = note: the left-hand-side of an assignment must have a statically known size - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -96,7 +92,35 @@ note: required by a bound in `AlignOf` | | pub struct AlignOf { | ^ 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by `MaxAlignsOf::::new` + --> src/macro_util.rs + | + | pub fn new(_t: T, _u: U) -> MaxAlignsOf { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by a bound in `MaxAlignsOf` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -110,7 +134,7 @@ note: required by a bound in `MaxAlignsOf` | | pub union MaxAlignsOf { | ^ required by this bound 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -124,7 +148,21 @@ note: required by a bound in `AlignOf` | | pub struct AlignOf { | ^ 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by a bound in `MaxAlignsOf` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -145,20 +183,13 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | = 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: 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) + = note: this error originates in the macro `$crate::assert_size_eq` (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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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` diff --git a/tests/ui-stable/transmute-mut-src-generic.stderr b/tests/ui-stable/transmute-mut-src-generic.stderr index 400b0a8166..bc3d35e375 100644 --- a/tests/ui-stable/transmute-mut-src-generic.stderr +++ b/tests/ui-stable/transmute-mut-src-generic.stderr @@ -6,7 +6,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `T` (this type does not have a fixed size) = note: target type: `u8` (8 bits) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> tests/ui-stable/transmute-mut-src-generic.rs:17:5 @@ -16,4 +16,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `AlignOf` (size can vary because of T) = note: target type: `MaxAlignsOf` (size can vary because of T) - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-mut-src-not-a-reference.stderr b/tests/ui-stable/transmute-mut-src-not-a-reference.stderr index 8c1d9b47ba..b190d05e6d 100644 --- a/tests/ui-stable/transmute-mut-src-not-a-reference.stderr +++ b/tests/ui-stable/transmute-mut-src-not-a-reference.stderr @@ -5,11 +5,8 @@ error[E0308]: mismatched types | ---------------^^^^^^- | | | | | expected `&mut _`, found `usize` + | | help: consider mutably borrowing here: `&mut 0usize` | expected due to this | = note: expected mutable reference `&mut _` found type `usize` -help: consider mutably borrowing here - | -17 | const SRC_NOT_A_REFERENCE: &mut u8 = transmute_mut!(&mut 0usize); - | ++++ diff --git a/tests/ui-stable/transmute-mut-src-not-frombytes.stderr b/tests/ui-stable/transmute-mut-src-not-frombytes.stderr index cc4a19d724..fd551f388f 100644 --- a/tests/ui-stable/transmute-mut-src-not-frombytes.stderr +++ b/tests/ui-stable/transmute-mut-src-not-frombytes.stderr @@ -2,26 +2,13 @@ error[E0277]: the trait bound `Src: FromBytes` is not satisfied --> tests/ui-stable/transmute-mut-src-not-frombytes.rs:24:38 | 24 | const SRC_NOT_FROM_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `FromBytes` is not implemented for `Src` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `Src` | - = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 - and $N others -note: required by a bound in `AssertSrcIsFromBytes` +note: required by `AssertSrcIsFromBytes` --> tests/ui-stable/transmute-mut-src-not-frombytes.rs:24:38 | 24 | const SRC_NOT_FROM_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsFromBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Src: FromBytes` is not satisfied @@ -30,16 +17,6 @@ error[E0277]: the trait bound `Src: FromBytes` is not satisfied 24 | const SRC_NOT_FROM_BYTES: &mut Dst = transmute_mut!(&mut Src); | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `Src` | - = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 - and $N others note: required by a bound in `AssertSrcIsFromBytes` --> tests/ui-stable/transmute-mut-src-not-frombytes.rs:24:38 | diff --git a/tests/ui-stable/transmute-mut-src-not-intobytes.stderr b/tests/ui-stable/transmute-mut-src-not-intobytes.stderr index 7a4ce2e6ed..94c4b8eb17 100644 --- a/tests/ui-stable/transmute-mut-src-not-intobytes.stderr +++ b/tests/ui-stable/transmute-mut-src-not-intobytes.stderr @@ -1,45 +1,22 @@ -error[E0277]: the trait bound `Src: AsBytes` is not satisfied +error[E0277]: the trait bound `Src: IntoBytes` is not satisfied --> tests/ui-stable/transmute-mut-src-not-intobytes.rs:24:36 | 24 | const SRC_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `AsBytes` is not implemented for `Src` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Src` | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertSrcIsIntoBytes` +note: required by `AssertSrcIsIntoBytes` --> tests/ui-stable/transmute-mut-src-not-intobytes.rs:24:36 | 24 | const SRC_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsIntoBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `Src: AsBytes` is not satisfied +error[E0277]: the trait bound `Src: IntoBytes` is not satisfied --> tests/ui-stable/transmute-mut-src-not-intobytes.rs:24:36 | 24 | const SRC_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src` + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Src` | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others note: required by a bound in `AssertSrcIsIntoBytes` --> tests/ui-stable/transmute-mut-src-not-intobytes.rs:24:36 | diff --git a/tests/ui-stable/transmute-mut-src-not-nocell.stderr b/tests/ui-stable/transmute-mut-src-not-nocell.stderr index 80b0126fa7..1343dff273 100644 --- a/tests/ui-stable/transmute-mut-src-not-nocell.stderr +++ b/tests/ui-stable/transmute-mut-src-not-nocell.stderr @@ -2,26 +2,13 @@ error[E0277]: the trait bound `Src: NoCell` is not satisfied --> tests/ui-stable/transmute-mut-src-not-nocell.rs:24:35 | 24 | const SRC_NOT_NO_CELL: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `NoCell` is not implemented for `Src` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NoCell` is not implemented for `Src` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertSrcIsNoCell` +note: required by `AssertSrcIsNoCell` --> tests/ui-stable/transmute-mut-src-not-nocell.rs:24:35 | 24 | const SRC_NOT_NO_CELL: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsNoCell` + | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Src: NoCell` is not satisfied @@ -30,16 +17,6 @@ error[E0277]: the trait bound `Src: NoCell` is not satisfied 24 | const SRC_NOT_NO_CELL: &mut Dst = transmute_mut!(&mut Src); | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NoCell` is not implemented for `Src` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others note: required by a bound in `AssertSrcIsNoCell` --> tests/ui-stable/transmute-mut-src-not-nocell.rs:24:35 | diff --git a/tests/ui-stable/transmute-mut-src-unsized.stderr b/tests/ui-stable/transmute-mut-src-unsized.stderr index 88ad009938..0db9e2e04d 100644 --- a/tests/ui-stable/transmute-mut-src-unsized.stderr +++ b/tests/ui-stable/transmute-mut-src-unsized.stderr @@ -2,17 +2,14 @@ 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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AssertSrcIsSized` +note: required by `AssertSrcIsSized` --> tests/ui-stable/transmute-mut-src-unsized.rs:16:35 | 16 | const SRC_UNSIZED: &mut [u8; 1] = transmute_mut!(&mut [0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsSized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 @@ -47,15 +44,17 @@ 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::::into_t` - --> src/macro_util.rs +note: required by a bound in `transmute` + = note: this error originates in the macro `$crate::assert_size_eq` (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 | - | impl AlignOf { - | ^ required by this bound in `AlignOf::::into_t` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn into_t(self) -> T { - | ------ 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) + = help: the trait `Sized` is not implemented for `[u8]` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -65,7 +64,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | = help: the trait `Sized` is not implemented for `[u8]` = note: the left-hand-side of an assignment must have a statically known size - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -79,7 +78,21 @@ note: required by a bound in `AlignOf` | | pub struct AlignOf { | ^ 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by `MaxAlignsOf::::new` + --> src/macro_util.rs + | + | pub fn new(_t: T, _u: U) -> MaxAlignsOf { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -93,7 +106,21 @@ note: required by a bound in `MaxAlignsOf` | | pub union MaxAlignsOf { | ^ required by this bound 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by a bound in `MaxAlignsOf` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -107,16 +134,27 @@ note: required by a bound in `AlignOf` | | pub struct AlignOf { | ^ 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` note: required by a bound in `transmute_mut` @@ -125,3 +163,13 @@ note: required by a bound in `transmute_mut` | pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( | ^^^ required by this bound 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 + --> 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]` + = note: all function arguments must have a statically known size + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ptr-to-usize.stderr b/tests/ui-stable/transmute-ptr-to-usize.stderr index cc6551a22d..bdbf234239 100644 --- a/tests/ui-stable/transmute-ptr-to-usize.stderr +++ b/tests/ui-stable/transmute-ptr-to-usize.stderr @@ -2,17 +2,13 @@ error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied --> tests/ui-stable/transmute-ptr-to-usize.rs:20:30 | 20 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `AsBytes` is not implemented for `*const usize` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `*const usize` | - = help: the trait `AsBytes` is implemented for `usize` -note: required by a bound in `AssertIsIntoBytes` +note: required by `AssertIsIntoBytes` --> tests/ui-stable/transmute-ptr-to-usize.rs:20:30 | 20 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertIsIntoBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied @@ -21,7 +17,6 @@ error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied 20 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `*const usize` | - = help: the trait `AsBytes` is implemented for `usize` note: required by a bound in `AssertIsIntoBytes` --> tests/ui-stable/transmute-ptr-to-usize.rs:20:30 | diff --git a/tests/ui-stable/transmute-ref-alignment-increase.stderr b/tests/ui-stable/transmute-ref-alignment-increase.stderr index a34c4065d1..2d6b262d3e 100644 --- a/tests/ui-stable/transmute-ref-alignment-increase.stderr +++ b/tests/ui-stable/transmute-ref-alignment-increase.stderr @@ -6,4 +6,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `AlignOf<[u8; 2]>` (8 bits) = note: target type: `MaxAlignsOf<[u8; 2], AU16>` (16 bits) - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-dst-generic.stderr b/tests/ui-stable/transmute-ref-dst-generic.stderr index e30b9f67a6..6a35461b3f 100644 --- a/tests/ui-stable/transmute-ref-dst-generic.stderr +++ b/tests/ui-stable/transmute-ref-dst-generic.stderr @@ -6,7 +6,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `u8` (8 bits) = note: target type: `T` (this type does not have a fixed size) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> tests/ui-stable/transmute-ref-dst-generic.rs:17:5 @@ -16,4 +16,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `AlignOf` (8 bits) = note: target type: `MaxAlignsOf` (size can vary because of T) - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-dst-not-a-reference.stderr b/tests/ui-stable/transmute-ref-dst-not-a-reference.stderr index afdb0f1563..9c091325bc 100644 --- a/tests/ui-stable/transmute-ref-dst-not-a-reference.stderr +++ b/tests/ui-stable/transmute-ref-dst-not-a-reference.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-dst-not-a-reference.rs:17:36 | 17 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` @@ -12,7 +12,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-dst-not-a-reference.rs:17:36 | 17 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-dst-not-a-reference.rs:17:36 | 17 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-dst-not-a-reference.rs:17:36 | 17 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` @@ -42,7 +42,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-dst-not-a-reference.rs:17:36 | 17 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); - | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` diff --git a/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr b/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr index 5f292d286b..26e5d1162c 100644 --- a/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr +++ b/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr @@ -2,24 +2,11 @@ error[E0277]: the trait bound `Dst: FromBytes` is not satisfied --> tests/ui-stable/transmute-ref-dst-not-frombytes.rs:22:34 | 22 | const DST_NOT_FROM_BYTES: &Dst = transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `FromBytes` is not implemented for `Dst` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `Dst` | - = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 - and $N others -note: required by a bound in `AssertDstIsFromBytes` +note: required by `AssertDstIsFromBytes` --> tests/ui-stable/transmute-ref-dst-not-frombytes.rs:22:34 | 22 | const DST_NOT_FROM_BYTES: &Dst = transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsFromBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-dst-not-nocell.stderr b/tests/ui-stable/transmute-ref-dst-not-nocell.stderr index 09f6a9609d..9730672b87 100644 --- a/tests/ui-stable/transmute-ref-dst-not-nocell.stderr +++ b/tests/ui-stable/transmute-ref-dst-not-nocell.stderr @@ -2,24 +2,11 @@ error[E0277]: the trait bound `Dst: NoCell` is not satisfied --> tests/ui-stable/transmute-ref-dst-not-nocell.rs:22:31 | 22 | const DST_NOT_NO_CELL: &Dst = transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `NoCell` is not implemented for `Dst` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NoCell` is not implemented for `Dst` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertDstIsNoCell` +note: required by `AssertDstIsNoCell` --> tests/ui-stable/transmute-ref-dst-not-nocell.rs:22:31 | 22 | const DST_NOT_NO_CELL: &Dst = transmute_ref!(&AU16(0)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsNoCell` + | ^^^^^^^^^^^^^^^^^^^^^^^^ = 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-dst-unsized.stderr b/tests/ui-stable/transmute-ref-dst-unsized.stderr index 557bdcb78a..0f103be100 100644 --- a/tests/ui-stable/transmute-ref-dst-unsized.stderr +++ b/tests/ui-stable/transmute-ref-dst-unsized.stderr @@ -2,17 +2,14 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> 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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AssertDstIsSized` +note: required by `AssertDstIsSized` --> tests/ui-stable/transmute-ref-dst-unsized.rs:17:28 | 17 | const DST_UNSIZED: &[u8] = transmute_ref!(&[0u8; 1]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsSized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 @@ -38,7 +35,7 @@ note: required by a bound in `MaxAlignsOf` | | pub union MaxAlignsOf { | ^ required by this bound 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -48,11 +45,35 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `transmute` - --> $RUST/core/src/intrinsics.rs + = note: this error originates in the macro `$crate::assert_size_eq` (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 | - | pub fn transmute(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) +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 `MaxAlignsOf::::new` + --> src/macro_util.rs + | + | pub fn new(_t: T, _u: U) -> MaxAlignsOf { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 `MaxAlignsOf` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 diff --git a/tests/ui-stable/transmute-ref-illegal-lifetime.stderr b/tests/ui-stable/transmute-ref-illegal-lifetime.stderr index 1ef34feb7f..71b73db6e5 100644 --- a/tests/ui-stable/transmute-ref-illegal-lifetime.stderr +++ b/tests/ui-stable/transmute-ref-illegal-lifetime.stderr @@ -1,9 +1,6 @@ error[E0597]: `x` does not live long enough --> tests/ui-stable/transmute-ref-illegal-lifetime.rs:14:52 | -12 | let x = 0u64; - | - binding `x` declared here -13 | // It is illegal to increase the lifetime scope. 14 | let _: &'static u64 = zerocopy::transmute_ref!(&x); | ------------ ^^ borrowed value does not live long enough | | diff --git a/tests/ui-stable/transmute-ref-size-decrease.stderr b/tests/ui-stable/transmute-ref-size-decrease.stderr index f353b26ece..a6fd776fb0 100644 --- a/tests/ui-stable/transmute-ref-size-decrease.stderr +++ b/tests/ui-stable/transmute-ref-size-decrease.stderr @@ -6,4 +6,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `[u8; 2]` (16 bits) = note: target type: `u8` (8 bits) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-size-increase.stderr b/tests/ui-stable/transmute-ref-size-increase.stderr index f51eb63f4b..aa4e1c9863 100644 --- a/tests/ui-stable/transmute-ref-size-increase.stderr +++ b/tests/ui-stable/transmute-ref-size-increase.stderr @@ -6,4 +6,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `u8` (8 bits) = note: target type: `[u8; 2]` (16 bits) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-src-dst-generic.stderr b/tests/ui-stable/transmute-ref-src-dst-generic.stderr index 0905dc6d5f..ff21ac5fa1 100644 --- a/tests/ui-stable/transmute-ref-src-dst-generic.stderr +++ b/tests/ui-stable/transmute-ref-src-dst-generic.stderr @@ -6,7 +6,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `T` (this type does not have a fixed size) = note: target type: `U` (this type does not have a fixed size) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> tests/ui-stable/transmute-ref-src-dst-generic.rs:18:5 @@ -16,4 +16,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `AlignOf` (size can vary because of T) = note: target type: `MaxAlignsOf` (size can vary because of T) - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-src-dst-not-references.stderr b/tests/ui-stable/transmute-ref-src-dst-not-references.stderr index 4d1701e2d9..fb07e5477e 100644 --- a/tests/ui-stable/transmute-ref-src-dst-not-references.stderr +++ b/tests/ui-stable/transmute-ref-src-dst-not-references.stderr @@ -4,21 +4,18 @@ error[E0308]: mismatched types 17 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); | ---------------^^^^^^- | | | - | | expected `&_`, found `usize` + | | expected reference, found `usize` + | | help: consider borrowing here: `&0usize` | expected due to this | = note: expected reference `&_` found type `usize` -help: consider borrowing here - | -17 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(&0usize); - | + error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-src-dst-not-references.rs:17:39 | 17 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` @@ -28,7 +25,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-src-dst-not-references.rs:17:39 | 17 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` @@ -38,7 +35,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-src-dst-not-references.rs:17:39 | 17 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` @@ -48,7 +45,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-src-dst-not-references.rs:17:39 | 17 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` @@ -58,7 +55,7 @@ error[E0308]: mismatched types --> tests/ui-stable/transmute-ref-src-dst-not-references.rs:17:39 | 17 | const SRC_DST_NOT_REFERENCES: usize = transmute_ref!(0usize); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` + | ^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | = note: expected type `usize` found reference `&_` diff --git a/tests/ui-stable/transmute-ref-src-dst-unsized.stderr b/tests/ui-stable/transmute-ref-src-dst-unsized.stderr index 3637cdc9f7..94e323736b 100644 --- a/tests/ui-stable/transmute-ref-src-dst-unsized.stderr +++ b/tests/ui-stable/transmute-ref-src-dst-unsized.stderr @@ -2,17 +2,14 @@ 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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AssertSrcIsSized` +note: required by `AssertSrcIsSized` --> tests/ui-stable/transmute-ref-src-dst-unsized.rs:17:32 | 17 | const SRC_DST_UNSIZED: &[u8] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsSized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 @@ -33,17 +30,14 @@ 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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AssertDstIsSized` +note: required by `AssertDstIsSized` --> tests/ui-stable/transmute-ref-src-dst-unsized.rs:17:32 | 17 | const SRC_DST_UNSIZED: &[u8] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsSized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 @@ -64,15 +58,17 @@ 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::::into_t` - --> src/macro_util.rs +note: required by a bound in `transmute` + = note: this error originates in the macro `$crate::assert_size_eq` (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 | - | impl AlignOf { - | ^ required by this bound in `AlignOf::::into_t` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn into_t(self) -> T { - | ------ 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) + = help: the trait `Sized` is not implemented for `[u8]` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -82,7 +78,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | = help: the trait `Sized` is not implemented for `[u8]` = note: the left-hand-side of an assignment must have a statically known size - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -96,7 +92,35 @@ note: required by a bound in `AlignOf` | | pub struct AlignOf { | ^ 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by `MaxAlignsOf::::new` + --> src/macro_util.rs + | + | pub fn new(_t: T, _u: U) -> MaxAlignsOf { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by a bound in `MaxAlignsOf` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -110,7 +134,7 @@ note: required by a bound in `MaxAlignsOf` | | pub union MaxAlignsOf { | ^ required by this bound 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -124,7 +148,21 @@ note: required by a bound in `AlignOf` | | pub struct AlignOf { | ^ 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by a bound in `MaxAlignsOf` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -145,20 +183,13 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | = 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: 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) + = note: this error originates in the macro `$crate::assert_size_eq` (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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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` diff --git a/tests/ui-stable/transmute-ref-src-generic.stderr b/tests/ui-stable/transmute-ref-src-generic.stderr index b6bbd1648a..5f32c827ad 100644 --- a/tests/ui-stable/transmute-ref-src-generic.stderr +++ b/tests/ui-stable/transmute-ref-src-generic.stderr @@ -6,7 +6,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `T` (this type does not have a fixed size) = note: target type: `u8` (8 bits) - = 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) + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> tests/ui-stable/transmute-ref-src-generic.rs:17:5 @@ -16,4 +16,4 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- | = note: source type: `AlignOf` (size can vary because of T) = note: target type: `MaxAlignsOf` (size can vary because of T) - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-ref-src-not-a-reference.stderr b/tests/ui-stable/transmute-ref-src-not-a-reference.stderr index 622c3db9ac..8dff010d82 100644 --- a/tests/ui-stable/transmute-ref-src-not-a-reference.stderr +++ b/tests/ui-stable/transmute-ref-src-not-a-reference.stderr @@ -4,12 +4,9 @@ error[E0308]: mismatched types 17 | const SRC_NOT_A_REFERENCE: &u8 = transmute_ref!(0usize); | ---------------^^^^^^- | | | - | | expected `&_`, found `usize` + | | expected reference, found `usize` + | | help: consider borrowing here: `&0usize` | expected due to this | = note: expected reference `&_` found type `usize` -help: consider borrowing here - | -17 | const SRC_NOT_A_REFERENCE: &u8 = transmute_ref!(&0usize); - | + diff --git a/tests/ui-stable/transmute-ref-src-not-intobytes.stderr b/tests/ui-stable/transmute-ref-src-not-intobytes.stderr index b446fa11db..d94ed3d413 100644 --- a/tests/ui-stable/transmute-ref-src-not-intobytes.stderr +++ b/tests/ui-stable/transmute-ref-src-not-intobytes.stderr @@ -1,45 +1,22 @@ -error[E0277]: the trait bound `Src: AsBytes` is not satisfied +error[E0277]: the trait bound `Src: IntoBytes` is not satisfied --> tests/ui-stable/transmute-ref-src-not-intobytes.rs:22:33 | 22 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `AsBytes` is not implemented for `Src` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Src` | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertSrcIsIntoBytes` +note: required by `AssertSrcIsIntoBytes` --> tests/ui-stable/transmute-ref-src-not-intobytes.rs:22:33 | 22 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsIntoBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `Src: AsBytes` is not satisfied +error[E0277]: the trait bound `Src: IntoBytes` is not satisfied --> tests/ui-stable/transmute-ref-src-not-intobytes.rs:22:33 | 22 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Src` | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others note: required by a bound in `AssertSrcIsIntoBytes` --> tests/ui-stable/transmute-ref-src-not-intobytes.rs:22:33 | diff --git a/tests/ui-stable/transmute-ref-src-not-nocell.stderr b/tests/ui-stable/transmute-ref-src-not-nocell.stderr index 115a32cc9d..d2bdd81123 100644 --- a/tests/ui-stable/transmute-ref-src-not-nocell.stderr +++ b/tests/ui-stable/transmute-ref-src-not-nocell.stderr @@ -2,26 +2,13 @@ error[E0277]: the trait bound `Src: NoCell` is not satisfied --> tests/ui-stable/transmute-ref-src-not-nocell.rs:22:32 | 22 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `NoCell` is not implemented for `Src` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `NoCell` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertSrcIsNoCell` +note: required by `AssertSrcIsNoCell` --> tests/ui-stable/transmute-ref-src-not-nocell.rs:22:32 | 22 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsNoCell` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Src: NoCell` is not satisfied @@ -30,16 +17,6 @@ error[E0277]: the trait bound `Src: NoCell` is not satisfied 22 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NoCell` is not implemented for `Src` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others note: required by a bound in `AssertSrcIsNoCell` --> tests/ui-stable/transmute-ref-src-not-nocell.rs:22:32 | diff --git a/tests/ui-stable/transmute-ref-src-unsized.stderr b/tests/ui-stable/transmute-ref-src-unsized.stderr index fdb3f3224d..7a9ccebaf6 100644 --- a/tests/ui-stable/transmute-ref-src-unsized.stderr +++ b/tests/ui-stable/transmute-ref-src-unsized.stderr @@ -2,17 +2,14 @@ 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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `AssertSrcIsSized` +note: required by `AssertSrcIsSized` --> tests/ui-stable/transmute-ref-src-unsized.rs:16:31 | 16 | const SRC_UNSIZED: &[u8; 1] = transmute_ref!(&[0u8][..]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsSized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 @@ -47,15 +44,17 @@ 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::::into_t` - --> src/macro_util.rs +note: required by a bound in `transmute` + = note: this error originates in the macro `$crate::assert_size_eq` (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 | - | impl AlignOf { - | ^ required by this bound in `AlignOf::::into_t` - | #[inline(never)] // Make `missing_inline_in_public_items` happy. - | pub fn into_t(self) -> T { - | ------ 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) + = help: the trait `Sized` is not implemented for `[u8]` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -65,7 +64,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation | = help: the trait `Sized` is not implemented for `[u8]` = note: the left-hand-side of an assignment must have a statically known size - = 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -79,7 +78,21 @@ note: required by a bound in `AlignOf` | | pub struct AlignOf { | ^ 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by `MaxAlignsOf::::new` + --> src/macro_util.rs + | + | pub fn new(_t: T, _u: U) -> MaxAlignsOf { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -93,7 +106,21 @@ note: required by a bound in `MaxAlignsOf` | | pub union MaxAlignsOf { | ^ required by this bound 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` +note: required by a bound in `MaxAlignsOf` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 @@ -107,16 +134,27 @@ note: required by a bound in `AlignOf` | | pub struct AlignOf { | ^ 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) + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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` + --> src/macro_util.rs + | + | pub union MaxAlignsOf { + | ^ required by this bound in `MaxAlignsOf` + = note: this error originates in the macro `$crate::assert_align_gt_eq` (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]` note: required by a bound in `transmute_ref` @@ -125,3 +163,13 @@ note: required by a bound in `transmute_ref` | pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( | ^^^ required by this bound 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 + --> 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]` + = note: all function arguments must have a statically known size + = note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-src-not-intobytes.stderr b/tests/ui-stable/transmute-src-not-intobytes.stderr index 5fd73a6382..7c0b4e2970 100644 --- a/tests/ui-stable/transmute-src-not-intobytes.stderr +++ b/tests/ui-stable/transmute-src-not-intobytes.stderr @@ -2,26 +2,13 @@ error[E0277]: the trait bound `NotZerocopy: AsBytes` is not satisfied --> tests/ui-stable/transmute-src-not-intobytes.rs:18:32 | 18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `AsBytes` is not implemented for `NotZerocopy` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertIsIntoBytes` +note: required by `AssertIsIntoBytes` --> tests/ui-stable/transmute-src-not-intobytes.rs:18:32 | 18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertIsIntoBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: AsBytes` is not satisfied @@ -30,16 +17,6 @@ error[E0277]: the trait bound `NotZerocopy: AsBytes` is not satisfied 18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others note: required by a bound in `AssertIsIntoBytes` --> tests/ui-stable/transmute-src-not-intobytes.rs:18:32 | diff --git a/zerocopy-derive/Cargo.toml b/zerocopy-derive/Cargo.toml index c4218d32af..18319a858a 100644 --- a/zerocopy-derive/Cargo.toml +++ b/zerocopy-derive/Cargo.toml @@ -14,7 +14,7 @@ authors = ["Joshua Liebow-Feeser "] description = "Custom derive for traits from the zerocopy crate" license = "BSD-2-Clause OR Apache-2.0 OR MIT" repository = "https://github.com/google/zerocopy" -rust-version = "1.57.0" +rust-version = "1.56.0" # We prefer to include tests when publishing to crates.io so that Crater [1] can # detect regressions in our test suite. These two tests are excessively large, diff --git a/zerocopy-derive/tests/ui-stable/derive_transparent.stderr b/zerocopy-derive/tests/ui-stable/derive_transparent.stderr index 3fb2358586..f51a03b42b 100644 --- a/zerocopy-derive/tests/ui-stable/derive_transparent.stderr +++ b/zerocopy-derive/tests/ui-stable/derive_transparent.stderr @@ -1,139 +1,89 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied - --> tests/ui-stable/derive_transparent.rs:37:18 + --> tests/ui-stable/derive_transparent.rs:37:1 | 37 | assert_impl_all!(TransparentStruct: TryFromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `TryFromBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required for `TransparentStruct` to implement `TryFromBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `TryFromBytes` for `TransparentStruct` --> tests/ui-stable/derive_transparent.rs:27:21 | 27 | #[derive(IntoBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] - | ^^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^^^^ note: required by a bound in `_::{closure#0}::assert_impl_all` --> tests/ui-stable/derive_transparent.rs:37:1 | 37 | assert_impl_all!(TransparentStruct: TryFromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` - = note: this error originates in the derive macro `TryFromBytes` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `NotZerocopy: FromZeroes` is not satisfied - --> tests/ui-stable/derive_transparent.rs:38:18 +error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied + --> tests/ui-stable/derive_transparent.rs:38:1 | 38 | assert_impl_all!(TransparentStruct: FromZeros); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeroes` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `FromZeroes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required for `TransparentStruct` to implement `FromZeroes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `FromZeros` for `TransparentStruct` --> tests/ui-stable/derive_transparent.rs:27:35 | 27 | #[derive(IntoBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] - | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^ note: required by a bound in `_::{closure#0}::assert_impl_all` --> tests/ui-stable/derive_transparent.rs:38:1 | 38 | assert_impl_all!(TransparentStruct: FromZeros); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` - = note: this error originates in the derive macro `FromZeros` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied - --> tests/ui-stable/derive_transparent.rs:39:18 + --> tests/ui-stable/derive_transparent.rs:39:1 | 39 | assert_impl_all!(TransparentStruct: FromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 - and $N others -note: required for `TransparentStruct` to implement `FromBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `FromBytes` for `TransparentStruct` --> tests/ui-stable/derive_transparent.rs:27:46 | 27 | #[derive(IntoBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] - | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^ note: required by a bound in `_::{closure#0}::assert_impl_all` --> tests/ui-stable/derive_transparent.rs:39:1 | 39 | assert_impl_all!(TransparentStruct: FromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` - = note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `NotZerocopy: AsBytes` is not satisfied - --> tests/ui-stable/derive_transparent.rs:40:18 +error[E0277]: the trait bound `NotZerocopy: IntoBytes` is not satisfied + --> tests/ui-stable/derive_transparent.rs:40:1 | 40 | assert_impl_all!(TransparentStruct: IntoBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required for `TransparentStruct` to implement `AsBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `IntoBytes` for `TransparentStruct` --> tests/ui-stable/derive_transparent.rs:27:10 | 27 | #[derive(IntoBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] - | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^ note: required by a bound in `_::{closure#0}::assert_impl_all` --> tests/ui-stable/derive_transparent.rs:40:1 | 40 | assert_impl_all!(TransparentStruct: IntoBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` - = note: this error originates in the derive macro `IntoBytes` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: Unaligned` is not satisfied - --> tests/ui-stable/derive_transparent.rs:41:18 + --> tests/ui-stable/derive_transparent.rs:41:1 | 41 | assert_impl_all!(TransparentStruct: Unaligned); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unaligned` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `Unaligned`: - bool - i8 - u8 - TransparentStruct - U16 - U32 - U64 - U128 - and $N others -note: required for `TransparentStruct` to implement `Unaligned` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unaligned` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `Unaligned` for `TransparentStruct` --> tests/ui-stable/derive_transparent.rs:27:57 | 27 | #[derive(IntoBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] - | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^ note: required by a bound in `_::{closure#0}::assert_impl_all` --> tests/ui-stable/derive_transparent.rs:41:1 | 41 | assert_impl_all!(TransparentStruct: Unaligned); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all` - = note: this error originates in the derive macro `Unaligned` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-stable/enum.stderr b/zerocopy-derive/tests/ui-stable/enum.stderr index 848b74dda3..7a476adbe5 100644 --- a/zerocopy-derive/tests/ui-stable/enum.stderr +++ b/zerocopy-derive/tests/ui-stable/enum.stderr @@ -244,8 +244,6 @@ error[E0552]: unrecognized representation hint | 25 | #[repr(foo)] | ^^^ - | - = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` error[E0566]: conflicting representation hints --> tests/ui-stable/enum.rs:37:8 @@ -253,9 +251,9 @@ error[E0566]: conflicting representation hints 37 | #[repr(u8, u16)] | ^^ ^^^ | + = note: `#[deny(conflicting_repr_hints)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #68585 - = note: `#[deny(conflicting_repr_hints)]` on by default error[E0277]: the trait bound `UnsafeCell<()>: NoCell` is not satisfied --> tests/ui-stable/enum.rs:51:10 @@ -263,16 +261,6 @@ error[E0277]: the trait bound `UnsafeCell<()>: NoCell` is not satisfied 51 | #[derive(NoCell)] | ^^^^^^ the trait `NoCell` is not implemented for `UnsafeCell<()>` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `NoCell` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -282,15 +270,5 @@ error[E0277]: the trait bound `UnsafeCell: NoCell` is not satisfied 59 | #[derive(NoCell)] | ^^^^^^ the trait `NoCell` is not implemented for `UnsafeCell` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `NoCell` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr b/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr index f0c1904ed4..95966d2b2f 100644 --- a/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr +++ b/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr @@ -12,16 +12,6 @@ error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied 28 | #[derive(TryFromBytes)] | ^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `TryFromBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -31,16 +21,6 @@ error[E0277]: the trait bound `NotZerocopy: FromZeroes` is not satisfied 37 | #[derive(FromZeros)] | ^^^^^^^^^ the trait `FromZeroes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `FromZeroes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -50,16 +30,6 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied 46 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `FromBytes`: - isize - i8 - i16 - i32 - i64 - i128 - usize - u8 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -69,16 +39,6 @@ error[E0277]: the trait bound `FromBytes1: FromZeroes` is not satisfied 46 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromZeroes` is not implemented for `FromBytes1` | - = help: the following other types implement trait `FromZeroes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others note: required by a bound in `FromBytes` --> $WORKSPACE/src/lib.rs | @@ -86,22 +46,12 @@ note: required by a bound in `FromBytes` | ^^^^^^^^^ required by this bound in `FromBytes` = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `NotZerocopy: AsBytes` is not satisfied +error[E0277]: the trait bound `NotZerocopy: IntoBytes` is not satisfied --> tests/ui-stable/late_compile_pass.rs:55:10 | 55 | #[derive(IntoBytes)] - | ^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `AsBytes`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others + | ^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy` + | = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -111,16 +61,6 @@ error[E0277]: the trait bound `AU16: Unaligned` is not satisfied 65 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `Unaligned` is not implemented for `AU16` | - = help: the following other types implement trait `Unaligned`: - bool - i8 - u8 - Unaligned1 - Unaligned2 - Unaligned3 - U16 - U32 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -130,16 +70,6 @@ error[E0277]: the trait bound `AU16: Unaligned` is not satisfied 73 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `Unaligned` is not implemented for `AU16` | - = help: the following other types implement trait `Unaligned`: - bool - i8 - u8 - Unaligned1 - Unaligned2 - Unaligned3 - U16 - U32 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -149,15 +79,5 @@ error[E0277]: the trait bound `AU16: Unaligned` is not satisfied 80 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `Unaligned` is not implemented for `AU16` | - = help: the following other types implement trait `Unaligned`: - bool - i8 - u8 - Unaligned1 - Unaligned2 - Unaligned3 - U16 - U32 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-stable/mid_compile_pass.stderr b/zerocopy-derive/tests/ui-stable/mid_compile_pass.stderr index f39bcdb170..ed342f9ea0 100644 --- a/zerocopy-derive/tests/ui-stable/mid_compile_pass.stderr +++ b/zerocopy-derive/tests/ui-stable/mid_compile_pass.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `T: KnownLayout` is not satisfied 59 | fn test_kl13(t: T) -> impl KnownLayout { | ^^^^^^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `T` | -note: required for `KL13` to implement `KnownLayout` +note: required because of the requirements on the impl of `KnownLayout` for `KL13` --> tests/ui-stable/mid_compile_pass.rs:55:10 | 55 | #[derive(KnownLayout)] - | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^^^ = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | @@ -19,22 +19,20 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> tests/ui-stable/mid_compile_pass.rs:31:15 | 30 | fn test_kl04(kl: &KL04) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` 31 | assert_kl(kl); - | --------- ^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^ doesn't have a size known at compile-time | note: required because it appears within the type `KL04` --> tests/ui-stable/mid_compile_pass.rs:28:8 | 28 | struct KL04(u8, T); | ^^^^ -note: required for `KL04` to implement `KnownLayout` +note: required because of the requirements on the impl of `KnownLayout` for `KL04` --> tests/ui-stable/mid_compile_pass.rs:27:10 | 27 | #[derive(KnownLayout)] - | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^^^ note: required by a bound in `assert_kl` --> tests/ui-stable/mid_compile_pass.rs:23:26 | @@ -51,22 +49,20 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> tests/ui-stable/mid_compile_pass.rs:40:15 | 39 | fn test_kl06(kl: &KL06) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` 40 | assert_kl(kl); - | --------- ^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^ doesn't have a size known at compile-time | note: required because it appears within the type `KL06` --> tests/ui-stable/mid_compile_pass.rs:37:8 | 37 | struct KL06(u8, T); | ^^^^ -note: required for `KL06` to implement `KnownLayout` +note: required because of the requirements on the impl of `KnownLayout` for `KL06` --> tests/ui-stable/mid_compile_pass.rs:36:10 | 36 | #[derive(KnownLayout)] - | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^^^ note: required by a bound in `assert_kl` --> tests/ui-stable/mid_compile_pass.rs:23:26 | @@ -83,15 +79,13 @@ error[E0277]: the trait bound `T: KnownLayout` is not satisfied --> tests/ui-stable/mid_compile_pass.rs:50:15 | 50 | assert_kl(kl) - | --------- ^^ the trait `KnownLayout` is not implemented for `T` - | | - | required by a bound introduced by this call + | ^^ the trait `KnownLayout` is not implemented for `T` | -note: required for `KL12` to implement `KnownLayout` +note: required because of the requirements on the impl of `KnownLayout` for `KL12` --> tests/ui-stable/mid_compile_pass.rs:45:10 | 45 | #[derive(KnownLayout)] - | ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro + | ^^^^^^^^^^^ note: required by a bound in `assert_kl` --> tests/ui-stable/mid_compile_pass.rs:23:26 | diff --git a/zerocopy-derive/tests/ui-stable/struct.stderr b/zerocopy-derive/tests/ui-stable/struct.stderr index 19a2ff6206..c8960738b5 100644 --- a/zerocopy-derive/tests/ui-stable/struct.stderr +++ b/zerocopy-derive/tests/ui-stable/struct.stderr @@ -78,16 +78,6 @@ error[E0277]: the trait bound `NotKnownLayoutDst: KnownLayout` is not satisfied 41 | #[derive(KnownLayout)] | ^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `NotKnownLayoutDst` | - = help: the following other types implement trait `KnownLayout`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -97,16 +87,6 @@ error[E0277]: the trait bound `NotKnownLayout: KnownLayout` is not satisfied 47 | #[derive(KnownLayout)] | ^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `NotKnownLayout` | - = help: the following other types implement trait `KnownLayout`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -116,16 +96,6 @@ error[E0277]: the trait bound `UnsafeCell<()>: NoCell` is not satisfied 55 | #[derive(NoCell)] | ^^^^^^ the trait `NoCell` is not implemented for `UnsafeCell<()>` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `NoCell` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -135,17 +105,7 @@ error[E0277]: the trait bound `UnsafeCell: NoCell` is not satisfied 60 | #[derive(NoCell)] | ^^^^^^ the trait `NoCell` is not implemented for `UnsafeCell` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others - = note: required for `[UnsafeCell; 0]` to implement `NoCell` + = note: required because of the requirements on the impl of `NoCell` for `[UnsafeCell; 0]` = help: see issue #48214 = note: this error originates in the derive macro `NoCell` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -155,7 +115,8 @@ error[E0277]: the trait bound `HasPadding: ShouldBe` is 101 | #[derive(IntoBytes)] | ^^^^^^^^^ the trait `ShouldBe` is not implemented for `HasPadding` | - = help: the trait `ShouldBe` is implemented for `HasPadding` + = help: the following implementations were found: + as ShouldBe> = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -165,60 +126,7 @@ error[E0277]: the trait bound `HasPadding: ShouldBe` is 108 | #[derive(IntoBytes)] | ^^^^^^^^^ the trait `ShouldBe` is not implemented for `HasPadding` | - = help: the trait `ShouldBe` is implemented for `HasPadding` + = help: the following implementations were found: + as ShouldBe> = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type - --> tests/ui-stable/struct.rs:71:1 - | -71 | struct TryFromBytesPacked { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: `AU16` has a `#[repr(align)]` attribute - --> tests/ui-stable/../util.rs - | - | pub struct AU16(u16); - | ^^^^^^^^^^^^^^^ - -error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type - --> tests/ui-stable/struct.rs:77:1 - | -77 | struct TryFromBytesPackedN { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: `AU16` has a `#[repr(align)]` attribute - --> tests/ui-stable/../util.rs - | - | pub struct AU16(u16); - | ^^^^^^^^^^^^^^^ - -error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type - --> tests/ui-stable/struct.rs:83:1 - | -83 | struct TryFromBytesCPacked { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: `AU16` has a `#[repr(align)]` attribute - --> tests/ui-stable/../util.rs - | - | pub struct AU16(u16); - | ^^^^^^^^^^^^^^^ - -error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type - --> tests/ui-stable/struct.rs:89:1 - | -89 | struct TryFromBytesCPackedN { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: `AU16` has a `#[repr(align)]` attribute - --> tests/ui-stable/../util.rs - | - | pub struct AU16(u16); - | ^^^^^^^^^^^^^^^ - -error[E0587]: type has conflicting packed and align representation hints - --> tests/ui-stable/struct.rs:133:1 - | -133 | struct Unaligned3; - | ^^^^^^^^^^^^^^^^^ diff --git a/zerocopy-derive/tests/ui-stable/union.stderr b/zerocopy-derive/tests/ui-stable/union.stderr index 24b425452e..6cb4de4e7f 100644 --- a/zerocopy-derive/tests/ui-stable/union.stderr +++ b/zerocopy-derive/tests/ui-stable/union.stderr @@ -36,17 +36,7 @@ error[E0277]: the trait bound `UnsafeCell<()>: NoCell` is not satisfied 24 | #[derive(NoCell)] | ^^^^^^ the trait `NoCell` is not implemented for `UnsafeCell<()>` | - = help: the following other types implement trait `NoCell`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others - = note: required for `ManuallyDrop>` to implement `NoCell` + = note: required because of the requirements on the impl of `NoCell` for `ManuallyDrop>` = help: see issue #48214 = note: this error originates in the derive macro `NoCell` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -56,12 +46,7 @@ error[E0277]: the trait bound `HasPadding: ShouldBe` is 39 | #[derive(IntoBytes)] | ^^^^^^^^^ the trait `ShouldBe` is not implemented for `HasPadding` | - = help: the trait `ShouldBe` is implemented for `HasPadding` + = help: the following implementations were found: + as ShouldBe> = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0587]: type has conflicting packed and align representation hints - --> tests/ui-stable/union.rs:68:1 - | -68 | union Unaligned3 { - | ^^^^^^^^^^^^^^^^