Auto merge of #134478 - compiler-errors:attr-span, r=oli-obk
Properly record metavar spans for other expansions other than TT This properly records metavar spans for nonterminals other than tokentree. This means that we operations like `span.to(other_span)` work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result. Fixes #132908 Alternative to #133270 cc `@ehuss` cc `@petrochenkov`
This commit is contained in:
commit
dee7d0e730
12 changed files with 105 additions and 34 deletions
|
@ -12,7 +12,7 @@ use rustc_hir::*;
|
|||
use rustc_hir_pretty as pprust_hir;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_span::def_id::StableCrateId;
|
||||
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
|
||||
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym, with_metavar_spans};
|
||||
|
||||
use crate::hir::ModuleItems;
|
||||
use crate::middle::debugger_visualizer::DebuggerVisualizerFile;
|
||||
|
@ -1117,6 +1117,9 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, _: LocalCrate) -> Svh {
|
|||
// the fly in the resolver, storing only their accumulated hash in `ResolverGlobalCtxt`,
|
||||
// and combining it with other hashes here.
|
||||
resolutions.visibilities_for_hashing.hash_stable(&mut hcx, &mut stable_hasher);
|
||||
with_metavar_spans(|mspans| {
|
||||
mspans.freeze_and_get_read_spans().hash_stable(&mut hcx, &mut stable_hasher);
|
||||
});
|
||||
stable_hasher.finish()
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue