about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2020-05-26 13:21:58 -0400
committerAaron Hill <aa1ronham@gmail.com>2020-05-31 17:30:55 -0400
commit717fd665ad1095b12907ed0f2426d8eb06c2bddc (patch)
tree1b0ff7c2958b6022035bbacf5820ef3688e60270 /src/libstd/sys/unix/stack_overflow.rs
parent8c5402efdda733d163895d1edb9bcf7f401dd33b (diff)
downloadrust-717fd665ad1095b12907ed0f2426d8eb06c2bddc.tar.gz
rust-717fd665ad1095b12907ed0f2426d8eb06c2bddc.zip
Make `SourceMap` available for early debug-printing of `Span`s
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.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions