Rollup merge of #97935 - nnethercote:rename-ConstS-val-as-kind, r=lcnr
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. r? `@BoxyUwU`
This commit is contained in:
commit
9e5c5c57e9
74 changed files with 173 additions and 169 deletions
|
@ -180,7 +180,7 @@ fn push_debuginfo_type_name<'tcx>(
|
|||
if cpp_like_debuginfo {
|
||||
output.push_str("array$<");
|
||||
push_debuginfo_type_name(tcx, inner_type, true, output, visited);
|
||||
match len.val() {
|
||||
match len.kind() {
|
||||
ty::ConstKind::Param(param) => write!(output, ",{}>", param.name).unwrap(),
|
||||
_ => write!(output, ",{}>", len.eval_usize(tcx, ty::ParamEnv::reveal_all()))
|
||||
.unwrap(),
|
||||
|
@ -188,7 +188,7 @@ fn push_debuginfo_type_name<'tcx>(
|
|||
} else {
|
||||
output.push('[');
|
||||
push_debuginfo_type_name(tcx, inner_type, true, output, visited);
|
||||
match len.val() {
|
||||
match len.kind() {
|
||||
ty::ConstKind::Param(param) => write!(output, "; {}]", param.name).unwrap(),
|
||||
_ => write!(output, "; {}]", len.eval_usize(tcx, ty::ParamEnv::reveal_all()))
|
||||
.unwrap(),
|
||||
|
@ -679,7 +679,7 @@ fn push_generic_params_internal<'tcx>(
|
|||
}
|
||||
|
||||
fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, output: &mut String) {
|
||||
match ct.val() {
|
||||
match ct.kind() {
|
||||
ty::ConstKind::Param(param) => {
|
||||
write!(output, "{}", param.name)
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, output: &mut S
|
|||
// but we get a deterministic, virtually unique value for the constant.
|
||||
let hcx = &mut tcx.create_stable_hashing_context();
|
||||
let mut hasher = StableHasher::new();
|
||||
hcx.while_hashing_spans(false, |hcx| ct.val().hash_stable(hcx, &mut hasher));
|
||||
hcx.while_hashing_spans(false, |hcx| ct.kind().hash_stable(hcx, &mut hasher));
|
||||
// Let's only emit 64 bits of the hash value. That should be plenty for
|
||||
// avoiding collisions and will make the emitted type names shorter.
|
||||
let hash: u64 = hasher.finish();
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
mir::ConstantKind::Ty(ct) => ct,
|
||||
mir::ConstantKind::Val(val, _) => return Ok(val),
|
||||
};
|
||||
match ct.val() {
|
||||
match ct.kind() {
|
||||
ty::ConstKind::Unevaluated(ct) => self
|
||||
.cx
|
||||
.tcx()
|
||||
|
@ -65,7 +65,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
.fields
|
||||
.iter()
|
||||
.map(|field| {
|
||||
if let Some(prim) = field.val().try_to_scalar() {
|
||||
if let Some(prim) = field.kind().try_to_scalar() {
|
||||
let layout = bx.layout_of(field_ty);
|
||||
let Abi::Scalar(scalar) = layout.abi else {
|
||||
bug!("from_const: invalid ByVal layout: {:#?}", layout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue