1
Fork 0

rustc_index: Add a ZERO constant to index types

It is commonly used.
This commit is contained in:
Vadim Petrochenkov 2024-04-03 17:49:59 +03:00
parent ceab6128fa
commit b40ea03f8a
42 changed files with 80 additions and 90 deletions

View file

@ -215,7 +215,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
fn parse_local_decls(&mut self, mut stmts: impl Iterator<Item = StmtId>) -> PResult<()> {
let (ret_var, ..) = self.parse_let_statement(stmts.next().unwrap())?;
self.local_map.insert(ret_var, Local::from_u32(0));
self.local_map.insert(ret_var, Local::ZERO);
for stmt in stmts {
let (var, ty, span) = self.parse_let_statement(stmt)?;

View file

@ -573,7 +573,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
result_value,
Rvalue::CheckedBinaryOp(op, Box::new((lhs.to_copy(), rhs.to_copy()))),
);
let val_fld = FieldIdx::new(0);
let val_fld = FieldIdx::ZERO;
let of_fld = FieldIdx::new(1);
let tcx = self.tcx;

View file

@ -190,7 +190,7 @@ rustc_index::newtype_index! {
struct DropIdx {}
}
const ROOT_NODE: DropIdx = DropIdx::from_u32(0);
const ROOT_NODE: DropIdx = DropIdx::ZERO;
/// A tree of drops that we have deferred lowering. It's used for:
///