Change:
<ins> // This test demonstrates an ICE that may occur when we try to resolve the instance // of a impl that has different generics than the trait it's implementing. This ensures // we first check that the args are compatible before resolving the body, just like // we do in projection before substituting a GAT. // // When polymorphization is enabled, we check the optimized MIR for unused parameters. // This will invoke the inliner, leading to this ICE. //@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes trait Trait { fn foo<'a, K: 'a>(self, _: K); } impl Trait for () { #[inline] fn foo<K>(self, _: K) { //~^ ERROR lifetime parameters or bounds on method `foo` do not match the trait declaration todo!(); } } pub fn qux<T>() { ().foo(()); } fn main() {} </ins>

Discussion:
<!-- [31mICE[0m: Rustc '' 'error: internal compiler error: Unexpected parameter Type(()) when instantiating in region 'x (index=1)', 'error: internal compiler error: Unexpected parameter Type(()) when instantiating in region 'x (index=1)' 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: [fnabiofinstance] computing call ABI of [evaltoallocationraw] const-evaluating + checking [evaltoconstvalueraw] simplifying constant for the type system [analysis] running analysis passes on this crate --
Regression in cc
closing for whch has more up to date stacktrace :sweat_smile:

<!-- [31mICE[0m: Rustc '-Zpolymorphize=on --edition=2021 -Zinline-mir=yes -ooutputfile -Zdump-mir-dir=dir' 'error: internal compiler error: type parameter (impl AsRef<Path//0) out of range when instantiating, args=[]', 'error: internal compiler error: type parameter (impl AsRef<Path//0) out of range when instantiating, args=[]' File: --It appears that generic crash exprs are not even required :explodinghead: snippet: 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: [optimizedmir] optimizing MIR for [unusedgenericparams] determining which generic parameters are unused by [analysis] running analysis passes on this crate --
cc
sassy :P lol
probably the same issue:
Backtrace update rustc 1.80.0-nightly ( 2024-05-29) <details<summary<strongBacktrace</strong</summary<p</p</details- ICE location is moved from

<details<summaryfull stderr (including backtrace)</summary</details
Minimized:
update:

<!-- [31mICE[0m: Rustc '-Zpolymorphize=on -Zinline-mir=yes -ooutputfile -Zdump-mir-dir=dir' 'error: internal compiler error: expected type for (W//1) but found Lifetime(ReErased) when substituting, args=[(), ReErased, (), T/]', 'error: internal compiler error: expected type for (W//1) but found Lifetime(ReErased) when substituting, args=[(), ReErased, (), T/]' File: --auto-reduced (treereduce-rust): &lt;details&lt;summary&lt;strongoriginal code&lt;/strong&lt;/summary&lt;poriginal: </p</detailsVersion information Command: &lt;!-- Include a backtrace in the code block by setting in your environment. E.g. . --&lt;details&lt;summary&lt;strongProgram output&lt;/strong&lt;/summary&lt;p&lt;/p&lt;/details&lt;!-- query stack: [mircallgraphreachable] computing if (transitively) calls [optimizedmir] optimizing MIR for [unusedgenericparams] determining which generic parameters are unused by [analysis] running analysis passes on this crate --
&lt;!-- ICE: Rustc '-Zpolymorphize=on -Zinline-mir=yes -ooutputfile -Zdump-mir-dir=dir' 'error: internal compiler error: expected type for (K//0) but found Lifetime('{erased}) when instantiating, args=['{erased}, ()]', 'error: internal compiler error: expected type for (K//0) but found Lifetime('{erased}) when instantiating, args=['{erased}, ()]' 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: [optimizedmir] optimizing MIR for [unusedgenericparams] determining which generic parameters are unused by [analysis] running analysis passes on this crate --