1
Fork 0

Setup ty::Const functions for ConstArg

This commit is contained in:
Noah Lev 2024-07-16 11:54:43 -07:00
parent 7d7be2f0f6
commit e7c85cb1e0
3 changed files with 86 additions and 44 deletions

View file

@ -470,13 +470,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
(&GenericParamDefKind::Type { has_default, .. }, GenericArg::Infer(inf)) => {
handle_ty_args(has_default, &inf.to_ty())
}
(GenericParamDefKind::Const { .. }, GenericArg::Const(ct)) => match &ct.kind {
hir::ConstArgKind::Anon(anon) => {
let did = anon.def_id;
tcx.feed_anon_const_type(did, tcx.type_of(param.def_id));
ty::Const::from_anon_const(tcx, did).into()
}
},
(GenericParamDefKind::Const { .. }, GenericArg::Const(ct)) => {
ty::Const::from_const_arg(tcx, ct, ty::FeedConstTy::Param(param.def_id))
.into()
}
(&GenericParamDefKind::Const { .. }, hir::GenericArg::Infer(inf)) => {
self.lowerer.ct_infer(Some(param), inf.span).into()
}