about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-08-11 10:20:22 +0200
committerGitHub <noreply@github.com>2017-08-11 10:20:22 +0200
commit6047e9300cc40b3fd4f4470c28f40404d0bbde3c (patch)
tree906b0b59da1507cdcc121989d0e7e9c4614b1ad9
parent03abb9d97fe72c929e7d767c278f1446dafdc6ba (diff)
parent43760a4f9b901ba16239909f32542e685a2b9279 (diff)
downloadrust-6047e9300cc40b3fd4f4470c28f40404d0bbde3c.tar.gz
rust-6047e9300cc40b3fd4f4470c28f40404d0bbde3c.zip
Rollup merge of #43739 - ibabushkin:master, r=eddyb
Encode proper module spans in crate metadata.

The spans previously encoded only span the first token after the opening
brace, up to the closing brace of inline `mod` declarations. Thus, when
examining exports from an external crate, the spans don't include the
header of inline `mod` declarations.

r? @eddyb
-rw-r--r--src/librustc_metadata/encoder.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs
index c35d8407c9d..8a753a0ae4b 100644
--- a/src/librustc_metadata/encoder.rs
+++ b/src/librustc_metadata/encoder.rs
@@ -563,7 +563,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
         Entry {
             kind: EntryKind::Mod(self.lazy(&data)),
             visibility: self.lazy(&ty::Visibility::from_hir(vis, id, tcx)),
-            span: self.lazy(&md.inner),
+            span: self.lazy(&tcx.def_span(def_id)),
             attributes: self.encode_attributes(attrs),
             children: self.lazy_seq(md.item_ids.iter().map(|item_id| {
                 tcx.hir.local_def_id(item_id.id).index