]> git.lizzy.rs Git - rust.git/commitdiff
Encode proper spans in crate metadata.
authorInokentiy Babushkin <twk@twki.de>
Tue, 8 Aug 2017 13:12:39 +0000 (15:12 +0200)
committerInokentiy Babushkin <twk@twki.de>
Tue, 8 Aug 2017 13:12:39 +0000 (15:12 +0200)
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.

src/librustc_metadata/encoder.rs

index c35d8407c9d3c4f24ee55c5da2beb13d7409bfa6..8a753a0ae4b573e1a32b53b893dd90dbe262f257 100644 (file)
@@ -563,7 +563,7 @@ fn encode_info_for_mod(&mut self,
         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