From 730e2bae94c9bd4a6868d1f926bf345a2c342911 Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Thu, 9 May 2024 14:25:49 -0700 Subject: [PATCH] Remove Immutable where it's no longer needed (#1225) * Add `AliasingSafe` framework This commit adds the `pointer::aliasing_safety::AliasingSafe` trait, which is implemented for pointer conversions which do not violate aliasing. This can happen either because the aliasing is exclusive or because neither type contains `UnsafeCell`s. This paves the way for us to remove `Immutable` bounds from some of our API, including from some derives. Makes progress on #251 Co-authored-by: Jack Wrenn * Remove `Immutable` where it's no longer needed There are some APIs which still spuriously require `Immutable`, but which require more work to update. These will be fixed in a separate commit. Makes progress on #251 Co-authored-by: Jack Wrenn --------- Co-authored-by: Jack Wrenn --- src/lib.rs | 33 ++++--------- src/macro_util.rs | 7 +-- src/ref.rs | 5 +- .../transmute-mut-dst-not-a-reference.stderr | 10 ---- tests/ui-msrv/transmute-mut-dst-not-nocell.rs | 1 - .../transmute-mut-dst-not-nocell.stderr | 12 ----- tests/ui-msrv/transmute-mut-src-not-nocell.rs | 1 - .../transmute-mut-src-not-nocell.stderr | 25 ---------- .../transmute-mut-dst-not-a-reference.stderr | 10 ---- .../transmute-mut-dst-not-nocell.rs | 24 ---------- .../transmute-mut-dst-not-nocell.stderr | 25 ---------- .../transmute-mut-src-not-nocell.rs | 24 ---------- .../transmute-mut-src-not-nocell.stderr | 48 ------------------- .../transmute-mut-dst-not-a-reference.stderr | 10 ---- .../ui-stable/transmute-mut-dst-not-nocell.rs | 1 - .../transmute-mut-dst-not-nocell.stderr | 25 ---------- .../ui-stable/transmute-mut-src-not-nocell.rs | 1 - .../transmute-mut-src-not-nocell.stderr | 48 ------------------- 18 files changed, 16 insertions(+), 294 deletions(-) delete mode 120000 tests/ui-msrv/transmute-mut-dst-not-nocell.rs delete mode 100644 tests/ui-msrv/transmute-mut-dst-not-nocell.stderr delete mode 120000 tests/ui-msrv/transmute-mut-src-not-nocell.rs delete mode 100644 tests/ui-msrv/transmute-mut-src-not-nocell.stderr delete mode 100644 tests/ui-nightly/transmute-mut-dst-not-nocell.rs delete mode 100644 tests/ui-nightly/transmute-mut-dst-not-nocell.stderr delete mode 100644 tests/ui-nightly/transmute-mut-src-not-nocell.rs delete mode 100644 tests/ui-nightly/transmute-mut-src-not-nocell.stderr delete mode 120000 tests/ui-stable/transmute-mut-dst-not-nocell.rs delete mode 100644 tests/ui-stable/transmute-mut-dst-not-nocell.stderr delete mode 120000 tests/ui-stable/transmute-mut-src-not-nocell.rs delete mode 100644 tests/ui-stable/transmute-mut-src-not-nocell.stderr diff --git a/src/lib.rs b/src/lib.rs index f88051b316..1b2096368c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1427,7 +1427,7 @@ pub unsafe trait TryFromBytes { #[inline] fn try_mut_from(bytes: &mut [u8]) -> Result<&mut Self, TryCastError<&mut [u8], Self>> where - Self: KnownLayout + Immutable, // TODO(#251): Remove the `Immutable` bound. + Self: KnownLayout, { util::assert_dst_is_not_zst::(); match Ptr::from_mut(bytes).try_cast_into_no_leftover::() { @@ -1532,7 +1532,7 @@ pub unsafe trait TryFromBytes { candidate: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), TryCastError<&mut [u8], Self>> where - Self: KnownLayout + Immutable, + Self: KnownLayout, { util::assert_dst_is_not_zst::(); try_mut_from_prefix_suffix(candidate, CastType::Prefix) @@ -1619,7 +1619,7 @@ pub unsafe trait TryFromBytes { candidate: &mut [u8], ) -> Result<(&mut [u8], &mut Self), TryCastError<&mut [u8], Self>> where - Self: KnownLayout + Immutable, + Self: KnownLayout, { util::assert_dst_is_not_zst::(); try_mut_from_prefix_suffix(candidate, CastType::Suffix).map(swap) @@ -2535,7 +2535,7 @@ pub unsafe trait FromBytes: FromZeros { #[inline] fn mut_from(bytes: &mut [u8]) -> Result<&mut Self, CastError<&mut [u8], Self>> where - Self: IntoBytes + KnownLayout + Immutable, + Self: IntoBytes + KnownLayout, { util::assert_dst_is_not_zst::(); match Ptr::from_mut(bytes).try_cast_into_no_leftover::<_, BecauseExclusive>() { @@ -2610,7 +2610,7 @@ pub unsafe trait FromBytes: FromZeros { bytes: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), CastError<&mut [u8], Self>> where - Self: IntoBytes + KnownLayout + Immutable, + Self: IntoBytes + KnownLayout, { util::assert_dst_is_not_zst::(); let (slf, suffix) = Ptr::from_mut(bytes) @@ -2679,7 +2679,7 @@ pub unsafe trait FromBytes: FromZeros { bytes: &mut [u8], ) -> Result<(&mut [u8], &mut Self), CastError<&mut [u8], Self>> where - Self: IntoBytes + KnownLayout + Immutable, + Self: IntoBytes + KnownLayout, { util::assert_dst_is_not_zst::(); let (slf, prefix) = Ptr::from_mut(bytes) @@ -3483,7 +3483,7 @@ pub unsafe trait IntoBytes { #[inline(always)] fn as_mut_bytes(&mut self) -> &mut [u8] where - Self: FromBytes + Immutable, + Self: FromBytes, { // Note that this method does not have a `Self: Sized` bound; // `size_of_val` works for unsized values too. @@ -3718,7 +3718,7 @@ pub unsafe trait IntoBytes { #[inline] fn as_bytes_mut(&mut self) -> &mut [u8] where - Self: FromBytes + Immutable, + Self: FromBytes, { self.as_mut_bytes() } @@ -5076,20 +5076,16 @@ macro_rules! transmute_mut { struct AssertSrcIsSized<'a, T: ::core::marker::Sized>(&'a T); struct AssertSrcIsFromBytes<'a, T: ?::core::marker::Sized + $crate::FromBytes>(&'a T); struct AssertSrcIsIntoBytes<'a, T: ?::core::marker::Sized + $crate::IntoBytes>(&'a T); - struct AssertSrcIsImmutable<'a, T: ?::core::marker::Sized + $crate::Immutable>(&'a T); struct AssertDstIsSized<'a, T: ::core::marker::Sized>(&'a T); struct AssertDstIsFromBytes<'a, T: ?::core::marker::Sized + $crate::FromBytes>(&'a T); struct AssertDstIsIntoBytes<'a, T: ?::core::marker::Sized + $crate::IntoBytes>(&'a T); - struct AssertDstIsImmutable<'a, T: ?::core::marker::Sized + $crate::Immutable>(&'a T); if true { let _ = AssertSrcIsSized(&*e); } else if true { let _ = AssertSrcIsFromBytes(&*e); - } else if true { - let _ = AssertSrcIsIntoBytes(&*e); } else { - let _ = AssertSrcIsImmutable(&*e); + let _ = AssertSrcIsIntoBytes(&*e); } if true { @@ -5100,13 +5096,9 @@ macro_rules! transmute_mut { #[allow(unused, unreachable_code)] let u = AssertDstIsFromBytes(loop {}); &mut *u.0 - } else if true { - #[allow(unused, unreachable_code)] - let u = AssertDstIsIntoBytes(loop {}); - &mut *u.0 } else { #[allow(unused, unreachable_code)] - let u = AssertDstIsImmutable(loop {}); + let u = AssertDstIsIntoBytes(loop {}); &mut *u.0 } } else if false { @@ -5129,11 +5121,6 @@ macro_rules! transmute_mut { &mut u } else { // SAFETY: For source type `Src` and destination type `Dst`: - // - We know that `Src: FromBytes + IntoBytes + Immutable` and `Dst: - // FromBytes + IntoBytes + Immutable` thanks to the uses of - // `AssertSrcIsFromBytes`, `AssertSrcIsIntoBytes`, - // `AssertSrcIsImmutable`, `AssertDstIsFromBytes`, - // `AssertDstIsIntoBytes`, and `AssertDstIsImmutable` above. // - We know that `size_of::() == size_of::()` thanks to // the use of `assert_size_eq!` above. // - We know that `align_of::() >= align_of::()` thanks to diff --git a/src/macro_util.rs b/src/macro_util.rs index defeb2c1a1..fca70be7a4 100644 --- a/src/macro_util.rs +++ b/src/macro_util.rs @@ -386,8 +386,8 @@ pub const unsafe fn transmute_ref<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( /// # Safety /// /// The caller must guarantee that: -/// - `Src: FromBytes + IntoBytes + Immutable` -/// - `Dst: FromBytes + IntoBytes + Immutable` +/// - `Src: FromBytes + IntoBytes` +/// - `Dst: FromBytes + IntoBytes` /// - `size_of::() == size_of::()` /// - `align_of::() >= align_of::()` // TODO(#686): Consider removing the `Immutable` requirement. @@ -403,9 +403,6 @@ pub unsafe fn transmute_mut<'dst, 'src: 'dst, Src: 'src, Dst: 'dst>( // vice-versa because the caller has guaranteed that `Src: FromBytes + // IntoBytes`, `Dst: FromBytes + IntoBytes`, and `size_of::() == // size_of::()`. - // - We know that there are no `UnsafeCell`s, and thus we don't have to - // worry about `UnsafeCell` overlap, because `Src: Immutable` - // and `Dst: Immutable`. // - The caller has guaranteed that alignment is not increased. // - We know that the returned lifetime will not outlive the input lifetime // thanks to the lifetime bounds on this function. diff --git a/src/ref.rs b/src/ref.rs index 55652a96c2..23bf962d62 100644 --- a/src/ref.rs +++ b/src/ref.rs @@ -677,7 +677,7 @@ where impl<'a, B, T> Ref where B: 'a + IntoByteSliceMut<'a>, - T: FromBytes + IntoBytes + KnownLayout + Immutable + ?Sized, + T: FromBytes + IntoBytes + KnownLayout + ?Sized, { /// Converts this `Ref` into a mutable reference. /// @@ -802,6 +802,9 @@ where impl DerefMut for Ref where B: ByteSliceMut, + // TODO(#251): We can't remove `Immutable` here because it's required by + // the impl of `Deref`, which is a super-trait of `DerefMut`. Maybe we can + // add a separate inherent method for this? T: FromBytes + IntoBytes + KnownLayout + Immutable + ?Sized, { #[inline] diff --git a/tests/ui-msrv/transmute-mut-dst-not-a-reference.stderr b/tests/ui-msrv/transmute-mut-dst-not-a-reference.stderr index cb4e4568c0..eaff00fd27 100644 --- a/tests/ui-msrv/transmute-mut-dst-not-a-reference.stderr +++ b/tests/ui-msrv/transmute-mut-dst-not-a-reference.stderr @@ -47,13 +47,3 @@ error[E0308]: mismatched types = note: expected type `usize` found mutable reference `&mut _` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0308]: mismatched types - --> tests/ui-msrv/transmute-mut-dst-not-a-reference.rs:17:36 - | -17 | const DST_NOT_A_REFERENCE: usize = transmute_mut!(&mut 0u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&mut _` - | - = note: expected type `usize` - found mutable reference `&mut _` - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-msrv/transmute-mut-dst-not-nocell.rs b/tests/ui-msrv/transmute-mut-dst-not-nocell.rs deleted file mode 120000 index a1c5d17685..0000000000 --- a/tests/ui-msrv/transmute-mut-dst-not-nocell.rs +++ /dev/null @@ -1 +0,0 @@ -../ui-nightly/transmute-mut-dst-not-nocell.rs \ No newline at end of file diff --git a/tests/ui-msrv/transmute-mut-dst-not-nocell.stderr b/tests/ui-msrv/transmute-mut-dst-not-nocell.stderr deleted file mode 100644 index eecfa3089f..0000000000 --- a/tests/ui-msrv/transmute-mut-dst-not-nocell.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0277]: the trait bound `Dst: Immutable` is not satisfied - --> tests/ui-msrv/transmute-mut-dst-not-nocell.rs:24:37 - | -24 | const DST_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `Dst` - | -note: required by `AssertDstIsImmutable` - --> tests/ui-msrv/transmute-mut-dst-not-nocell.rs:24:37 - | -24 | const DST_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - = 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-msrv/transmute-mut-src-not-nocell.rs b/tests/ui-msrv/transmute-mut-src-not-nocell.rs deleted file mode 120000 index e3c21b3763..0000000000 --- a/tests/ui-msrv/transmute-mut-src-not-nocell.rs +++ /dev/null @@ -1 +0,0 @@ -../ui-nightly/transmute-mut-src-not-nocell.rs \ No newline at end of file diff --git a/tests/ui-msrv/transmute-mut-src-not-nocell.stderr b/tests/ui-msrv/transmute-mut-src-not-nocell.stderr deleted file mode 100644 index 1a877a29a5..0000000000 --- a/tests/ui-msrv/transmute-mut-src-not-nocell.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: the trait bound `Src: Immutable` is not satisfied - --> tests/ui-msrv/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `Src` - | -note: required by `AssertSrcIsImmutable` - --> tests/ui-msrv/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - = 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: Immutable` is not satisfied - --> tests/ui-msrv/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `Src` - | -note: required by a bound in `AssertSrcIsImmutable` - --> tests/ui-msrv/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsImmutable` - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-nightly/transmute-mut-dst-not-a-reference.stderr b/tests/ui-nightly/transmute-mut-dst-not-a-reference.stderr index 739a62624f..013414b725 100644 --- a/tests/ui-nightly/transmute-mut-dst-not-a-reference.stderr +++ b/tests/ui-nightly/transmute-mut-dst-not-a-reference.stderr @@ -38,16 +38,6 @@ error[E0308]: mismatched types found mutable reference `&mut _` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0308]: mismatched types - --> tests/ui-nightly/transmute-mut-dst-not-a-reference.rs:17:36 - | -17 | const DST_NOT_A_REFERENCE: usize = transmute_mut!(&mut 0u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&mut _` - | - = note: expected type `usize` - found mutable reference `&mut _` - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0308]: mismatched types --> tests/ui-nightly/transmute-mut-dst-not-a-reference.rs:17:36 | diff --git a/tests/ui-nightly/transmute-mut-dst-not-nocell.rs b/tests/ui-nightly/transmute-mut-dst-not-nocell.rs deleted file mode 100644 index 854a6d7e15..0000000000 --- a/tests/ui-nightly/transmute-mut-dst-not-nocell.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Fuchsia Authors -// -// Licensed under a BSD-style license , Apache License, Version 2.0 -// , or the MIT -// license , at your option. -// This file may not be copied, modified, or distributed except according to -// those terms. - -extern crate zerocopy; - -use zerocopy::transmute_mut; - -fn main() {} - -#[derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::Immutable)] -#[repr(C)] -struct Src; - -#[derive(zerocopy::FromBytes, zerocopy::IntoBytes)] -#[repr(C)] -struct Dst; - -// `transmute_mut` requires that the destination type implements `Immutable` -const DST_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); diff --git a/tests/ui-nightly/transmute-mut-dst-not-nocell.stderr b/tests/ui-nightly/transmute-mut-dst-not-nocell.stderr deleted file mode 100644 index 6bc8904be7..0000000000 --- a/tests/ui-nightly/transmute-mut-dst-not-nocell.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: the trait bound `Dst: Immutable` is not satisfied - --> tests/ui-nightly/transmute-mut-dst-not-nocell.rs:24:37 - | -24 | const DST_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `Immutable` is not implemented for `Dst` - | required by a bound introduced by this call - | - = help: the following other types implement trait `Immutable`: - &T - &mut T - () - *const T - *mut T - Box - F32 - F64 - and $N others -note: required by a bound in `AssertDstIsImmutable` - --> tests/ui-nightly/transmute-mut-dst-not-nocell.rs:24:37 - | -24 | const DST_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsImmutable` - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-nightly/transmute-mut-src-not-nocell.rs b/tests/ui-nightly/transmute-mut-src-not-nocell.rs deleted file mode 100644 index 1234ee754a..0000000000 --- a/tests/ui-nightly/transmute-mut-src-not-nocell.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Fuchsia Authors -// -// Licensed under a BSD-style license , Apache License, Version 2.0 -// , or the MIT -// license , at your option. -// This file may not be copied, modified, or distributed except according to -// those terms. - -extern crate zerocopy; - -use zerocopy::transmute_mut; - -fn main() {} - -#[derive(zerocopy::FromBytes, zerocopy::IntoBytes)] -#[repr(C)] -struct Src; - -#[derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::Immutable)] -#[repr(C)] -struct Dst; - -// `transmute_mut` requires that the source type implements `Immutable` -const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); diff --git a/tests/ui-nightly/transmute-mut-src-not-nocell.stderr b/tests/ui-nightly/transmute-mut-src-not-nocell.stderr deleted file mode 100644 index 2a7116e79e..0000000000 --- a/tests/ui-nightly/transmute-mut-src-not-nocell.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error[E0277]: the trait bound `Src: Immutable` is not satisfied - --> tests/ui-nightly/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `Immutable` is not implemented for `Src` - | required by a bound introduced by this call - | - = help: the following other types implement trait `Immutable`: - &T - &mut T - () - *const T - *mut T - Box - Dst - F32 - and $N others -note: required by a bound in `AssertSrcIsImmutable` - --> tests/ui-nightly/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsImmutable` - = 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: Immutable` is not satisfied - --> tests/ui-nightly/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `Src` - | - = help: the following other types implement trait `Immutable`: - &T - &mut T - () - *const T - *mut T - Box - Dst - F32 - and $N others -note: required by a bound in `AssertSrcIsImmutable` - --> tests/ui-nightly/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsImmutable` - = 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-a-reference.stderr b/tests/ui-stable/transmute-mut-dst-not-a-reference.stderr index 092013cce8..3c18d60934 100644 --- a/tests/ui-stable/transmute-mut-dst-not-a-reference.stderr +++ b/tests/ui-stable/transmute-mut-dst-not-a-reference.stderr @@ -38,16 +38,6 @@ error[E0308]: mismatched types found mutable reference `&mut _` = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0308]: mismatched types - --> tests/ui-stable/transmute-mut-dst-not-a-reference.rs:17:36 - | -17 | const DST_NOT_A_REFERENCE: usize = transmute_mut!(&mut 0u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&mut _` - | - = note: expected type `usize` - found mutable reference `&mut _` - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0308]: mismatched types --> tests/ui-stable/transmute-mut-dst-not-a-reference.rs:17:36 | diff --git a/tests/ui-stable/transmute-mut-dst-not-nocell.rs b/tests/ui-stable/transmute-mut-dst-not-nocell.rs deleted file mode 120000 index a1c5d17685..0000000000 --- a/tests/ui-stable/transmute-mut-dst-not-nocell.rs +++ /dev/null @@ -1 +0,0 @@ -../ui-nightly/transmute-mut-dst-not-nocell.rs \ No newline at end of file diff --git a/tests/ui-stable/transmute-mut-dst-not-nocell.stderr b/tests/ui-stable/transmute-mut-dst-not-nocell.stderr deleted file mode 100644 index 9c750e3718..0000000000 --- a/tests/ui-stable/transmute-mut-dst-not-nocell.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: the trait bound `Dst: Immutable` is not satisfied - --> tests/ui-stable/transmute-mut-dst-not-nocell.rs:24:37 - | -24 | const DST_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `Immutable` is not implemented for `Dst` - | required by a bound introduced by this call - | - = help: the following other types implement trait `Immutable`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertDstIsImmutable` - --> tests/ui-stable/transmute-mut-dst-not-nocell.rs:24:37 - | -24 | const DST_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertDstIsImmutable` - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-stable/transmute-mut-src-not-nocell.rs b/tests/ui-stable/transmute-mut-src-not-nocell.rs deleted file mode 120000 index e3c21b3763..0000000000 --- a/tests/ui-stable/transmute-mut-src-not-nocell.rs +++ /dev/null @@ -1 +0,0 @@ -../ui-nightly/transmute-mut-src-not-nocell.rs \ No newline at end of file diff --git a/tests/ui-stable/transmute-mut-src-not-nocell.stderr b/tests/ui-stable/transmute-mut-src-not-nocell.stderr deleted file mode 100644 index 5d8b89e38d..0000000000 --- a/tests/ui-stable/transmute-mut-src-not-nocell.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error[E0277]: the trait bound `Src: Immutable` is not satisfied - --> tests/ui-stable/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `Immutable` is not implemented for `Src` - | required by a bound introduced by this call - | - = help: the following other types implement trait `Immutable`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertSrcIsImmutable` - --> tests/ui-stable/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsImmutable` - = 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: Immutable` is not satisfied - --> tests/ui-stable/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Immutable` is not implemented for `Src` - | - = help: the following other types implement trait `Immutable`: - bool - char - isize - i8 - i16 - i32 - i64 - i128 - and $N others -note: required by a bound in `AssertSrcIsImmutable` - --> tests/ui-stable/transmute-mut-src-not-nocell.rs:24:37 - | -24 | const SRC_NOT_IMMUTABLE: &mut Dst = transmute_mut!(&mut Src); - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsImmutable` - = note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)