Fix ICE in const param defaults with lifetime-dependent types by lapla-cogito · Pull Request #149254 · rust-lang/rust (original) (raw)

fixes #142913

The ICE happened because const_param_default instantiated the default expression using the const parameter’s own identity arguments, which are empty. When the default’s type referenced earlier generics, the subsequent instantiate call saw parameters but no arguments and panicked. In this PR, supplying the slice of the parent’s generic arguments up to the parameter being defaulted prevents that mismatch.