rustc_hir_analysis: fix generics_of ICE on unresolved const arguments#148843
rustc_hir_analysis: fix generics_of ICE on unresolved const arguments#148843InvalidPathException wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
r? @davidtwco rustbot has assigned @davidtwco. Use |
|
r? BoxyUwU |
|
As far as I can tell this ICE has nothing to due with defaulted const args, this ICEs too: #![feature(min_generic_const_args)]
#![feature(generic_const_exprs)]
struct Both {
a: A<{ B::<1>::M }>,
}I think what's actually going on here is that Given that this is a GCE-only bug I'm not too interested in this being fixed. I also think this will probably wind up being indirectly fixed in the long term by fixing the "root" cause of having extra With that in mind gonna close this PR. Thanks for making the PR and showing interest in const generics :) This solution does look reasonable for trying to make GCE work properly in this case. |
Fixes #148838
Root cause:
generics_ofcurrently does not handlehir::Node::ConstArgso defaulted const args nested inside const paths try to inherit generics from the wrong place and trigger ICE.Symptom:
#148838 ICE
Fix
Handle
Node::ConstArg, in fact, similar logic already exists although it is in another branch and slightly more complex, not sure if there is a more elegant way:rust/compiler/rustc_hir_analysis/src/collect/generics_of.rs
Lines 76 to 90 in 2636cb4
Testing:
1 more test case
const-arg-unresolved.rs