Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Crashes since 1.65.0.
WG-prioritization assigning priority (). label -I-prioritize +P-medium

Discussion:
rustc_transmute::Reason::DstIsTooBig => { format!("The size of `{src}` is smaller than the size of `{dst}`") } <ins> rustc_transmute::Reason::SrcSizeOverflow => { format!( "values of the type `{src}` are too big for the current architecture" ) } rustc_transmute::Reason::DstSizeOverflow => { format!( "values of the type `{dst}` are too big for the current architecture" ) } </ins> rustc_transmute::Reason::DstHasStricterAlignment { src_min_align, dst_min_align,

Unspecified, /// This error will be surfaced elsewhere by rustc, so don't surface it. UnknownLayout, <ins> /// Overflow size SizeOverflow, </ins> TypeError(ErrorGuaranteed), }

fn from(err: &LayoutError<'tcx>) -> Self { match err { LayoutError::Unknown(..) | LayoutError::ReferencesError(..) => Self::UnknownLayout, <ins> LayoutError::SizeOverflow(..) => Self::SizeOverflow, </ins> err => unimplemented!("{:?}", err), } }

SrcLayoutUnknown, /// The layout of dst is unknown DstLayoutUnknown, <ins> /// The size of src is overflow SrcSizeOverflow, /// The size of dst is overflow DstSizeOverflow, </ins> } #[cfg(feature = "rustc")]

(_, Err(Err::UnknownLayout)) => Answer::No(Reason::DstLayoutUnknown), (Err(Err::Unspecified), _) => Answer::No(Reason::SrcIsUnspecified), (_, Err(Err::Unspecified)) => Answer::No(Reason::DstIsUnspecified), <ins> (Err(Err::SizeOverflow), _) => Answer::No(Reason::SrcSizeOverflow), (_, Err(Err::SizeOverflow)) => Answer::No(Reason::DstSizeOverflow), </ins> (Ok(src), Ok(dst)) => { MaybeTransmutableQuery { src, dst, scope, assume, context }.answer() }

<ins> #![crate_type = "lib"] #![feature(transmutability)] mod assert { use std::mem::BikeshedIntrinsicFrom; struct Context; pub fn is_maybe_transmutable<Src, Dst>() where Dst: BikeshedIntrinsicFrom<Src, Context>, { } } fn main() { pub union Uninit { a: [u8; usize::MAX], } #[repr(C)] struct ExplicitlyPadded(Uninit); assert::is_maybe_transmutable::<(), ExplicitlyPadded>(); //~^ ERROR `()` cannot be safely transmuted into `ExplicitlyPadded` assert::is_maybe_transmutable::<ExplicitlyPadded, ()>(); //~^ ERROR `ExplicitlyPadded` cannot be safely transmuted into `()` } </ins>

<ins> error[E0277]: `()` cannot be safely transmuted into `ExplicitlyPadded` in the defining scope of `assert::Context` --> $DIR/issue-115402-overflow-size.rs:22:41 | LL |     assert::is_maybe_transmutable::<(), ExplicitlyPadded>(); |                                         ^^^^^^^^^^^^^^^^ values of the type `ExplicitlyPadded` are too big for the current architecture | note: required by a bound in `is_maybe_transmutable` --> $DIR/issue-115402-overflow-size.rs:9:14 | LL |     pub fn is_maybe_transmutable<Src, Dst>() |            --------------------- required by a bound in this function LL |     where LL |         Dst: BikeshedIntrinsicFrom<Src, Context>, |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/issue-115402-overflow-size.rs:25:55 | LL |     assert::is_maybe_transmutable::<ExplicitlyPadded, ()>(); |                                                       ^^ values of the type `ExplicitlyPadded` are too big for the current architecture | note: required by a bound in `is_maybe_transmutable` --> $DIR/issue-115402-overflow-size.rs:9:14 | LL |     pub fn is_maybe_transmutable<Src, Dst>() |            --------------------- required by a bound in this function LL |     where LL |         Dst: BikeshedIntrinsicFrom<Src, Context>, |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. </ins>