|
1 |
| -use rustc_data_structures::sync::Lock; |
2 |
| -use rustc_hir as hir; |
3 |
| -use rustc_hir::def_id::LocalDefId; |
4 |
| -use rustc_hir::intravisit; |
5 |
| -use rustc_hir::{HirId, ItemLocalId}; |
6 |
| -use rustc_index::bit_set::GrowableBitSet; |
7 |
| -use rustc_middle::hir::nested_filter; |
8 | 1 | use rustc_middle::ty::TyCtxt;
|
| 2 | +#[cfg(debug_assertions)] |
| 3 | +use ::{ |
| 4 | + rustc_data_structures::sync::Lock, |
| 5 | + rustc_hir as hir, |
| 6 | + rustc_hir::def_id::LocalDefId, |
| 7 | + rustc_hir::{intravisit, HirId, ItemLocalId}, |
| 8 | + rustc_index::bit_set::GrowableBitSet, |
| 9 | + rustc_middle::hir::nested_filter, |
| 10 | +}; |
9 | 11 |
|
10 | 12 | pub fn check_crate(tcx: TyCtxt<'_>) {
|
11 | 13 | if tcx.sess.opts.unstable_opts.hir_stats {
|
@@ -36,13 +38,15 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
|
36 | 38 | }
|
37 | 39 | }
|
38 | 40 |
|
| 41 | +#[cfg(debug_assertions)] |
39 | 42 | struct HirIdValidator<'a, 'hir> {
|
40 | 43 | tcx: TyCtxt<'hir>,
|
41 | 44 | owner: Option<hir::OwnerId>,
|
42 | 45 | hir_ids_seen: GrowableBitSet<ItemLocalId>,
|
43 | 46 | errors: &'a Lock<Vec<String>>,
|
44 | 47 | }
|
45 | 48 |
|
| 49 | +#[cfg(debug_assertions)] |
46 | 50 | impl<'a, 'hir> HirIdValidator<'a, 'hir> {
|
47 | 51 | fn new_visitor(&self, tcx: TyCtxt<'hir>) -> HirIdValidator<'a, 'hir> {
|
48 | 52 | HirIdValidator { tcx, owner: None, hir_ids_seen: Default::default(), errors: self.errors }
|
@@ -114,6 +118,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
|
114 | 118 | }
|
115 | 119 | }
|
116 | 120 |
|
| 121 | +#[cfg(debug_assertions)] |
117 | 122 | impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
|
118 | 123 | type NestedFilter = nested_filter::OnlyBodies;
|
119 | 124 |
|
|
0 commit comments