Skip to content

Commit ce2b3a9

Browse files
committed
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.
1 parent b867d41 commit ce2b3a9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ fn codegen_stmt<'tcx>(
710710
let times = fx
711711
.monomorphize(times)
712712
.eval(fx.tcx, ParamEnv::reveal_all())
713-
.val()
713+
.kind()
714714
.try_to_bits(fx.tcx.data_layout.pointer_size)
715715
.unwrap();
716716
if operand.layout().size.bytes() == 0 {

src/constant.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, '_>) -> bool {
4545
ConstantKind::Ty(ct) => ct,
4646
ConstantKind::Val(..) => continue,
4747
};
48-
match const_.val() {
48+
match const_.kind() {
4949
ConstKind::Value(_) => {}
5050
ConstKind::Unevaluated(unevaluated) => {
5151
if let Err(err) =
@@ -126,7 +126,7 @@ pub(crate) fn codegen_constant<'tcx>(
126126
ConstantKind::Ty(ct) => ct,
127127
ConstantKind::Val(val, ty) => return codegen_const_value(fx, val, ty),
128128
};
129-
let const_val = match const_.val() {
129+
let const_val = match const_.kind() {
130130
ConstKind::Value(const_val) => const_val,
131131
ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
132132
if fx.tcx.is_static(def.did) =>
@@ -469,7 +469,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
469469
match operand {
470470
Operand::Constant(const_) => match const_.literal {
471471
ConstantKind::Ty(const_) => {
472-
fx.monomorphize(const_).eval(fx.tcx, ParamEnv::reveal_all()).val().try_to_value()
472+
fx.monomorphize(const_).eval(fx.tcx, ParamEnv::reveal_all()).kind().try_to_value()
473473
}
474474
ConstantKind::Val(val, _) => Some(val),
475475
},

0 commit comments

Comments
 (0)