mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-25 08:38:09 +00:00
Previously, `rustc_transmute`'s layout representations were genericized over `R`, a reference. Now, it's instead genericized over representations of type and region. This allows us to move reference transmutability logic from `rustc_trait_selection` to `rustc_transmutability` (and thus unit test it independently of the compiler), and — in a follow-up PR — will make it possible to support analyzing function pointer transmutability with minimal surgery.
64 lines
3.0 KiB
Plaintext
64 lines
3.0 KiB
Plaintext
error[E0277]: `&u8` cannot be safely transmuted into `&UnsafeCell<u8>`
|
|
--> $DIR/unsafecell.rs:27:50
|
|
|
|
|
LL | assert::is_maybe_transmutable::<&'static u8, &'static UnsafeCell<u8>>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Freeze` is not implemented for `UnsafeCell<u8>`
|
|
|
|
|
note: required by a bound in `is_maybe_transmutable`
|
|
--> $DIR/unsafecell.rs:12:14
|
|
|
|
|
LL | pub fn is_maybe_transmutable<Src, Dst>()
|
|
| --------------------- required by a bound in this function
|
|
LL | where
|
|
LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }>
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable`
|
|
|
|
error[E0277]: `&UnsafeCell<u8>` cannot be safely transmuted into `&UnsafeCell<u8>`
|
|
--> $DIR/unsafecell.rs:29:62
|
|
|
|
|
LL | assert::is_maybe_transmutable::<&'static UnsafeCell<u8>, &'static UnsafeCell<u8>>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Freeze` is not implemented for `UnsafeCell<u8>`
|
|
|
|
|
note: required by a bound in `is_maybe_transmutable`
|
|
--> $DIR/unsafecell.rs:12:14
|
|
|
|
|
LL | pub fn is_maybe_transmutable<Src, Dst>()
|
|
| --------------------- required by a bound in this function
|
|
LL | where
|
|
LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }>
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable`
|
|
|
|
error[E0277]: `&mut bool` cannot be safely transmuted into `&UnsafeCell<u8>`
|
|
--> $DIR/unsafecell.rs:45:56
|
|
|
|
|
LL | assert::is_maybe_transmutable::<&'static mut bool, &'static UnsafeCell<u8>>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Freeze` is not implemented for `UnsafeCell<u8>`
|
|
|
|
|
note: required by a bound in `is_maybe_transmutable`
|
|
--> $DIR/unsafecell.rs:12:14
|
|
|
|
|
LL | pub fn is_maybe_transmutable<Src, Dst>()
|
|
| --------------------- required by a bound in this function
|
|
LL | where
|
|
LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }>
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable`
|
|
|
|
error[E0277]: `&mut UnsafeCell<bool>` cannot be safely transmuted into `&UnsafeCell<u8>`
|
|
--> $DIR/unsafecell.rs:46:68
|
|
|
|
|
LL | assert::is_maybe_transmutable::<&'static mut UnsafeCell<bool>, &'static UnsafeCell<u8>>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Freeze` is not implemented for `UnsafeCell<u8>`
|
|
|
|
|
note: required by a bound in `is_maybe_transmutable`
|
|
--> $DIR/unsafecell.rs:12:14
|
|
|
|
|
LL | pub fn is_maybe_transmutable<Src, Dst>()
|
|
| --------------------- required by a bound in this function
|
|
LL | where
|
|
LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }>
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable`
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|