about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-05-12 00:10:41 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2021-06-11 12:07:18 -0400
commit9529cbd0ba0ec29308589dbc8899305bd629f72a (patch)
tree7c100e51461d660e0aa55b9ccacb2dfe61c086e3 /compiler/rustc_parse/src/parser
parentf724ee4233d72f14d58ecc3c56064c465dcbcfb8 (diff)
downloadrust-9529cbd0ba0ec29308589dbc8899305bd629f72a.tar.gz
rust-9529cbd0ba0ec29308589dbc8899305bd629f72a.zip
Preserve `SyntaxContext` for invalid/dummy spans in crate metadata
Fixes #85197

We already preserved the `SyntaxContext` for invalid/dummy spans in the
incremental cache, but we weren't doing the same for crate metadata.
If an invalid (lo/hi from different files) span is written to the
incremental cache, we will decode it with a 'dummy' location, but keep
the original `SyntaxContext`. Since the crate metadata encoder was only
checking for `DUMMY_SP` (dummy location + root `SyntaxContext`),
the metadata encoder would treat it as a normal span, encoding the
`SyntaxContext`. As a result, the final span encoded to the metadata
would change across sessions, even if the crate itself was unchanged.

This PR updates our encoding of spans in the crate metadata to mirror
the encoding of spans into the incremental cache. We now always encode a
`SyntaxContext`, and encode location information for spans with a
non-dummy location.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
0 files changed, 0 insertions, 0 deletions