Rollup merge of #132912 - fmease:simplify-gen-param-default-users, r=compiler-errors

Simplify some places that deal with generic parameter defaults
This commit is contained in:
Matthias Krüger
2024-11-11 21:58:33 +01:00
committed by GitHub
4 changed files with 39 additions and 115 deletions

View File

@@ -86,10 +86,10 @@ impl GenericParamDef {
tcx: TyCtxt<'tcx>,
) -> Option<EarlyBinder<'tcx, ty::GenericArg<'tcx>>> {
match self.kind {
GenericParamDefKind::Type { has_default, .. } if has_default => {
GenericParamDefKind::Type { has_default: true, .. } => {
Some(tcx.type_of(self.def_id).map_bound(|t| t.into()))
}
GenericParamDefKind::Const { has_default, .. } if has_default => {
GenericParamDefKind::Const { has_default: true, .. } => {
Some(tcx.const_param_default(self.def_id).map_bound(|c| c.into()))
}
_ => None,