Only enable relative span hashing on nightly.
This commit is contained in:
parent
65f342daea
commit
40c8165395
@ -776,7 +776,7 @@ fn mark_span_with_reason(
|
|||||||
/// Intercept all spans entering HIR.
|
/// Intercept all spans entering HIR.
|
||||||
/// Mark a span as relative to the current owning item.
|
/// Mark a span as relative to the current owning item.
|
||||||
fn lower_span(&self, span: Span) -> Span {
|
fn lower_span(&self, span: Span) -> Span {
|
||||||
if self.tcx.sess.opts.incremental.is_some() {
|
if self.tcx.sess.opts.incremental_relative_spans() {
|
||||||
span.with_parent(Some(self.current_hir_id_owner.def_id))
|
span.with_parent(Some(self.current_hir_id_owner.def_id))
|
||||||
} else {
|
} else {
|
||||||
// Do not make spans relative when not using incremental compilation.
|
// Do not make spans relative when not using incremental compilation.
|
||||||
|
@ -587,7 +587,7 @@ fn collect_invocations(
|
|||||||
.resolver
|
.resolver
|
||||||
.visit_ast_fragment_with_placeholders(self.cx.current_expansion.id, &fragment);
|
.visit_ast_fragment_with_placeholders(self.cx.current_expansion.id, &fragment);
|
||||||
|
|
||||||
if self.cx.sess.opts.incremental.is_some() {
|
if self.cx.sess.opts.incremental_relative_spans() {
|
||||||
for (invoc, _) in invocations.iter_mut() {
|
for (invoc, _) in invocations.iter_mut() {
|
||||||
let expn_id = invoc.expansion_data.id;
|
let expn_id = invoc.expansion_data.id;
|
||||||
let parent_def = self.cx.resolver.invocation_parent(expn_id);
|
let parent_def = self.cx.resolver.invocation_parent(expn_id);
|
||||||
|
@ -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);
|
hir_body_hash.hash_stable(&mut hcx, &mut stable_hasher);
|
||||||
upstream_crates.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);
|
source_file_names.hash_stable(&mut hcx, &mut stable_hasher);
|
||||||
if tcx.sess.opts.incremental.is_some() {
|
if tcx.sess.opts.incremental_relative_spans() {
|
||||||
let definitions = tcx.definitions_untracked();
|
let definitions = tcx.definitions_untracked();
|
||||||
let mut owner_spans: Vec<_> = krate
|
let mut owner_spans: Vec<_> = krate
|
||||||
.owners
|
.owners
|
||||||
|
@ -787,6 +787,12 @@ pub fn share_generics(&self) -> bool {
|
|||||||
pub fn get_symbol_mangling_version(&self) -> SymbolManglingVersion {
|
pub fn get_symbol_mangling_version(&self) -> SymbolManglingVersion {
|
||||||
self.cg.symbol_mangling_version.unwrap_or(SymbolManglingVersion::Legacy)
|
self.cg.symbol_mangling_version.unwrap_or(SymbolManglingVersion::Legacy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(rustc::bad_opt_access)]
|
||||||
|
pub fn incremental_relative_spans(&self) -> bool {
|
||||||
|
self.unstable_opts.incremental_relative_spans
|
||||||
|
|| (self.unstable_features.is_nightly_build() && self.incremental.is_some())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnstableOptions {
|
impl UnstableOptions {
|
||||||
|
@ -1338,6 +1338,9 @@ pub(crate) fn parse_proc_macro_execution_strategy(
|
|||||||
incremental_info: bool = (false, parse_bool, [UNTRACKED],
|
incremental_info: bool = (false, parse_bool, [UNTRACKED],
|
||||||
"print high-level information about incremental reuse (or the lack thereof) \
|
"print high-level information about incremental reuse (or the lack thereof) \
|
||||||
(default: no)"),
|
(default: no)"),
|
||||||
|
#[rustc_lint_opt_deny_field_access("use `Session::incremental_relative_spans` instead of this field")]
|
||||||
|
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],
|
incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED],
|
||||||
"verify incr. comp. hashes of green query instances (default: no)"),
|
"verify incr. comp. hashes of green query instances (default: no)"),
|
||||||
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
|
Loading…
Reference in New Issue
Block a user