Encode proper 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.
This commit is contained in:
Inokentiy Babushkin 2017-08-08 15:12:39 +02:00
parent bcd75d661a
commit 43760a4f9b
No known key found for this signature in database
GPG Key ID: 7EFC8EC5224DE8EC

View File

@ -563,7 +563,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
Entry { Entry {
kind: EntryKind::Mod(self.lazy(&data)), kind: EntryKind::Mod(self.lazy(&data)),
visibility: self.lazy(&ty::Visibility::from_hir(vis, id, tcx)), 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), attributes: self.encode_attributes(attrs),
children: self.lazy_seq(md.item_ids.iter().map(|item_id| { children: self.lazy_seq(md.item_ids.iter().map(|item_id| {
tcx.hir.local_def_id(item_id.id).index tcx.hir.local_def_id(item_id.id).index