Skip to content

Commit

Permalink
Add proper cfgs for struct HirIdValidator used only with debug assert…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
mu001999 committed Mar 6, 2024
1 parent 2064c19 commit 9e27717
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_passes/src/hir_id_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
}
}

#[cfg(debug_assertions)]
struct HirIdValidator<'a, 'hir> {
tcx: TyCtxt<'hir>,
owner: Option<hir::OwnerId>,
hir_ids_seen: GrowableBitSet<ItemLocalId>,
errors: &'a Lock<Vec<String>>,
}

#[cfg(debug_assertions)]
impl<'a, 'hir> HirIdValidator<'a, 'hir> {
fn new_visitor(&self, tcx: TyCtxt<'hir>) -> HirIdValidator<'a, 'hir> {
HirIdValidator { tcx, owner: None, hir_ids_seen: Default::default(), errors: self.errors }
Expand Down Expand Up @@ -114,6 +116,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
}
}

#[cfg(debug_assertions)]
impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
type NestedFilter = nested_filter::OnlyBodies;

Expand Down

0 comments on commit 9e27717

Please sign in to comment.