diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-09-12 23:26:17 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-09-12 23:26:17 -0400 |
| commit | a67d248b13e8ac6f83df8994f59e7b89f064339e (patch) | |
| tree | 71a3a624d11b9bafb692710ac5adcc82264b6309 /compiler/rustc_metadata/src | |
| parent | 498dab02562a67d503fc1cf0eca0968f44cfecfa (diff) | |
| download | rust-a67d248b13e8ac6f83df8994f59e7b89f064339e.tar.gz rust-a67d248b13e8ac6f83df8994f59e7b89f064339e.zip | |
Properly encode spans with a dummy location and non-root `SyntaxContext`
Previously, we would throw away the `SyntaxContext` of any span with a dummy location during metadata encoding. This commit makes metadata Span encoding consistent with incr-cache Span encoding - an 'invalid span' tag is only used when it doesn't lose any information.
Diffstat (limited to 'compiler/rustc_metadata/src')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/encoder.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index deca80f590f..1786969a889 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -162,7 +162,7 @@ impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for ExpnId { impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for Span { fn encode(&self, s: &mut EncodeContext<'a, 'tcx>) -> opaque::EncodeResult { - if self.is_dummy() { + if *self == rustc_span::DUMMY_SP { return TAG_INVALID_SPAN.encode(s); } |
