Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #122096

Closed
wants to merge 24 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d911613
Allow bootstrap cache path to be set by environment variable
jefferyto Oct 13, 2023
c98e25b
Add a build option to specify the bootstrap cache
lu-zero Mar 4, 2024
39887d3
Do not try to format removed files
clubby789 Mar 5, 2024
ebc45c8
Uplift some feeding out of associated_type_for_impl_trait_in_impl and…
compiler-errors Mar 5, 2024
7396fd1
Clarify how lowering `if` produces then/else blocks
Zalathar Mar 6, 2024
3402f39
Clarify lowering the `else` arm into the else block
Zalathar Mar 6, 2024
250e697
Additional comments for lowering `if`
Zalathar Mar 6, 2024
e81df3f
loongarch: add frecipe and relax target feature
heiher Mar 5, 2024
533add8
add missing PartialOrd impl doc for array
KonradHoeffner Mar 6, 2024
1061c8d
remove outdated fixme comment
fee1-dead Mar 6, 2024
5a4ff27
Fix redundant import errors for preload extern crate
chenyukang Mar 4, 2024
f415379
Add proper cfgs for struct HirIdValidator used only with debug assert…
mu001999 Mar 6, 2024
9957736
Note why we're using a new thread in a test
ChrisDenton Mar 6, 2024
0a80f9a
Update src/bootstrap/src/utils/change_tracker.rs
lu-zero Mar 6, 2024
8f99d57
Rollup merge of #121958 - chenyukang:yukang-fix-121915-import, r=petr…
matthiaskrgr Mar 6, 2024
e0a1b02
Rollup merge of #121976 - lu-zero:bootstrap-cache, r=onur-ozkan
matthiaskrgr Mar 6, 2024
c9af431
Rollup merge of #122022 - heiher:loongarch-features, r=petrochenkov
matthiaskrgr Mar 6, 2024
af88518
Rollup merge of #122026 - clubby789:fmt-removed, r=onur-ozkan
matthiaskrgr Mar 6, 2024
58a84ef
Rollup merge of #122027 - compiler-errors:rpitit-cycle, r=spastorino
matthiaskrgr Mar 6, 2024
6a10540
Rollup merge of #122063 - Zalathar:lower-if, r=oli-obk
matthiaskrgr Mar 6, 2024
fa6c3c3
Rollup merge of #122066 - mu001999:clean, r=oli-obk
matthiaskrgr Mar 6, 2024
f3a619a
Rollup merge of #122074 - KonradHoeffner:patch-2, r=jhpratt
matthiaskrgr Mar 6, 2024
7cf69c0
Rollup merge of #122082 - fee1-dead-contrib:rm-outdated-note, r=compi…
matthiaskrgr Mar 6, 2024
3fc4cf6
Rollup merge of #122091 - ChrisDenton:comment, r=RalfJung
matthiaskrgr Mar 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add proper cfgs for struct HirIdValidator used only with debug assert…
…ions
mu001999 committed Mar 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit f41537981b84c9490a16c70120df7b41582cd8aa
5 changes: 5 additions & 0 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
@@ -686,6 +686,11 @@ pub fn create_global_ctxt<'tcx>(
/// Runs the type-checking, region checking and other miscellaneous analysis
/// passes on the crate.
fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
if tcx.sess.opts.unstable_opts.hir_stats {
rustc_passes::hir_stats::print_hir_stats(tcx);
}

#[cfg(debug_assertions)]
rustc_passes::hir_id_validator::check_crate(tcx);

let sess = tcx.sess;
36 changes: 12 additions & 24 deletions compiler/rustc_passes/src/hir_id_validator.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
use rustc_data_structures::sync::Lock;
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit;
use rustc_hir::{HirId, ItemLocalId};
use rustc_hir::{intravisit, HirId, ItemLocalId};
use rustc_index::bit_set::GrowableBitSet;
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;

pub fn check_crate(tcx: TyCtxt<'_>) {
if tcx.sess.opts.unstable_opts.hir_stats {
crate::hir_stats::print_hir_stats(tcx);
}

#[cfg(debug_assertions)]
{
let errors = Lock::new(Vec::new());
let errors = Lock::new(Vec::new());

tcx.hir().par_for_each_module(|module_id| {
let mut v = HirIdValidator {
tcx,
owner: None,
hir_ids_seen: Default::default(),
errors: &errors,
};
tcx.hir().par_for_each_module(|module_id| {
let mut v =
HirIdValidator { tcx, owner: None, hir_ids_seen: Default::default(), errors: &errors };

tcx.hir().visit_item_likes_in_module(module_id, &mut v);
});
tcx.hir().visit_item_likes_in_module(module_id, &mut v);
});

let errors = errors.into_inner();
let errors = errors.into_inner();

if !errors.is_empty() {
let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2);
tcx.dcx().delayed_bug(message);
}
if !errors.is_empty() {
let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2);
tcx.dcx().delayed_bug(message);
}
}

@@ -90,7 +78,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
self.error(|| {
format!(
"ItemLocalIds not assigned densely in {pretty_owner}. \
Max ItemLocalId = {max}, missing IDs = {missing_items:#?}; seen IDs = {seen_items:#?}"
Max ItemLocalId = {max}, missing IDs = {missing_items:#?}; seen IDs = {seen_items:#?}"
)
});
}
1 change: 1 addition & 0 deletions compiler/rustc_passes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ mod debugger_visualizer;
mod diagnostic_items;
pub mod entry;
mod errors;
#[cfg(debug_assertions)]
pub mod hir_id_validator;
pub mod hir_stats;
mod lang_items;