Enable relative span hashing.

This commit is contained in:
Camille GILLOT 2021-06-10 20:34:42 +02:00
parent 66e0316414
commit 65f342daea
4 changed files with 3 additions and 5 deletions

View file

@ -776,7 +776,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
/// Intercept all spans entering HIR.
/// Mark a span as relative to the current owning item.
fn lower_span(&self, span: Span) -> Span {
if self.tcx.sess.opts.unstable_opts.incremental_relative_spans {
if self.tcx.sess.opts.incremental.is_some() {
span.with_parent(Some(self.current_hir_id_owner.def_id))
} else {
// Do not make spans relative when not using incremental compilation.

View file

@ -587,7 +587,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
.resolver
.visit_ast_fragment_with_placeholders(self.cx.current_expansion.id, &fragment);
if self.cx.sess.opts.unstable_opts.incremental_relative_spans {
if self.cx.sess.opts.incremental.is_some() {
for (invoc, _) in invocations.iter_mut() {
let expn_id = invoc.expansion_data.id;
let parent_def = self.cx.resolver.invocation_parent(expn_id);

View file

@ -1162,7 +1162,7 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
hir_body_hash.hash_stable(&mut hcx, &mut stable_hasher);
upstream_crates.hash_stable(&mut hcx, &mut stable_hasher);
source_file_names.hash_stable(&mut hcx, &mut stable_hasher);
if tcx.sess.opts.unstable_opts.incremental_relative_spans {
if tcx.sess.opts.incremental.is_some() {
let definitions = tcx.definitions_untracked();
let mut owner_spans: Vec<_> = krate
.owners

View file

@ -1338,8 +1338,6 @@ options! {
incremental_info: bool = (false, parse_bool, [UNTRACKED],
"print high-level information about incremental reuse (or the lack thereof) \
(default: no)"),
incremental_relative_spans: bool = (false, parse_bool, [TRACKED],
"hash spans relative to their parent item for incr. comp. (default: no)"),
incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED],
"verify incr. comp. hashes of green query instances (default: no)"),
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],