Fix lifetime parameters moving paramter defaults

This commit is contained in:
Lukas Wirth 2024-07-02 10:13:02 +02:00
parent 1b283db47f
commit 1a929d6485
5 changed files with 113 additions and 68 deletions

View file

@ -3602,9 +3602,9 @@ impl ConstParam {
}
fn generic_arg_from_param(db: &dyn HirDatabase, id: TypeOrConstParamId) -> Option<GenericArg> {
let params = db.generic_defaults(id.parent);
let local_idx = hir_ty::param_idx(db, id)?;
let ty = params.get(local_idx)?.clone();
let defaults = db.generic_defaults(id.parent);
let ty = defaults.get(local_idx)?.clone();
let subst = TyBuilder::placeholder_subst(db, id.parent);
Some(ty.substitute(Interner, &subst))
}