Skip to main content

Module assert_module_sources

Module assert_module_sources 

Source
Expand description

This pass is only used for UNIT TESTS related to incremental compilation. It tests whether a particular .o file will be re-used from a previous compilation or whether it must be regenerated.

The user adds annotations to the crate of the following form:

#![rustc_partition_reused(module="spike", cfg="rpass2")]
#![rustc_partition_codegened(module="spike-x", cfg="rpass2")]

The first indicates (in the cfg rpass2) that spike.o will be reused, the second that spike-x.o will be recreated. If these annotations are inaccurate, errors are reported.

The reason that we use cfg=... and not #[cfg_attr] is so that the HIR doesn’t change as a result of the annotations, which might perturb the reuse results.

#![rustc_expected_cgu_reuse(module="spike", cfg="rpass2", kind="post-lto")] allows for doing a more fine-grained check to see if pre- or post-lto data was re-used.

Re-exportsΒ§

use std::borrow::Cow; πŸ”’
use std::fmt; πŸ”’
use rustc_attr_ir::CguFields; πŸ”’
use rustc_attr_ir::CguKind; πŸ”’
use rustc_attr_ir::find_attr; πŸ”’
use rustc_data_structures::unord::UnordMap; πŸ”’
use rustc_data_structures::unord::UnordSet; πŸ”’
use rustc_errors::DiagArgValue; πŸ”’
use rustc_errors::IntoDiagArg; πŸ”’
use rustc_hir::def_id::LOCAL_CRATE; πŸ”’
use rustc_middle::mono::CodegenUnitNameBuilder; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_session::Session; πŸ”’
use rustc_span::Span; πŸ”’
use rustc_span::Symbol; πŸ”’
use tracing::debug; πŸ”’
use crate::diagnostics; πŸ”’

StructsΒ§

AssertModuleSource πŸ”’
CguReuseTracker
TrackerData πŸ”’

EnumsΒ§

CguReuse
ComparisonKind

FunctionsΒ§

assert_module_sources