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

@ -1148,9 +1148,9 @@ impl<'tcx> TypeSuperFoldable<'tcx> for ty::Const<'tcx> {
folder: &mut F,
) -> Result<Self, F::Error> {
let ty = self.ty().try_fold_with(folder)?;
let val = self.val().try_fold_with(folder)?;
if ty != self.ty() || val != self.val() {
Ok(folder.tcx().mk_const(ty::ConstS { ty, val }))
let kind = self.kind().try_fold_with(folder)?;
if ty != self.ty() || kind != self.kind() {
Ok(folder.tcx().mk_const(ty::ConstS { ty, kind }))
} else {
Ok(self)
}
@ -1158,7 +1158,7 @@ impl<'tcx> TypeSuperFoldable<'tcx> for ty::Const<'tcx> {
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
self.ty().visit_with(visitor)?;
self.val().visit_with(visitor)
self.kind().visit_with(visitor)
}
}