Rollup merge of #123419 - petrochenkov:zeroindex, r=compiler-errors

rustc_index: Add a `ZERO` constant to index types

It is commonly used.
This commit is contained in:
Matthias Krüger
2024-04-03 22:11:02 +02:00
committed by GitHub
42 changed files with 80 additions and 90 deletions

View File

@@ -183,7 +183,7 @@ pub fn check_intrinsic_type(
let region = ty::Region::new_bound(
tcx,
ty::INNERMOST,
ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon },
ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon },
);
let env_region = ty::Region::new_bound(
tcx,
@@ -495,7 +495,7 @@ pub fn check_intrinsic_type(
);
let discriminant_def_id = assoc_items[0];
let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon };
let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon };
(
1,
0,
@@ -555,7 +555,7 @@ pub fn check_intrinsic_type(
}
sym::raw_eq => {
let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon };
let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon };
let param_ty_lhs =
Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0));
let br = ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrAnon };