Add has_default to GenericParamDefKind::Const
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
This commit is contained in:
@@ -2221,7 +2221,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
let adt_def = self.adt_def(wrapper_def_id);
|
||||
let substs =
|
||||
InternalSubsts::for_item(self, wrapper_def_id, |param, substs| match param.kind {
|
||||
GenericParamDefKind::Lifetime | GenericParamDefKind::Const => bug!(),
|
||||
GenericParamDefKind::Lifetime | GenericParamDefKind::Const { .. } => bug!(),
|
||||
GenericParamDefKind::Type { has_default, .. } => {
|
||||
if param.index == 0 {
|
||||
ty_param.into()
|
||||
@@ -2416,7 +2416,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
self.mk_region(ty::ReEarlyBound(param.to_early_bound_region_data())).into()
|
||||
}
|
||||
GenericParamDefKind::Type { .. } => self.mk_ty_param(param.index, param.name).into(),
|
||||
GenericParamDefKind::Const => {
|
||||
GenericParamDefKind::Const { .. } => {
|
||||
self.mk_const_param(param.index, param.name, self.type_of(param.def_id)).into()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user