1
Fork 0

Rename the ConstS::val field as kind.

And likewise for the `Const::val` method.

Because its type is called `ConstKind`. Also `val` is a confusing name
because `ConstKind` is an enum with seven variants, one of which is
called `Value`. Also, this gives consistency with `TyS` and `PredicateS`
which have `kind` fields.

The commit also renames a few `Const` variables from `val` to `c`, to
avoid confusion with the `ConstKind::Value` variant.
This commit is contained in:
Nicholas Nethercote 2022-06-10 11:18:06 +10:00
parent ca122c7ebb
commit 93e4b6ef06
74 changed files with 173 additions and 169 deletions

View file

@ -15,7 +15,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let create_uneval_from_def_id =
|tcx: TyCtxt<'tcx>, def_id: DefId, ty: Ty<'tcx>, substs: SubstsRef<'tcx>| {
let uneval = ty::Unevaluated::new(ty::WithOptConstParam::unknown(def_id), substs);
tcx.mk_const(ty::ConstS { val: ty::ConstKind::Unevaluated(uneval), ty })
tcx.mk_const(ty::ConstS { kind: ty::ConstKind::Unevaluated(uneval), ty })
};
let this = self;
@ -64,7 +64,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
ExprKind::ConstParam { param, def_id: _ } => {
let const_param =
tcx.mk_const(ty::ConstS { val: ty::ConstKind::Param(param), ty: expr.ty });
tcx.mk_const(ty::ConstS { kind: ty::ConstKind::Param(param), ty: expr.ty });
let literal = ConstantKind::Ty(const_param);
Constant { user_ty: None, span, literal }