@@ -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
} ;
@@ -1011,6 +1011,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1011
1011
record ! ( self . tables. def_span[ def_id] <- tcx. def_span( def_id) ) ;
1012
1012
self . encode_attrs ( local_id) ;
1013
1013
record ! ( self . tables. expn_that_defined[ def_id] <- self . tcx. expn_that_defined( def_id) ) ;
1014
+ if let Some ( ident_span) = tcx. def_ident_span ( def_id) {
1015
+ record ! ( self . tables. def_ident_span[ def_id] <- ident_span) ;
1016
+ }
1014
1017
if def_kind. has_codegen_attrs ( ) {
1015
1018
record ! ( self . tables. codegen_fn_attrs[ def_id] <- self . tcx. codegen_fn_attrs( def_id) ) ;
1016
1019
}
@@ -1075,7 +1078,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1075
1078
assert!( f. did. is_local( ) ) ;
1076
1079
f. did. index
1077
1080
} ) ) ;
1078
- self . encode_ident_span ( def_id, variant. ident ( tcx) ) ;
1079
1081
self . encode_item_type ( def_id) ;
1080
1082
if variant. ctor_kind == CtorKind :: Fn {
1081
1083
// FIXME(eddyb) encode signature only in `encode_enum_variant_ctor`.
@@ -1167,7 +1169,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1167
1169
debug ! ( "EncodeContext::encode_field({:?})" , def_id) ;
1168
1170
1169
1171
record ! ( self . tables. kind[ def_id] <- EntryKind :: Field ) ;
1170
- self . encode_ident_span ( def_id, field. ident ( self . tcx ) ) ;
1171
1172
self . encode_item_type ( def_id) ;
1172
1173
}
1173
1174
@@ -1246,7 +1247,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1246
1247
record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocType ( container) ) ;
1247
1248
}
1248
1249
}
1249
- self . encode_ident_span ( def_id, ast_item. ident ) ;
1250
1250
match trait_item. kind {
1251
1251
ty:: AssocKind :: Const | ty:: AssocKind :: Fn => {
1252
1252
self . encode_item_type ( def_id) ;
@@ -1310,7 +1310,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1310
1310
record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocType ( container) ) ;
1311
1311
}
1312
1312
}
1313
- self . encode_ident_span ( def_id, impl_item. ident ( self . tcx ) ) ;
1314
1313
self . encode_item_type ( def_id) ;
1315
1314
if let Some ( trait_item_def_id) = impl_item. trait_item_def_id {
1316
1315
self . tables . trait_item_def_id . set ( def_id. index , trait_item_def_id. into ( ) ) ;
@@ -1412,8 +1411,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1412
1411
1413
1412
debug ! ( "EncodeContext::encode_info_for_item({:?})" , def_id) ;
1414
1413
1415
- self . encode_ident_span ( def_id, item. ident ) ;
1416
-
1417
1414
let entry_kind = match item. kind {
1418
1415
hir:: ItemKind :: Static ( ..) => EntryKind :: Static ,
1419
1416
hir:: ItemKind :: Const ( _, body_id) => {
@@ -1959,7 +1956,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1959
1956
record ! ( self . tables. kind[ def_id] <- EntryKind :: ForeignType ) ;
1960
1957
}
1961
1958
}
1962
- self . encode_ident_span ( def_id, nitem. ident ) ;
1963
1959
self . encode_item_type ( def_id) ;
1964
1960
if let hir:: ForeignItemKind :: Fn ( ..) = nitem. kind {
1965
1961
record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
@@ -2041,10 +2037,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
2041
2037
}
2042
2038
}
2043
2039
2044
- fn encode_ident_span ( & mut self , def_id : DefId , ident : Ident ) {
2045
- record ! ( self . tables. def_ident_span[ def_id] <- ident. span) ;
2046
- }
2047
-
2048
2040
/// In some cases, along with the item itself, we also
2049
2041
/// encode some sub-items. Usually we want some info from the item
2050
2042
/// so it's easier to do that here then to wait until we would encounter
0 commit comments