Change:
<!-- [31mICE[0m: Rustc '' 'thread 'rustc' panicked at 'not implemented: NormalizationFailure(Alias(Projection, AliasTy { args: [T/], defid: DefId(0:12 ~ a[cc78]::Aaa::Y), .. }), Type(Alias(Projection, AliasTy { args: [T/], defid: DefId(0:12 ~ a[cc78]::Aaa::Y), .. })))'', 'thread 'rustc' panicked at 'not implemented: NormalizationFailure(Alias(Projection, AliasTy { args: [T/], defid: DefId(0:12 ~ a[cc78]::Aaa::Y), .. }), Type(Alias(Projection, AliasTy { args: [T/], defid: DefId(0:12 ~ a[cc78]::Aaa::Y), .. })))'' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [checkwellformed] checking that is well-formed [checkmodtypewf] checking that types are well-formed in top-level module --<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
Regression in nightly-2024-08-22 seems to bisect to
Slightly more reduction:
(Note that this reduction should drop the feature gate, as this ICEs without the feature gate)
claim

Discussion:
span, "silent safe transmute error" ); } <ins> GetSafeTransmuteErrorAndReason::Default => { (err_msg, None) } </ins> GetSafeTransmuteErrorAndReason::Error { err_msg, safe_transmute_explanation,

) -> GetSafeTransmuteErrorAndReason { use rustc_transmute::Answer; <ins> // We don't assemble a transmutability candidate for types that are generic // and we should have ambiguity for types that still have non-region infer. if obligation.predicate.has_non_region_param() || obligation.has_non_region_infer() { return GetSafeTransmuteErrorAndReason::Default; } </ins> // Erase regions because layout code doesn't particularly care about regions. let trait_ref = self.tcx.erase_regions(self.tcx.instantiate_bound_regions_with_erased(trait_ref));

let dst = trait_ref.args.type_at(0); let src = trait_ref.args.type_at(1); let err_msg = format!("`{src}` cannot be safely transmuted into `{dst}`"); match rustc_transmute::TransmuteTypeEnv::new(self.infcx).is_transmutable(

enum GetSafeTransmuteErrorAndReason { Silent, <ins> Default, </ins> Error { err_msg: String, safe_transmute_explanation: Option<String> }, }

impl<'tcx> From<&LayoutError<'tcx>> for Err { fn from(err: &LayoutError<'tcx>) -> Self { match err { <del> LayoutError::Unknown(..) | LayoutError::ReferencesError(..) => Self::UnknownLayout, </del> <ins> LayoutError::Unknown(..) | LayoutError::ReferencesError(..) | LayoutError::NormalizationFailure(..) => Self::UnknownLayout, </ins> LayoutError::SizeOverflow(..) => Self::SizeOverflow, LayoutError::Cycle(err) => Self::TypeError(*err), <del> err => unimplemented!("{:?}", err), </del> } } }

<del> //@ known-bug: rust-lang/rust#125881 #![crate_type = "lib"] #![feature(transmutability)] #![feature(unboxed_closures,effects)] const fn test() -> impl std::mem::TransmuteFrom() { || {} } </del>

<del> //@ known-bug: rust-lang/rust#126377 #![feature(effects)] #![feature(generic_const_exprs)] mod assert { use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable< Src, Dst, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_SAFETY: bool, const ASSUME_VALIDITY: bool, >() where Dst: TransmuteFrom< Src, {  } >, {} } const fn from_options() -> Assume { #[repr(C)] struct Src; #[repr(C)] struct Dst; assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>(); } </del>

<del> //@ known-bug: #130413 #![feature(transmutability)] trait Aaa { type Y; } trait Bbb { type B: std::mem::TransmuteFrom<()>; } impl<T> Bbb for T where T: Aaa, { type B = T::Y; } </del>

<ins> #![crate_type = "lib"] #![feature(transmutability)] trait A { type AssocA; } trait B { type AssocB: std::mem::TransmuteFrom<()>; } impl<T> B for (T, u8) where T: A, { type AssocB = T::AssocA; //~ERROR: the trait bound `<T as A>::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not satisfied [E0277] } impl<T> B for (T, u16) where for<'a> &'a i32: A, { type AssocB = <&'static i32 as A>::AssocA; //~ERROR: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` } </ins>

<ins> error[E0277]: the trait bound `<T as A>::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not satisfied --> $DIR/assoc-bound.rs:16:19 | LL |     type AssocB = T::AssocA; |                   ^^^^^^^^^ the trait `TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `<T as A>::AssocA` | note: required by a bound in `B::AssocB` --> $DIR/assoc-bound.rs:9:18 | LL |     type AssocB: std::mem::TransmuteFrom<()>; |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `B::AssocB` help: consider further restricting the associated type | LL |     T: A, <T as A>::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` --> $DIR/assoc-bound.rs:24:19 | LL |     type AssocB = <&'static i32 as A>::AssocA; |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<&i32 as A>::AssocA` has an unknown layout | note: required by a bound in `B::AssocB` --> $DIR/assoc-bound.rs:9:18 | LL |     type AssocB: std::mem::TransmuteFrom<()>; |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `B::AssocB` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. </ins>