From 93e4b6ef06888085dc60d073ca9d66f2d7282112 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 10 Jun 2022 11:18:06 +1000 Subject: 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. --- compiler/rustc_monomorphize/src/collector.rs | 4 ++-- compiler/rustc_monomorphize/src/polymorphize.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_monomorphize/src') diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index a9ca8921797..dfaf464587b 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -756,7 +756,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { let literal = self.monomorphize(constant.literal); let val = match literal { mir::ConstantKind::Val(val, _) => val, - mir::ConstantKind::Ty(ct) => match ct.val() { + mir::ConstantKind::Ty(ct) => match ct.kind() { ty::ConstKind::Value(val) => val, ty::ConstKind::Unevaluated(ct) => { let param_env = ty::ParamEnv::reveal_all(); @@ -784,7 +784,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { let substituted_constant = self.monomorphize(constant); let param_env = ty::ParamEnv::reveal_all(); - match substituted_constant.val() { + match substituted_constant.kind() { ty::ConstKind::Value(val) => collect_const_value(self.tcx, val, self.output), ty::ConstKind::Unevaluated(unevaluated) => { match self.tcx.const_eval_resolve(param_env, unevaluated, None) { diff --git a/compiler/rustc_monomorphize/src/polymorphize.rs b/compiler/rustc_monomorphize/src/polymorphize.rs index dc1f1c9927d..f29143b4480 100644 --- a/compiler/rustc_monomorphize/src/polymorphize.rs +++ b/compiler/rustc_monomorphize/src/polymorphize.rs @@ -283,7 +283,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> { return ControlFlow::CONTINUE; } - match c.val() { + match c.kind() { ty::ConstKind::Param(param) => { debug!(?param); self.unused_parameters.clear(param.index); @@ -353,7 +353,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for HasUsedGenericParams<'a> { return ControlFlow::CONTINUE; } - match c.val() { + match c.kind() { ty::ConstKind::Param(param) => { if self.unused_parameters.contains(param.index).unwrap_or(false) { ControlFlow::CONTINUE -- cgit 1.4.1-3-g733a5