use ParamConst in ExprKind::ConstParam
This commit is contained in:
parent
e2496b3cf4
commit
9cd8bb0456
5 changed files with 14 additions and 14 deletions
|
@ -70,8 +70,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
|
||||
Constant { user_ty, span, literal }
|
||||
}
|
||||
ExprKind::ConstParam { literal, def_id: _ } => {
|
||||
let literal = ConstantKind::Ty(literal);
|
||||
ExprKind::ConstParam { param, def_id: _ } => {
|
||||
let const_param =
|
||||
tcx.mk_const(ty::ConstS { val: ty::ConstKind::Param(param), ty: expr.ty });
|
||||
let literal = ConstantKind::Ty(const_param);
|
||||
|
||||
Constant { user_ty: None, span, literal }
|
||||
}
|
||||
|
|
|
@ -869,15 +869,9 @@ impl<'tcx> Cx<'tcx> {
|
|||
let generics = self.tcx.generics_of(item_def_id);
|
||||
let index = generics.param_def_id_to_index[&def_id];
|
||||
let name = self.tcx.hir().name(hir_id);
|
||||
let val = ty::ConstKind::Param(ty::ParamConst::new(index, name));
|
||||
let param = ty::ParamConst::new(index, name);
|
||||
|
||||
ExprKind::ConstParam {
|
||||
literal: self.tcx.mk_const(ty::ConstS {
|
||||
val,
|
||||
ty: self.typeck_results().node_type(expr.hir_id),
|
||||
}),
|
||||
def_id,
|
||||
}
|
||||
ExprKind::ConstParam { param, def_id }
|
||||
}
|
||||
|
||||
Res::Def(DefKind::Const, def_id) | Res::Def(DefKind::AssocConst, def_id) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue