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

@ -450,7 +450,7 @@ impl<'tcx> TyCtxt<'tcx> {
// Error: not a type param
_ => false,
},
GenericArgKind::Const(ct) => match ct.val() {
GenericArgKind::Const(ct) => match ct.kind() {
ty::ConstKind::Param(ref pc) => {
!impl_generics.const_param(pc, self).pure_wrt_drop
}
@ -492,7 +492,7 @@ impl<'tcx> TyCtxt<'tcx> {
}
_ => return Err(NotUniqueParam::NotParam(t.into())),
},
GenericArgKind::Const(c) => match c.val() {
GenericArgKind::Const(c) => match c.kind() {
ty::ConstKind::Param(p) => {
if !seen.insert(p.index) {
return Err(NotUniqueParam::DuplicateParam(c.into()));
@ -1127,7 +1127,7 @@ pub fn needs_drop_components<'tcx>(
ty::Array(elem_ty, size) => {
match needs_drop_components(*elem_ty, target_layout) {
Ok(v) if v.is_empty() => Ok(v),
res => match size.val().try_to_bits(target_layout.pointer_size) {
res => match size.kind().try_to_bits(target_layout.pointer_size) {
// Arrays of size zero don't need drop, even if their element
// type does.
Some(0) => Ok(SmallVec::new()),