Rollup merge of #122066 - mu001999:clean, r=oli-obk
Add proper cfgs for struct HirIdValidator used only with debug-assert See https://github.com/rust-lang/rust/pull/122065#issuecomment-1980118572. I think it's due to #121752.
This commit is contained in:
commit
f1fb720734
4 changed files with 25 additions and 26 deletions
|
@ -686,6 +686,11 @@ pub fn create_global_ctxt<'tcx>(
|
||||||
/// Runs the type-checking, region checking and other miscellaneous analysis
|
/// Runs the type-checking, region checking and other miscellaneous analysis
|
||||||
/// passes on the crate.
|
/// passes on the crate.
|
||||||
fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
|
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);
|
rustc_passes::hir_id_validator::check_crate(tcx);
|
||||||
|
|
||||||
let sess = tcx.sess;
|
let sess = tcx.sess;
|
||||||
|
|
|
@ -1,38 +1,26 @@
|
||||||
use rustc_data_structures::sync::Lock;
|
use rustc_data_structures::sync::Lock;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::LocalDefId;
|
use rustc_hir::def_id::LocalDefId;
|
||||||
use rustc_hir::intravisit;
|
use rustc_hir::{intravisit, HirId, ItemLocalId};
|
||||||
use rustc_hir::{HirId, ItemLocalId};
|
|
||||||
use rustc_index::bit_set::GrowableBitSet;
|
use rustc_index::bit_set::GrowableBitSet;
|
||||||
use rustc_middle::hir::nested_filter;
|
use rustc_middle::hir::nested_filter;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
|
|
||||||
pub fn check_crate(tcx: TyCtxt<'_>) {
|
pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||||
if tcx.sess.opts.unstable_opts.hir_stats {
|
let errors = Lock::new(Vec::new());
|
||||||
crate::hir_stats::print_hir_stats(tcx);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
tcx.hir().par_for_each_module(|module_id| {
|
||||||
{
|
let mut v =
|
||||||
let errors = Lock::new(Vec::new());
|
HirIdValidator { tcx, owner: None, hir_ids_seen: Default::default(), errors: &errors };
|
||||||
|
|
||||||
tcx.hir().par_for_each_module(|module_id| {
|
tcx.hir().visit_item_likes_in_module(module_id, &mut v);
|
||||||
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);
|
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);
|
||||||
if !errors.is_empty() {
|
tcx.dcx().delayed_bug(message);
|
||||||
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(|| {
|
self.error(|| {
|
||||||
format!(
|
format!(
|
||||||
"ItemLocalIds not assigned densely in {pretty_owner}. \
|
"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:#?}"
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ mod debugger_visualizer;
|
||||||
mod diagnostic_items;
|
mod diagnostic_items;
|
||||||
pub mod entry;
|
pub mod entry;
|
||||||
mod errors;
|
mod errors;
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
pub mod hir_id_validator;
|
pub mod hir_id_validator;
|
||||||
pub mod hir_stats;
|
pub mod hir_stats;
|
||||||
mod lang_items;
|
mod lang_items;
|
||||||
|
|
|
@ -797,7 +797,10 @@ impl Step for Rustc {
|
||||||
cargo.rustdocflag("-Zunstable-options");
|
cargo.rustdocflag("-Zunstable-options");
|
||||||
cargo.rustdocflag("-Znormalize-docs");
|
cargo.rustdocflag("-Znormalize-docs");
|
||||||
cargo.rustdocflag("--show-type-layout");
|
cargo.rustdocflag("--show-type-layout");
|
||||||
cargo.rustdocflag("--generate-link-to-definition");
|
// FIXME: `--generate-link-to-definition` tries to resolve cfged out code
|
||||||
|
// see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222
|
||||||
|
// cargo.rustdocflag("--generate-link-to-definition");
|
||||||
|
|
||||||
compile::rustc_cargo(builder, &mut cargo, target, compiler.stage);
|
compile::rustc_cargo(builder, &mut cargo, target, compiler.stage);
|
||||||
cargo.arg("-Zunstable-options");
|
cargo.arg("-Zunstable-options");
|
||||||
cargo.arg("-Zskip-rustdoc-fingerprint");
|
cargo.arg("-Zskip-rustdoc-fingerprint");
|
||||||
|
@ -953,8 +956,10 @@ macro_rules! tool_doc {
|
||||||
cargo.rustdocflag("-Arustdoc::private-intra-doc-links");
|
cargo.rustdocflag("-Arustdoc::private-intra-doc-links");
|
||||||
cargo.rustdocflag("--enable-index-page");
|
cargo.rustdocflag("--enable-index-page");
|
||||||
cargo.rustdocflag("--show-type-layout");
|
cargo.rustdocflag("--show-type-layout");
|
||||||
cargo.rustdocflag("--generate-link-to-definition");
|
|
||||||
cargo.rustdocflag("-Zunstable-options");
|
cargo.rustdocflag("-Zunstable-options");
|
||||||
|
// FIXME: `--generate-link-to-definition` tries to resolve cfged out code
|
||||||
|
// see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222
|
||||||
|
// cargo.rustdocflag("--generate-link-to-definition");
|
||||||
|
|
||||||
let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target.triple).join("doc");
|
let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target.triple).join("doc");
|
||||||
$(for krate in $crates {
|
$(for krate in $crates {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue