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

@ -699,7 +699,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
) {
if let Rvalue::Use(Operand::Constant(c)) = rval {
match c.literal {
ConstantKind::Ty(c) if matches!(c.val(), ConstKind::Unevaluated(..)) => {}
ConstantKind::Ty(c) if matches!(c.kind(), ConstKind::Unevaluated(..)) => {}
_ => {
trace!("skipping replace of Rvalue::Use({:?} because it is already a const", c);
return;
@ -773,7 +773,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
.tcx
.mk_const(ty::ConstS {
ty,
val: ty::ConstKind::Value(ConstValue::ByRef {
kind: ty::ConstKind::Value(ConstValue::ByRef {
alloc,
offset: Size::ZERO,
}),