|
1 | 1 | use rustc_data_structures::sync::Lock; |
2 | 2 | use rustc_hir as hir; |
3 | 3 | use rustc_hir::def_id::LocalDefId; |
4 | | -use rustc_hir::intravisit; |
5 | | -use rustc_hir::{HirId, ItemLocalId}; |
| 4 | +use rustc_hir::{intravisit, HirId, ItemLocalId}; |
6 | 5 | use rustc_index::bit_set::GrowableBitSet; |
7 | 6 | use rustc_middle::hir::nested_filter; |
8 | 7 | use rustc_middle::ty::TyCtxt; |
9 | 8 |
|
10 | 9 | pub fn check_crate(tcx: TyCtxt<'_>) { |
11 | | - if tcx.sess.opts.unstable_opts.hir_stats { |
12 | | - crate::hir_stats::print_hir_stats(tcx); |
13 | | - } |
14 | | - |
15 | | - #[cfg(debug_assertions)] |
16 | | - { |
17 | | - let errors = Lock::new(Vec::new()); |
| 10 | + let errors = Lock::new(Vec::new()); |
18 | 11 |
|
19 | | - tcx.hir().par_for_each_module(|module_id| { |
20 | | - let mut v = HirIdValidator { |
21 | | - tcx, |
22 | | - owner: None, |
23 | | - hir_ids_seen: Default::default(), |
24 | | - errors: &errors, |
25 | | - }; |
| 12 | + tcx.hir().par_for_each_module(|module_id| { |
| 13 | + let mut v = |
| 14 | + HirIdValidator { tcx, owner: None, hir_ids_seen: Default::default(), errors: &errors }; |
26 | 15 |
|
27 | | - tcx.hir().visit_item_likes_in_module(module_id, &mut v); |
28 | | - }); |
| 16 | + tcx.hir().visit_item_likes_in_module(module_id, &mut v); |
| 17 | + }); |
29 | 18 |
|
30 | | - let errors = errors.into_inner(); |
| 19 | + let errors = errors.into_inner(); |
31 | 20 |
|
32 | | - if !errors.is_empty() { |
33 | | - let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2); |
34 | | - tcx.dcx().delayed_bug(message); |
35 | | - } |
| 21 | + if !errors.is_empty() { |
| 22 | + let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2); |
| 23 | + tcx.dcx().delayed_bug(message); |
36 | 24 | } |
37 | 25 | } |
38 | 26 |
|
@@ -90,7 +78,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> { |
90 | 78 | self.error(|| { |
91 | 79 | format!( |
92 | 80 | "ItemLocalIds not assigned densely in {pretty_owner}. \ |
93 | | - Max ItemLocalId = {max}, missing IDs = {missing_items:#?}; seen IDs = {seen_items:#?}" |
| 81 | + Max ItemLocalId = {max}, missing IDs = {missing_items:#?}; seen IDs = {seen_items:#?}" |
94 | 82 | ) |
95 | 83 | }); |
96 | 84 | } |
|
0 commit comments