rust/src/librustc_interface
Aaron Hill 717fd665ad
Make SourceMap available for early debug-printing of Spans
Normally, we debug-print `Spans` using the `SourceMap` retrieved from
the global `TyCtxt`. However, we fall back to printing out the `Span`'s
raw fields (instead of a file and line number) when we try to print a
`Span` before a `TyCtxt` is available. This makes debugging early phases
of the compile, such as parsing, much more difficult.

This commit stores a `SourceMap` in `rustc_span::GlOBALS` as a fallback.
When a `TyCtxt` is not available, we try to retrieve one from `GLOBALS`
- only if this is not available do we fall back to the raw field output.

I'm not sure how to write a test for this - however, this can be
verified locally by setting `RUSTC_LOG="rustc_parse=debug"`, and
verifying that the output contains filenames and line numbers.
2020-05-31 17:30:55 -04:00
..
build.rs Locate rustc binary similarly to codegen backend loading 2019-09-10 16:57:14 -04:00
callbacks.rs Query-ify Instance::resolve 2020-04-05 01:21:36 -04:00
Cargo.toml Remove unused dependencies 2020-04-20 17:59:27 +09:00
interface.rs Make SourceMap available for early debug-printing of Spans 2020-05-31 17:30:55 -04:00
lib.rs Depend on libc from crates.io 2020-04-11 11:07:04 -04:00
passes.rs more LocalDefIds 2020-05-30 12:22:29 +02:00
proc_macro_decls.rs librustc_middle: return LocalDefId instead of DefId in local_def_id 2020-04-23 23:14:07 +01:00
queries.rs Use OnceCell instead of Once 2020-05-22 13:31:02 -07:00
tests.rs Rollup merge of #72669 - petrochenkov:smclean, r=Mark-Simulacrum 2020-05-30 23:08:55 +02:00
util.rs rustc_session: Cleanup session creation 2020-05-27 22:32:24 +03:00