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. --./src/test/ui/impl- or ./src/test/ui/impl-trait/issues/issue- <!-- 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</detailscc I believe this might be caused by
I'll look into it regardless
I was unable to reproduce same error perhaps it already fixed on stable channel try updating your rust compiler onto stable channel
the nightly that contains suspicious commit has not been released yet, there is no point in trying to reproduce this with nightly (or even stable). You'll need something that contains
This is the same issue that I identified in , but the bug identified and fixed in actually caused it to not be triggered until now. The issue here is a "trivial bound" () causing us to not select but in the MIR inliner. The caching bug actually caused the latter branch to happen everywhere, so when that bug was fixed, we started to normalize to in some places, causing this ICE. I bet I could trigger an ICE with a slight modification to this code using the inliner even with reverted. This is probably only triggered by the inliner, but the MIR inliner isn't enabled without being explicitly provided, right?

Discussion:
<del> // compile-flags: -Zmir-opt-level=4 </del> <ins> // build-pass // compile-flags: -Zmir-opt-level=3 --crate-type=lib </ins> <del> pub fn bar<T>(s: &'static mut ()) </del> <ins> #![feature(trivial_bounds)] #![allow(trivial_bounds)] trait Foo { fn test(self); } fn baz<T>() </ins> where <del> &'static mut (): Clone, //~ ERROR the trait bound </del> <ins> &'static str: Foo, </ins> { <del> <&'static mut () as Clone>::clone(&s); </del> <ins> "Foo".test() </ins> } <del> fn main() {} </del>

<del> error[E0277]: the trait bound `&'static mut (): Clone` is not satisfied --> $DIR/issue-93008.rs:5:5 | LL |     &'static mut (): Clone, |     ^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&'static mut ()` | = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </del>

<ins> // check-pass fn main() { println!("{:?}", { type T = (); pub fn cloneit(it: &'_ mut T) -> (&'_ mut T, &'_ mut T) where for<'any> &'any mut T: Clone, { (it.clone(), it) } }); } </ins>

<ins> // check-pass trait Identity<Q> { type T; } impl<Q, T> Identity<Q> for T { type T = T; } trait Holds { type Q; } struct S; struct X(S); struct XHelper; impl Holds for X { type Q = XHelper; } impl<Q> Clone for X where <S as Identity<Q>>::T: Clone, X: Holds<Q = Q>, { fn clone(&self) -> Self { Self(self.0.clone()) } } fn main() {} </ins>

<ins> // build-pass // compile-flags:-Zmir-opt-level=3 struct D; trait Tr { type It; fn foo(self) -> Option<Self::It>; } impl<'a> Tr for &'a D { type It = (); fn foo(self) -> Option<()> { None } } fn run<F>(f: F) where for<'a> &'a D: Tr, F: Fn(<&D as Tr>::It), { let d = &D; while let Some(i) = d.foo() { f(i); } } fn main() { run(|_| {}); } </ins>

<ins> // known-bug // build-fail // failure-status: 101 // compile-flags:--crate-type=lib -Zmir-opt-level=3 // rustc-env:RUST_BACKTRACE=0 // normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked" // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*n" -> "" // normalize-stderr-test "error: internal compiler error.*" -> "error: internal compiler error" // normalize-stderr-test "encountered.*with incompatible types:" "encountered ... with incompatible types:" // normalize-stderr-test "note:.*unexpectedly panicked.*nn" -> "" // normalize-stderr-test "note: we would appreciate a bug report.*nn" -> "" // normalize-stderr-test "note: compiler flags.*nn" -> "" // normalize-stderr-test "note: rustc.*running on.*nn" -> "" // normalize-stderr-test "query stack during panic:n" -> "" // normalize-stderr-test "we're just showing a limited slice of the query stackn" -> "" // normalize-stderr-test "end of query stackn" -> "" // normalize-stderr-test "#.*n" -> "" // This is a known bug that @compiler-errors tried to fix in #94238, // but the solution was probably not correct. pub trait Factory<T> { type Item; } pub struct IntFactory; impl<T> Factory<T> for IntFactory { type Item = usize; } pub fn foo<T>() where IntFactory: Factory<T>, { let mut x: <IntFactory as Factory<T>>::Item = bar::<T>(); } #[inline] pub fn bar<T>() -> <IntFactory as Factory<T>>::Item { 0usize } </ins>

<ins> error: internal compiler error error: internal compiler error encountered ... with incompatible types: left-hand side has type: <IntFactory as Factory<T>>::Item right-hand side has type: usize --> $DIR/select-param-env-instead-of-blanket.rs:42:5 | LL |     let mut x: <IntFactory as Factory<T>>::Item = bar::<T>(); |                                                   ---------- in this inlined function call ... LL |     0usize |     ^^^^^^ | = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:128:36 thread 'rustc' panicked </ins>