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

@ -532,7 +532,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let mut seen_spans = FxHashSet::default();
let mut errors = vec![];
let mut prev_root_id: NodeId = NodeId::from_u32(0);
let mut prev_root_id: NodeId = NodeId::ZERO;
let determined_imports = mem::take(&mut self.determined_imports);
let indeterminate_imports = mem::take(&mut self.indeterminate_imports);
@ -556,8 +556,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}
}
if prev_root_id.as_u32() != 0
&& prev_root_id.as_u32() != import.root_id.as_u32()
if prev_root_id != NodeId::ZERO
&& prev_root_id != import.root_id
&& !errors.is_empty()
{
// In the case of a new import line, throw a diagnostic message