1
Fork 0

Allow struct field default values to reference struct's generics

This commit is contained in:
Michael Goulet 2025-03-03 05:25:46 +00:00
parent e16a049adb
commit 3e5fddc95e
8 changed files with 112 additions and 19 deletions

View file

@ -187,6 +187,8 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
Some(parent_did)
}
Node::TyPat(_) => Some(parent_did),
// Field default values inherit the ADT's generics.
Node::Field(_) => Some(parent_did),
_ => None,
}
}