@@ -218,40 +218,40 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a MetadataBlob, &'tcx Session) {
218
218
}
219
219
}
220
220
221
- impl < ' a , ' tcx > Metadata < ' a , ' tcx > for & ' a CrateMetadataRef < ' a > {
221
+ impl < ' a , ' tcx > Metadata < ' a , ' tcx > for CrateMetadataRef < ' a > {
222
222
#[ inline]
223
223
fn blob ( self ) -> & ' a MetadataBlob {
224
- & self . blob
224
+ & self . cdata . blob
225
225
}
226
226
#[ inline]
227
227
fn cdata ( self ) -> Option < CrateMetadataRef < ' a > > {
228
- Some ( * self )
228
+ Some ( self )
229
229
}
230
230
}
231
231
232
- impl < ' a , ' tcx > Metadata < ' a , ' tcx > for ( & ' a CrateMetadataRef < ' a > , & ' tcx Session ) {
232
+ impl < ' a , ' tcx > Metadata < ' a , ' tcx > for ( CrateMetadataRef < ' a > , & ' tcx Session ) {
233
233
#[ inline]
234
234
fn blob ( self ) -> & ' a MetadataBlob {
235
- & self . 0 . blob
235
+ & self . 0 . cdata . blob
236
236
}
237
237
#[ inline]
238
238
fn cdata ( self ) -> Option < CrateMetadataRef < ' a > > {
239
- Some ( * self . 0 )
239
+ Some ( self . 0 )
240
240
}
241
241
#[ inline]
242
242
fn sess ( self ) -> Option < & ' tcx Session > {
243
- Some ( & self . 1 )
243
+ Some ( self . 1 )
244
244
}
245
245
}
246
246
247
- impl < ' a , ' tcx > Metadata < ' a , ' tcx > for ( & ' a CrateMetadataRef < ' a > , TyCtxt < ' tcx > ) {
247
+ impl < ' a , ' tcx > Metadata < ' a , ' tcx > for ( CrateMetadataRef < ' a > , TyCtxt < ' tcx > ) {
248
248
#[ inline]
249
249
fn blob ( self ) -> & ' a MetadataBlob {
250
- & self . 0 . blob
250
+ & self . 0 . cdata . blob
251
251
}
252
252
#[ inline]
253
253
fn cdata ( self ) -> Option < CrateMetadataRef < ' a > > {
254
- Some ( * self . 0 )
254
+ Some ( self . 0 )
255
255
}
256
256
#[ inline]
257
257
fn tcx ( self ) -> Option < TyCtxt < ' tcx > > {
@@ -414,9 +414,9 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for SyntaxContext {
414
414
Ok ( cdata
415
415
. root
416
416
. syntax_contexts
417
- . get ( & cdata, id)
417
+ . get ( cdata, id)
418
418
. unwrap_or_else ( || panic ! ( "Missing SyntaxContext {:?} for crate {:?}" , id, cname) )
419
- . decode ( ( & cdata, sess) ) )
419
+ . decode ( ( cdata, sess) ) )
420
420
} )
421
421
}
422
422
}
@@ -442,15 +442,15 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for ExpnId {
442
442
let expn_data = crate_data
443
443
. root
444
444
. expn_data
445
- . get ( & crate_data, index)
445
+ . get ( crate_data, index)
446
446
. unwrap ( )
447
- . decode ( ( & crate_data, sess) ) ;
447
+ . decode ( ( crate_data, sess) ) ;
448
448
let expn_hash = crate_data
449
449
. root
450
450
. expn_hashes
451
- . get ( & crate_data, index)
451
+ . get ( crate_data, index)
452
452
. unwrap ( )
453
- . decode ( ( & crate_data, sess) ) ;
453
+ . decode ( ( crate_data, sess) ) ;
454
454
( expn_data, expn_hash)
455
455
} ) ;
456
456
Ok ( expn_id)
@@ -706,7 +706,7 @@ impl CrateRoot<'_> {
706
706
}
707
707
708
708
impl < ' a , ' tcx > CrateMetadataRef < ' a > {
709
- fn raw_proc_macro ( & self , id : DefIndex ) -> & ProcMacro {
709
+ fn raw_proc_macro ( self , id : DefIndex ) -> & ' a ProcMacro {
710
710
// DefIndex's in root.proc_macro_data have a one-to-one correspondence
711
711
// with items in 'raw_proc_macros'.
712
712
let pos = self
@@ -721,7 +721,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
721
721
& self . raw_proc_macros . unwrap ( ) [ pos]
722
722
}
723
723
724
- fn opt_item_ident ( & self , item_index : DefIndex , sess : & Session ) -> Option < Ident > {
724
+ fn opt_item_ident ( self , item_index : DefIndex , sess : & Session ) -> Option < Ident > {
725
725
let name = self . def_key ( item_index) . disambiguated_data . data . get_opt_name ( ) ?;
726
726
let span = match self . root . tables . ident_span . get ( self , item_index) {
727
727
Some ( lazy_span) => lazy_span. decode ( ( self , sess) ) ,
@@ -737,15 +737,15 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
737
737
Some ( Ident :: new ( name, span) )
738
738
}
739
739
740
- fn item_ident ( & self , item_index : DefIndex , sess : & Session ) -> Ident {
740
+ fn item_ident ( self , item_index : DefIndex , sess : & Session ) -> Ident {
741
741
self . opt_item_ident ( item_index, sess) . expect ( "no encoded ident for item" )
742
742
}
743
743
744
- fn maybe_kind ( & self , item_id : DefIndex ) -> Option < EntryKind > {
744
+ fn maybe_kind ( self , item_id : DefIndex ) -> Option < EntryKind > {
745
745
self . root . tables . kind . get ( self , item_id) . map ( |k| k. decode ( self ) )
746
746
}
747
747
748
- fn kind ( & self , item_id : DefIndex ) -> EntryKind {
748
+ fn kind ( self , item_id : DefIndex ) -> EntryKind {
749
749
self . maybe_kind ( item_id) . unwrap_or_else ( || {
750
750
bug ! (
751
751
"CrateMetadata::kind({:?}): id not found, in crate {:?} with number {}" ,
@@ -756,7 +756,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
756
756
} )
757
757
}
758
758
759
- fn def_kind ( & self , item_id : DefIndex ) -> DefKind {
759
+ fn def_kind ( self , item_id : DefIndex ) -> DefKind {
760
760
self . root . tables . def_kind . get ( self , item_id) . map ( |k| k. decode ( self ) ) . unwrap_or_else ( || {
761
761
bug ! (
762
762
"CrateMetadata::def_kind({:?}): id not found, in crate {:?} with number {}" ,
@@ -767,7 +767,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
767
767
} )
768
768
}
769
769
770
- fn get_span ( & self , index : DefIndex , sess : & Session ) -> Span {
770
+ fn get_span ( self , index : DefIndex , sess : & Session ) -> Span {
771
771
self . root
772
772
. tables
773
773
. span
@@ -776,7 +776,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
776
776
. decode ( ( self , sess) )
777
777
}
778
778
779
- fn load_proc_macro ( & self , id : DefIndex , sess : & Session ) -> SyntaxExtension {
779
+ fn load_proc_macro ( self , id : DefIndex , sess : & Session ) -> SyntaxExtension {
780
780
let ( name, kind, helper_attrs) = match * self . raw_proc_macro ( id) {
781
781
ProcMacro :: CustomDerive { trait_name, attributes, client } => {
782
782
let helper_attrs =
@@ -807,7 +807,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
807
807
)
808
808
}
809
809
810
- fn get_trait_def ( & self , item_id : DefIndex , sess : & Session ) -> ty:: TraitDef {
810
+ fn get_trait_def ( self , item_id : DefIndex , sess : & Session ) -> ty:: TraitDef {
811
811
match self . kind ( item_id) {
812
812
EntryKind :: Trait ( data) => {
813
813
let data = data. decode ( ( self , sess) ) ;
@@ -837,7 +837,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
837
837
}
838
838
839
839
fn get_variant (
840
- & self ,
840
+ self ,
841
841
kind : & EntryKind ,
842
842
index : DefIndex ,
843
843
parent_did : DefId ,
@@ -886,7 +886,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
886
886
)
887
887
}
888
888
889
- fn get_adt_def ( & self , item_id : DefIndex , tcx : TyCtxt < ' tcx > ) -> & ' tcx ty:: AdtDef {
889
+ fn get_adt_def ( self , item_id : DefIndex , tcx : TyCtxt < ' tcx > ) -> & ' tcx ty:: AdtDef {
890
890
let kind = self . kind ( item_id) ;
891
891
let did = self . local_def_id ( item_id) ;
892
892
@@ -914,15 +914,15 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
914
914
}
915
915
916
916
fn get_explicit_predicates (
917
- & self ,
917
+ self ,
918
918
item_id : DefIndex ,
919
919
tcx : TyCtxt < ' tcx > ,
920
920
) -> ty:: GenericPredicates < ' tcx > {
921
921
self . root . tables . explicit_predicates . get ( self , item_id) . unwrap ( ) . decode ( ( self , tcx) )
922
922
}
923
923
924
924
fn get_inferred_outlives (
925
- & self ,
925
+ self ,
926
926
item_id : DefIndex ,
927
927
tcx : TyCtxt < ' tcx > ,
928
928
) -> & ' tcx [ ( ty:: Predicate < ' tcx > , Span ) ] {
@@ -935,15 +935,15 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
935
935
}
936
936
937
937
fn get_super_predicates (
938
- & self ,
938
+ self ,
939
939
item_id : DefIndex ,
940
940
tcx : TyCtxt < ' tcx > ,
941
941
) -> ty:: GenericPredicates < ' tcx > {
942
942
self . root . tables . super_predicates . get ( self , item_id) . unwrap ( ) . decode ( ( self , tcx) )
943
943
}
944
944
945
945
fn get_explicit_item_bounds (
946
- & self ,
946
+ self ,
947
947
item_id : DefIndex ,
948
948
tcx : TyCtxt < ' tcx > ,
949
949
) -> & ' tcx [ ( ty:: Predicate < ' tcx > , Span ) ] {
@@ -955,11 +955,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
955
955
. unwrap_or_default ( )
956
956
}
957
957
958
- fn get_generics ( & self , item_id : DefIndex , sess : & Session ) -> ty:: Generics {
958
+ fn get_generics ( self , item_id : DefIndex , sess : & Session ) -> ty:: Generics {
959
959
self . root . tables . generics . get ( self , item_id) . unwrap ( ) . decode ( ( self , sess) )
960
960
}
961
961
962
- fn get_type ( & self , id : DefIndex , tcx : TyCtxt < ' tcx > ) -> Ty < ' tcx > {
962
+ fn get_type ( self , id : DefIndex , tcx : TyCtxt < ' tcx > ) -> Ty < ' tcx > {
963
963
self . root
964
964
. tables
965
965
. ty
@@ -968,78 +968,78 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
968
968
. decode ( ( self , tcx) )
969
969
}
970
970
971
- fn get_stability ( & self , id : DefIndex ) -> Option < attr:: Stability > {
971
+ fn get_stability ( self , id : DefIndex ) -> Option < attr:: Stability > {
972
972
self . root . tables . stability . get ( self , id) . map ( |stab| stab. decode ( self ) )
973
973
}
974
974
975
- fn get_const_stability ( & self , id : DefIndex ) -> Option < attr:: ConstStability > {
975
+ fn get_const_stability ( self , id : DefIndex ) -> Option < attr:: ConstStability > {
976
976
self . root . tables . const_stability . get ( self , id) . map ( |stab| stab. decode ( self ) )
977
977
}
978
978
979
- fn get_deprecation ( & self , id : DefIndex ) -> Option < attr:: Deprecation > {
979
+ fn get_deprecation ( self , id : DefIndex ) -> Option < attr:: Deprecation > {
980
980
self . root . tables . deprecation . get ( self , id) . map ( |depr| depr. decode ( self ) )
981
981
}
982
982
983
- fn get_visibility ( & self , id : DefIndex ) -> ty:: Visibility {
983
+ fn get_visibility ( self , id : DefIndex ) -> ty:: Visibility {
984
984
self . root . tables . visibility . get ( self , id) . unwrap ( ) . decode ( self )
985
985
}
986
986
987
- fn get_impl_data ( & self , id : DefIndex ) -> ImplData {
987
+ fn get_impl_data ( self , id : DefIndex ) -> ImplData {
988
988
match self . kind ( id) {
989
989
EntryKind :: Impl ( data) => data. decode ( self ) ,
990
990
_ => bug ! ( ) ,
991
991
}
992
992
}
993
993
994
- fn get_parent_impl ( & self , id : DefIndex ) -> Option < DefId > {
994
+ fn get_parent_impl ( self , id : DefIndex ) -> Option < DefId > {
995
995
self . get_impl_data ( id) . parent_impl
996
996
}
997
997
998
- fn get_impl_polarity ( & self , id : DefIndex ) -> ty:: ImplPolarity {
998
+ fn get_impl_polarity ( self , id : DefIndex ) -> ty:: ImplPolarity {
999
999
self . get_impl_data ( id) . polarity
1000
1000
}
1001
1001
1002
- fn get_impl_defaultness ( & self , id : DefIndex ) -> hir:: Defaultness {
1002
+ fn get_impl_defaultness ( self , id : DefIndex ) -> hir:: Defaultness {
1003
1003
self . get_impl_data ( id) . defaultness
1004
1004
}
1005
1005
1006
- fn get_impl_constness ( & self , id : DefIndex ) -> hir:: Constness {
1006
+ fn get_impl_constness ( self , id : DefIndex ) -> hir:: Constness {
1007
1007
self . get_impl_data ( id) . constness
1008
1008
}
1009
1009
1010
- fn get_trait_item_def_id ( & self , id : DefIndex ) -> Option < DefId > {
1010
+ fn get_trait_item_def_id ( self , id : DefIndex ) -> Option < DefId > {
1011
1011
self . root . tables . trait_item_def_id . get ( self , id) . map ( |d| d. decode ( self ) )
1012
1012
}
1013
1013
1014
- fn get_coerce_unsized_info ( & self , id : DefIndex ) -> Option < ty:: adjustment:: CoerceUnsizedInfo > {
1014
+ fn get_coerce_unsized_info ( self , id : DefIndex ) -> Option < ty:: adjustment:: CoerceUnsizedInfo > {
1015
1015
self . get_impl_data ( id) . coerce_unsized_info
1016
1016
}
1017
1017
1018
- fn get_impl_trait ( & self , id : DefIndex , tcx : TyCtxt < ' tcx > ) -> Option < ty:: TraitRef < ' tcx > > {
1018
+ fn get_impl_trait ( self , id : DefIndex , tcx : TyCtxt < ' tcx > ) -> Option < ty:: TraitRef < ' tcx > > {
1019
1019
self . root . tables . impl_trait_ref . get ( self , id) . map ( |tr| tr. decode ( ( self , tcx) ) )
1020
1020
}
1021
1021
1022
- fn get_expn_that_defined ( & self , id : DefIndex , sess : & Session ) -> ExpnId {
1022
+ fn get_expn_that_defined ( self , id : DefIndex , sess : & Session ) -> ExpnId {
1023
1023
self . root . tables . expn_that_defined . get ( self , id) . unwrap ( ) . decode ( ( self , sess) )
1024
1024
}
1025
1025
1026
1026
fn get_const_param_default (
1027
- & self ,
1027
+ self ,
1028
1028
tcx : TyCtxt < ' tcx > ,
1029
1029
id : DefIndex ,
1030
1030
) -> rustc_middle:: ty:: Const < ' tcx > {
1031
1031
self . root . tables . const_defaults . get ( self , id) . unwrap ( ) . decode ( ( self , tcx) )
1032
1032
}
1033
1033
1034
1034
/// Iterates over all the stability attributes in the given crate.
1035
- fn get_lib_features ( & self , tcx : TyCtxt < ' tcx > ) -> & ' tcx [ ( Symbol , Option < Symbol > ) ] {
1035
+ fn get_lib_features ( self , tcx : TyCtxt < ' tcx > ) -> & ' tcx [ ( Symbol , Option < Symbol > ) ] {
1036
1036
// FIXME: For a proc macro crate, not sure whether we should return the "host"
1037
1037
// features or an empty Vec. Both don't cause ICEs.
1038
1038
tcx. arena . alloc_from_iter ( self . root . lib_features . decode ( self ) )
1039
1039
}
1040
1040
1041
1041
/// Iterates over the language items in the given crate.
1042
- fn get_lang_items ( & self , tcx : TyCtxt < ' tcx > ) -> & ' tcx [ ( DefId , usize ) ] {
1042
+ fn get_lang_items ( self , tcx : TyCtxt < ' tcx > ) -> & ' tcx [ ( DefId , usize ) ] {
1043
1043
if self . root . is_proc_macro_crate ( ) {
1044
1044
// Proc macro crates do not export any lang-items to the target.
1045
1045
& [ ]
@@ -1054,7 +1054,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1054
1054
}
1055
1055
1056
1056
/// Iterates over the diagnostic items in the given crate.
1057
- fn get_diagnostic_items ( & self ) -> DiagnosticItems {
1057
+ fn get_diagnostic_items ( self ) -> DiagnosticItems {
1058
1058
if self . root . is_proc_macro_crate ( ) {
1059
1059
// Proc macro crates do not export any diagnostic-items to the target.
1060
1060
Default :: default ( )
@@ -1079,7 +1079,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1079
1079
/// Module here is understood in name resolution sense - it can be a `mod` item,
1080
1080
/// or a crate root, or an enum, or a trait.
1081
1081
fn for_each_module_child (
1082
- & self ,
1082
+ self ,
1083
1083
id : DefIndex ,
1084
1084
mut callback : impl FnMut ( ModChild ) ,
1085
1085
sess : & Session ,
@@ -1177,15 +1177,15 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1177
1177
}
1178
1178
}
1179
1179
1180
- fn is_ctfe_mir_available ( & self , id : DefIndex ) -> bool {
1180
+ fn is_ctfe_mir_available ( self , id : DefIndex ) -> bool {
1181
1181
self . root . tables . mir_for_ctfe . get ( self , id) . is_some ( )
1182
1182
}
1183
1183
1184
- fn is_item_mir_available ( & self , id : DefIndex ) -> bool {
1184
+ fn is_item_mir_available ( self , id : DefIndex ) -> bool {
1185
1185
self . root . tables . mir . get ( self , id) . is_some ( )
1186
1186
}
1187
1187
1188
- fn module_expansion ( & self , id : DefIndex , sess : & Session ) -> ExpnId {
1188
+ fn module_expansion ( self , id : DefIndex , sess : & Session ) -> ExpnId {
1189
1189
match self . kind ( id) {
1190
1190
EntryKind :: Mod ( _) | EntryKind :: Enum ( _) | EntryKind :: Trait ( _) => {
1191
1191
self . get_expn_that_defined ( id, sess)
@@ -1194,7 +1194,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1194
1194
}
1195
1195
}
1196
1196
1197
- fn get_optimized_mir ( & self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> Body < ' tcx > {
1197
+ fn get_optimized_mir ( self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> Body < ' tcx > {
1198
1198
self . root
1199
1199
. tables
1200
1200
. mir
@@ -1205,7 +1205,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1205
1205
. decode ( ( self , tcx) )
1206
1206
}
1207
1207
1208
- fn get_mir_for_ctfe ( & self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> Body < ' tcx > {
1208
+ fn get_mir_for_ctfe ( self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> Body < ' tcx > {
1209
1209
self . root
1210
1210
. tables
1211
1211
. mir_for_ctfe
@@ -1217,7 +1217,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1217
1217
}
1218
1218
1219
1219
fn get_thir_abstract_const (
1220
- & self ,
1220
+ self ,
1221
1221
tcx : TyCtxt < ' tcx > ,
1222
1222
id : DefIndex ,
1223
1223
) -> Result < Option < & ' tcx [ thir:: abstract_const:: Node < ' tcx > ] > , ErrorReported > {
@@ -1228,7 +1228,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1228
1228
. map_or ( Ok ( None ) , |v| Ok ( Some ( v. decode ( ( self , tcx) ) ) ) )
1229
1229
}
1230
1230
1231
- fn get_unused_generic_params ( & self , id : DefIndex ) -> FiniteBitSet < u32 > {
1231
+ fn get_unused_generic_params ( self , id : DefIndex ) -> FiniteBitSet < u32 > {
1232
1232
self . root
1233
1233
. tables
1234
1234
. unused_generic_params
@@ -1237,7 +1237,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1237
1237
. unwrap_or_default ( )
1238
1238
}
1239
1239
1240
- fn get_promoted_mir ( & self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> IndexVec < Promoted , Body < ' tcx > > {
1240
+ fn get_promoted_mir ( self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> IndexVec < Promoted , Body < ' tcx > > {
1241
1241
self . root
1242
1242
. tables
1243
1243
. promoted_mir
@@ -1248,7 +1248,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1248
1248
. decode ( ( self , tcx) )
1249
1249
}
1250
1250
1251
- fn mir_const_qualif ( & self , id : DefIndex ) -> mir:: ConstQualifs {
1251
+ fn mir_const_qualif ( self , id : DefIndex ) -> mir:: ConstQualifs {
1252
1252
match self . kind ( id) {
1253
1253
EntryKind :: AnonConst ( qualif, _)
1254
1254
| EntryKind :: Const ( qualif, _)
@@ -1263,14 +1263,14 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1263
1263
}
1264
1264
}
1265
1265
1266
- fn get_fn_has_self_parameter ( & self , id : DefIndex ) -> bool {
1266
+ fn get_fn_has_self_parameter ( self , id : DefIndex ) -> bool {
1267
1267
match self . kind ( id) {
1268
1268
EntryKind :: AssocFn ( data) => data. decode ( self ) . has_self ,
1269
1269
_ => false ,
1270
1270
}
1271
1271
}
1272
1272
1273
- fn get_associated_item_def_ids ( & self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> & ' tcx [ DefId ] {
1273
+ fn get_associated_item_def_ids ( self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> & ' tcx [ DefId ] {
1274
1274
if let Some ( children) = self . root . tables . children . get ( self , id) {
1275
1275
tcx. arena . alloc_from_iter (
1276
1276
children. decode ( ( self , tcx. sess ) ) . map ( |child_index| self . local_def_id ( child_index) ) ,
@@ -1280,7 +1280,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1280
1280
}
1281
1281
}
1282
1282
1283
- fn get_associated_item ( & self , id : DefIndex , sess : & Session ) -> ty:: AssocItem {
1283
+ fn get_associated_item ( self , id : DefIndex , sess : & Session ) -> ty:: AssocItem {
1284
1284
let def_key = self . def_key ( id) ;
1285
1285
let parent = self . local_def_id ( def_key. parent . unwrap ( ) ) ;
1286
1286
let ident = self . item_ident ( id, sess) ;
@@ -1307,11 +1307,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1307
1307
}
1308
1308
}
1309
1309
1310
- fn get_item_variances ( & ' a self , id : DefIndex ) -> impl Iterator < Item = ty:: Variance > + ' a {
1310
+ fn get_item_variances ( self , id : DefIndex ) -> impl Iterator < Item = ty:: Variance > + ' a {
1311
1311
self . root . tables . variances . get ( self , id) . unwrap_or_else ( Lazy :: empty) . decode ( self )
1312
1312
}
1313
1313
1314
- fn get_ctor_def_id_and_kind ( & self , node_id : DefIndex ) -> Option < ( DefId , CtorKind ) > {
1314
+ fn get_ctor_def_id_and_kind ( self , node_id : DefIndex ) -> Option < ( DefId , CtorKind ) > {
1315
1315
match self . kind ( node_id) {
1316
1316
EntryKind :: Struct ( data, _) | EntryKind :: Variant ( data) => {
1317
1317
let vdata = data. decode ( self ) ;
@@ -1322,7 +1322,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1322
1322
}
1323
1323
1324
1324
fn get_item_attrs (
1325
- & ' a self ,
1325
+ self ,
1326
1326
id : DefIndex ,
1327
1327
sess : & ' a Session ,
1328
1328
) -> impl Iterator < Item = ast:: Attribute > + ' a {
@@ -1346,7 +1346,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1346
1346
. decode ( ( self , sess) )
1347
1347
}
1348
1348
1349
- fn get_struct_field_names ( & self , id : DefIndex , sess : & Session ) -> Vec < Spanned < Symbol > > {
1349
+ fn get_struct_field_names ( self , id : DefIndex , sess : & Session ) -> Vec < Spanned < Symbol > > {
1350
1350
self . root
1351
1351
. tables
1352
1352
. children
@@ -1357,7 +1357,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1357
1357
. collect ( )
1358
1358
}
1359
1359
1360
- fn get_struct_field_visibilities ( & self , id : DefIndex ) -> Vec < Visibility > {
1360
+ fn get_struct_field_visibilities ( self , id : DefIndex ) -> Vec < Visibility > {
1361
1361
self . root
1362
1362
. tables
1363
1363
. children
@@ -1369,7 +1369,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1369
1369
}
1370
1370
1371
1371
fn get_inherent_implementations_for_type (
1372
- & self ,
1372
+ self ,
1373
1373
tcx : TyCtxt < ' tcx > ,
1374
1374
id : DefIndex ,
1375
1375
) -> & ' tcx [ DefId ] {
@@ -1384,20 +1384,20 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1384
1384
)
1385
1385
}
1386
1386
1387
- fn get_traits ( & ' a self ) -> impl Iterator < Item = DefId > + ' a {
1388
- self . root . traits . decode ( self ) . map ( |index| self . local_def_id ( index) )
1387
+ fn get_traits ( self ) -> impl Iterator < Item = DefId > + ' a {
1388
+ self . root . traits . decode ( self ) . map ( move |index| self . local_def_id ( index) )
1389
1389
}
1390
1390
1391
- fn get_trait_impls ( & ' a self ) -> impl Iterator < Item = ( DefId , Option < SimplifiedType > ) > + ' a {
1392
- self . trait_impls . values ( ) . flat_map ( move |impls| {
1391
+ fn get_trait_impls ( self ) -> impl Iterator < Item = ( DefId , Option < SimplifiedType > ) > + ' a {
1392
+ self . cdata . trait_impls . values ( ) . flat_map ( move |impls| {
1393
1393
impls
1394
1394
. decode ( self )
1395
- . map ( |( idx, simplified_self_ty) | ( self . local_def_id ( idx) , simplified_self_ty) )
1395
+ . map ( move |( idx, simplified_self_ty) | ( self . local_def_id ( idx) , simplified_self_ty) )
1396
1396
} )
1397
1397
}
1398
1398
1399
1399
fn get_implementations_of_trait (
1400
- & self ,
1400
+ self ,
1401
1401
tcx : TyCtxt < ' tcx > ,
1402
1402
trait_def_id : DefId ,
1403
1403
) -> & ' tcx [ ( DefId , Option < SimplifiedType > ) ] {
@@ -1424,7 +1424,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1424
1424
}
1425
1425
}
1426
1426
1427
- fn get_trait_of_item ( & self , id : DefIndex ) -> Option < DefId > {
1427
+ fn get_trait_of_item ( self , id : DefIndex ) -> Option < DefId > {
1428
1428
let def_key = self . def_key ( id) ;
1429
1429
match def_key. disambiguated_data . data {
1430
1430
DefPathData :: TypeNs ( ..) | DefPathData :: ValueNs ( ..) => ( ) ,
@@ -1437,7 +1437,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1437
1437
} )
1438
1438
}
1439
1439
1440
- fn get_native_libraries ( & self , sess : & Session ) -> Vec < NativeLib > {
1440
+ fn get_native_libraries ( self , sess : & Session ) -> Vec < NativeLib > {
1441
1441
if self . root . is_proc_macro_crate ( ) {
1442
1442
// Proc macro crates do not have any *target* native libraries.
1443
1443
vec ! [ ]
@@ -1446,7 +1446,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1446
1446
}
1447
1447
}
1448
1448
1449
- fn get_proc_macro_quoted_span ( & self , index : usize , sess : & Session ) -> Span {
1449
+ fn get_proc_macro_quoted_span ( self , index : usize , sess : & Session ) -> Span {
1450
1450
self . root
1451
1451
. tables
1452
1452
. proc_macro_quoted_spans
@@ -1455,7 +1455,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1455
1455
. decode ( ( self , sess) )
1456
1456
}
1457
1457
1458
- fn get_foreign_modules ( & self , tcx : TyCtxt < ' tcx > ) -> Lrc < FxHashMap < DefId , ForeignModule > > {
1458
+ fn get_foreign_modules ( self , tcx : TyCtxt < ' tcx > ) -> Lrc < FxHashMap < DefId , ForeignModule > > {
1459
1459
if self . root . is_proc_macro_crate ( ) {
1460
1460
// Proc macro crates do not have any *target* foreign modules.
1461
1461
Lrc :: new ( FxHashMap :: default ( ) )
@@ -1467,7 +1467,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1467
1467
}
1468
1468
1469
1469
fn get_dylib_dependency_formats (
1470
- & self ,
1470
+ self ,
1471
1471
tcx : TyCtxt < ' tcx > ,
1472
1472
) -> & ' tcx [ ( CrateNum , LinkagePreference ) ] {
1473
1473
tcx. arena . alloc_from_iter (
@@ -1478,7 +1478,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1478
1478
)
1479
1479
}
1480
1480
1481
- fn get_missing_lang_items ( & self , tcx : TyCtxt < ' tcx > ) -> & ' tcx [ lang_items:: LangItem ] {
1481
+ fn get_missing_lang_items ( self , tcx : TyCtxt < ' tcx > ) -> & ' tcx [ lang_items:: LangItem ] {
1482
1482
if self . root . is_proc_macro_crate ( ) {
1483
1483
// Proc macro crates do not depend on any target weak lang-items.
1484
1484
& [ ]
@@ -1487,7 +1487,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1487
1487
}
1488
1488
}
1489
1489
1490
- fn get_fn_param_names ( & self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> & ' tcx [ Ident ] {
1490
+ fn get_fn_param_names ( self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> & ' tcx [ Ident ] {
1491
1491
let param_names = match self . kind ( id) {
1492
1492
EntryKind :: Fn ( data) | EntryKind :: ForeignFn ( data) => data. decode ( self ) . param_names ,
1493
1493
EntryKind :: AssocFn ( data) => data. decode ( self ) . fn_data . param_names ,
@@ -1497,7 +1497,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1497
1497
}
1498
1498
1499
1499
fn exported_symbols (
1500
- & self ,
1500
+ self ,
1501
1501
tcx : TyCtxt < ' tcx > ,
1502
1502
) -> & ' tcx [ ( ExportedSymbol < ' tcx > , SymbolExportLevel ) ] {
1503
1503
if self . root . is_proc_macro_crate ( ) {
@@ -1509,7 +1509,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1509
1509
}
1510
1510
}
1511
1511
1512
- fn get_rendered_const ( & self , id : DefIndex ) -> String {
1512
+ fn get_rendered_const ( self , id : DefIndex ) -> String {
1513
1513
match self . kind ( id) {
1514
1514
EntryKind :: AnonConst ( _, data)
1515
1515
| EntryKind :: Const ( _, data)
@@ -1518,7 +1518,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1518
1518
}
1519
1519
}
1520
1520
1521
- fn get_macro ( & self , id : DefIndex , sess : & Session ) -> MacroDef {
1521
+ fn get_macro ( self , id : DefIndex , sess : & Session ) -> MacroDef {
1522
1522
match self . kind ( id) {
1523
1523
EntryKind :: MacroDef ( macro_def) => macro_def. decode ( ( self , sess) ) ,
1524
1524
_ => bug ! ( ) ,
@@ -1527,7 +1527,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1527
1527
1528
1528
// This replicates some of the logic of the crate-local `is_const_fn_raw` query, because we
1529
1529
// don't serialize constness for tuple variant and tuple struct constructors.
1530
- fn is_const_fn_raw ( & self , id : DefIndex ) -> bool {
1530
+ fn is_const_fn_raw ( self , id : DefIndex ) -> bool {
1531
1531
let constness = match self . kind ( id) {
1532
1532
EntryKind :: AssocFn ( data) => data. decode ( self ) . fn_data . constness ,
1533
1533
EntryKind :: Fn ( data) => data. decode ( self ) . constness ,
@@ -1538,7 +1538,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1538
1538
constness == hir:: Constness :: Const
1539
1539
}
1540
1540
1541
- fn asyncness ( & self , id : DefIndex ) -> hir:: IsAsync {
1541
+ fn asyncness ( self , id : DefIndex ) -> hir:: IsAsync {
1542
1542
match self . kind ( id) {
1543
1543
EntryKind :: Fn ( data) => data. decode ( self ) . asyncness ,
1544
1544
EntryKind :: AssocFn ( data) => data. decode ( self ) . fn_data . asyncness ,
@@ -1547,7 +1547,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1547
1547
}
1548
1548
}
1549
1549
1550
- fn is_foreign_item ( & self , id : DefIndex ) -> bool {
1550
+ fn is_foreign_item ( self , id : DefIndex ) -> bool {
1551
1551
match self . kind ( id) {
1552
1552
EntryKind :: ForeignImmStatic | EntryKind :: ForeignMutStatic | EntryKind :: ForeignFn ( _) => {
1553
1553
true
@@ -1556,27 +1556,27 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1556
1556
}
1557
1557
}
1558
1558
1559
- fn static_mutability ( & self , id : DefIndex ) -> Option < hir:: Mutability > {
1559
+ fn static_mutability ( self , id : DefIndex ) -> Option < hir:: Mutability > {
1560
1560
match self . kind ( id) {
1561
1561
EntryKind :: ImmStatic | EntryKind :: ForeignImmStatic => Some ( hir:: Mutability :: Not ) ,
1562
1562
EntryKind :: MutStatic | EntryKind :: ForeignMutStatic => Some ( hir:: Mutability :: Mut ) ,
1563
1563
_ => None ,
1564
1564
}
1565
1565
}
1566
1566
1567
- fn generator_kind ( & self , id : DefIndex ) -> Option < hir:: GeneratorKind > {
1567
+ fn generator_kind ( self , id : DefIndex ) -> Option < hir:: GeneratorKind > {
1568
1568
match self . kind ( id) {
1569
1569
EntryKind :: Generator ( data) => Some ( data) ,
1570
1570
_ => None ,
1571
1571
}
1572
1572
}
1573
1573
1574
- fn fn_sig ( & self , id : DefIndex , tcx : TyCtxt < ' tcx > ) -> ty:: PolyFnSig < ' tcx > {
1574
+ fn fn_sig ( self , id : DefIndex , tcx : TyCtxt < ' tcx > ) -> ty:: PolyFnSig < ' tcx > {
1575
1575
self . root . tables . fn_sig . get ( self , id) . unwrap ( ) . decode ( ( self , tcx) )
1576
1576
}
1577
1577
1578
1578
#[ inline]
1579
- fn def_key ( & self , index : DefIndex ) -> DefKey {
1579
+ fn def_key ( self , index : DefIndex ) -> DefKey {
1580
1580
* self
1581
1581
. def_key_cache
1582
1582
. lock ( )
@@ -1585,13 +1585,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1585
1585
}
1586
1586
1587
1587
// Returns the path leading to the thing with this `id`.
1588
- fn def_path ( & self , id : DefIndex ) -> DefPath {
1588
+ fn def_path ( self , id : DefIndex ) -> DefPath {
1589
1589
debug ! ( "def_path(cnum={:?}, id={:?})" , self . cnum, id) ;
1590
1590
DefPath :: make ( self . cnum , id, |parent| self . def_key ( parent) )
1591
1591
}
1592
1592
1593
1593
fn def_path_hash_unlocked (
1594
- & self ,
1594
+ self ,
1595
1595
index : DefIndex ,
1596
1596
def_path_hashes : & mut FxHashMap < DefIndex , DefPathHash > ,
1597
1597
) -> DefPathHash {
@@ -1601,17 +1601,17 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1601
1601
}
1602
1602
1603
1603
#[ inline]
1604
- fn def_path_hash ( & self , index : DefIndex ) -> DefPathHash {
1604
+ fn def_path_hash ( self , index : DefIndex ) -> DefPathHash {
1605
1605
let mut def_path_hashes = self . def_path_hash_cache . lock ( ) ;
1606
1606
self . def_path_hash_unlocked ( index, & mut def_path_hashes)
1607
1607
}
1608
1608
1609
1609
#[ inline]
1610
- fn def_path_hash_to_def_index ( & self , hash : DefPathHash ) -> DefIndex {
1610
+ fn def_path_hash_to_def_index ( self , hash : DefPathHash ) -> DefIndex {
1611
1611
self . def_path_hash_map . def_path_hash_to_def_index ( & hash)
1612
1612
}
1613
1613
1614
- fn expn_hash_to_expn_id ( & self , sess : & Session , index_guess : u32 , hash : ExpnHash ) -> ExpnId {
1614
+ fn expn_hash_to_expn_id ( self , sess : & Session , index_guess : u32 , hash : ExpnHash ) -> ExpnId {
1615
1615
debug_assert_eq ! ( ExpnId :: from_hash( hash) , None ) ;
1616
1616
let index_guess = ExpnIndex :: from_u32 ( index_guess) ;
1617
1617
let old_hash = self . root . expn_hashes . get ( self , index_guess) . map ( |lazy| lazy. decode ( self ) ) ;
@@ -1669,7 +1669,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1669
1669
///
1670
1670
/// Proc macro crates don't currently export spans, so this function does not have
1671
1671
/// to work for them.
1672
- fn imported_source_files ( & self , sess : & Session ) -> & ' a [ ImportedSourceFile ] {
1672
+ fn imported_source_files ( self , sess : & Session ) -> & ' a [ ImportedSourceFile ] {
1673
1673
// Translate the virtual `/rustc/$hash` prefix back to a real directory
1674
1674
// that should hold actual sources, where possible.
1675
1675
//
0 commit comments