@@ -31,7 +31,7 @@ use rustc_serialize::{opaque, Encodable, Encoder};
31
31
use rustc_session:: config:: CrateType ;
32
32
use rustc_session:: cstore:: { ForeignModule , LinkagePreference , NativeLib } ;
33
33
use rustc_span:: hygiene:: { ExpnIndex , HygieneEncodeContext , MacroKind } ;
34
- use rustc_span:: symbol:: { sym, Ident , Symbol } ;
34
+ use rustc_span:: symbol:: { sym, Symbol } ;
35
35
use rustc_span:: {
36
36
self , DebuggerVisualizerFile , ExternalSource , FileName , SourceFile , Span , SyntaxContext ,
37
37
} ;
@@ -1007,6 +1007,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1007
1007
record ! ( self . tables. def_span[ def_id] <- tcx. def_span( def_id) ) ;
1008
1008
self . encode_attrs ( local_id) ;
1009
1009
record ! ( self . tables. expn_that_defined[ def_id] <- self . tcx. expn_that_defined( def_id) ) ;
1010
+ if let Some ( ident_span) = tcx. def_ident_span ( def_id) {
1011
+ record ! ( self . tables. def_ident_span[ def_id] <- ident_span) ;
1012
+ }
1010
1013
if def_kind. has_codegen_attrs ( ) {
1011
1014
record ! ( self . tables. codegen_fn_attrs[ def_id] <- self . tcx. codegen_fn_attrs( def_id) ) ;
1012
1015
}
@@ -1071,7 +1074,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1071
1074
assert!( f. did. is_local( ) ) ;
1072
1075
f. did. index
1073
1076
} ) ) ;
1074
- self . encode_ident_span ( def_id, variant. ident ( tcx) ) ;
1075
1077
self . encode_item_type ( def_id) ;
1076
1078
if variant. ctor_kind == CtorKind :: Fn {
1077
1079
// FIXME(eddyb) encode signature only in `encode_enum_variant_ctor`.
@@ -1163,7 +1165,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1163
1165
debug ! ( "EncodeContext::encode_field({:?})" , def_id) ;
1164
1166
1165
1167
record ! ( self . tables. kind[ def_id] <- EntryKind :: Field ) ;
1166
- self . encode_ident_span ( def_id, field. ident ( self . tcx ) ) ;
1167
1168
self . encode_item_type ( def_id) ;
1168
1169
}
1169
1170
@@ -1242,7 +1243,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1242
1243
record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocType ( container) ) ;
1243
1244
}
1244
1245
}
1245
- self . encode_ident_span ( def_id, ast_item. ident ) ;
1246
1246
match trait_item. kind {
1247
1247
ty:: AssocKind :: Const | ty:: AssocKind :: Fn => {
1248
1248
self . encode_item_type ( def_id) ;
@@ -1306,7 +1306,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1306
1306
record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocType ( container) ) ;
1307
1307
}
1308
1308
}
1309
- self . encode_ident_span ( def_id, impl_item. ident ( self . tcx ) ) ;
1310
1309
self . encode_item_type ( def_id) ;
1311
1310
if let Some ( trait_item_def_id) = impl_item. trait_item_def_id {
1312
1311
self . tables . trait_item_def_id . set ( def_id. index , trait_item_def_id. into ( ) ) ;
@@ -1408,8 +1407,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1408
1407
1409
1408
debug ! ( "EncodeContext::encode_info_for_item({:?})" , def_id) ;
1410
1409
1411
- self . encode_ident_span ( def_id, item. ident ) ;
1412
-
1413
1410
let entry_kind = match item. kind {
1414
1411
hir:: ItemKind :: Static ( ..) => EntryKind :: Static ,
1415
1412
hir:: ItemKind :: Const ( _, body_id) => {
@@ -1953,7 +1950,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1953
1950
record ! ( self . tables. kind[ def_id] <- EntryKind :: ForeignType ) ;
1954
1951
}
1955
1952
}
1956
- self . encode_ident_span ( def_id, nitem. ident ) ;
1957
1953
self . encode_item_type ( def_id) ;
1958
1954
if let hir:: ForeignItemKind :: Fn ( ..) = nitem. kind {
1959
1955
record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
@@ -2035,10 +2031,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
2035
2031
}
2036
2032
}
2037
2033
2038
- fn encode_ident_span ( & mut self , def_id : DefId , ident : Ident ) {
2039
- record ! ( self . tables. def_ident_span[ def_id] <- ident. span) ;
2040
- }
2041
-
2042
2034
/// In some cases, along with the item itself, we also
2043
2035
/// encode some sub-items. Usually we want some info from the item
2044
2036
/// so it's easier to do that here then to wait until we would encounter
0 commit comments