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

@ -141,7 +141,7 @@ impl<'tcx> TypeVisitor<'tcx> for MaxEscapingBoundVarVisitor {
}
fn visit_const(&mut self, ct: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
match ct.val() {
match ct.kind() {
ty::ConstKind::Bound(debruijn, _) if debruijn >= self.outer_index => {
self.escaping =
self.escaping.max(debruijn.as_usize() - self.outer_index.as_usize());
@ -337,7 +337,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
Ok(match constant {
mir::ConstantKind::Ty(c) => {
let const_folded = c.try_fold_with(self)?;
match const_folded.val() {
match const_folded.kind() {
ty::ConstKind::Value(cv) => {
// FIXME With Valtrees we need to convert `cv: ValTree`
// to a `ConstValue` here.