33use std:: ffi:: OsStr ;
44
55use rustc_ast:: tokenstream:: TokenStream ;
6- use rustc_hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE , LocalDefId , LocalModDefId , ModDefId } ;
7- use rustc_hir:: hir_id:: { HirId , OwnerId } ;
6+ use rustc_hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE , LocalDefId , LocalModDefId } ;
7+ use rustc_hir:: hir_id:: OwnerId ;
88use rustc_query_system:: dep_graph:: DepNodeIndex ;
99use rustc_query_system:: query:: { DefIdCache , DefaultCache , SingleCache , VecCache } ;
1010use rustc_span:: { DUMMY_SP , Ident , LocalExpnId , Span , Symbol } ;
1111
1212use crate :: infer:: canonical:: CanonicalQueryInput ;
1313use crate :: mir:: mono:: CollectionMode ;
1414use crate :: ty:: fast_reject:: SimplifiedType ;
15- use crate :: ty:: layout:: { TyAndLayout , ValidityRequirement } ;
15+ use crate :: ty:: layout:: ValidityRequirement ;
1616use crate :: ty:: { self , GenericArg , GenericArgsRef , Ty , TyCtxt } ;
1717use crate :: { mir, traits} ;
1818
@@ -69,15 +69,6 @@ impl<'tcx> Key for ty::InstanceKind<'tcx> {
6969 }
7070}
7171
72- impl < ' tcx > AsLocalKey for ty:: InstanceKind < ' tcx > {
73- type LocalKey = Self ;
74-
75- #[ inline( always) ]
76- fn as_local_key ( & self ) -> Option < Self :: LocalKey > {
77- self . def_id ( ) . is_local ( ) . then ( || * self )
78- }
79- }
80-
8172impl < ' tcx > Key for ty:: Instance < ' tcx > {
8273 fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
8374 tcx. def_span ( self . def_id ( ) )
@@ -176,26 +167,6 @@ impl Key for LocalModDefId {
176167 }
177168}
178169
179- impl Key for ModDefId {
180- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
181- tcx. def_span ( * self )
182- }
183-
184- #[ inline( always) ]
185- fn key_as_def_id ( & self ) -> Option < DefId > {
186- Some ( self . to_def_id ( ) )
187- }
188- }
189-
190- impl AsLocalKey for ModDefId {
191- type LocalKey = LocalModDefId ;
192-
193- #[ inline( always) ]
194- fn as_local_key ( & self ) -> Option < Self :: LocalKey > {
195- self . as_local ( )
196- }
197- }
198-
199170impl Key for SimplifiedType {
200171 fn default_span ( & self , _: TyCtxt < ' _ > ) -> Span {
201172 DUMMY_SP
@@ -208,30 +179,6 @@ impl Key for (DefId, DefId) {
208179 }
209180}
210181
211- impl < ' tcx > Key for ( ty:: Instance < ' tcx > , LocalDefId ) {
212- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
213- self . 0 . default_span ( tcx)
214- }
215- }
216-
217- impl Key for ( DefId , LocalDefId ) {
218- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
219- self . 1 . default_span ( tcx)
220- }
221- }
222-
223- impl Key for ( LocalDefId , DefId ) {
224- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
225- self . 0 . default_span ( tcx)
226- }
227- }
228-
229- impl Key for ( LocalDefId , LocalDefId ) {
230- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
231- self . 0 . default_span ( tcx)
232- }
233- }
234-
235182impl Key for ( DefId , Ident ) {
236183 fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
237184 tcx. def_span ( self . 0 )
@@ -279,12 +226,6 @@ impl AsLocalKey for (CrateNum, SimplifiedType) {
279226 }
280227}
281228
282- impl Key for ( DefId , SimplifiedType ) {
283- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
284- self . 0 . default_span ( tcx)
285- }
286- }
287-
288229impl Key for ( DefId , ty:: SizedTraitKind ) {
289230 fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
290231 self . 0 . default_span ( tcx)
@@ -303,66 +244,18 @@ impl<'tcx> Key for (DefId, GenericArgsRef<'tcx>) {
303244 }
304245}
305246
306- impl < ' tcx > Key for ( ty:: UnevaluatedConst < ' tcx > , ty:: UnevaluatedConst < ' tcx > ) {
307- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
308- ( self . 0 ) . def . default_span ( tcx)
309- }
310- }
311-
312- impl < ' tcx > Key for ( LocalDefId , DefId , GenericArgsRef < ' tcx > ) {
313- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
314- self . 0 . default_span ( tcx)
315- }
316- }
317-
318- impl < ' tcx > Key for ( ty:: ParamEnv < ' tcx > , ty:: TraitRef < ' tcx > ) {
319- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
320- tcx. def_span ( self . 1 . def_id )
321- }
322- }
323-
324- impl < ' tcx > Key for ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > {
325- fn default_span ( & self , _tcx : TyCtxt < ' _ > ) -> Span {
326- DUMMY_SP
327- }
328- }
329-
330247impl < ' tcx > Key for ty:: TraitRef < ' tcx > {
331248 fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
332249 tcx. def_span ( self . def_id )
333250 }
334251}
335252
336- impl < ' tcx > Key for ty:: PolyTraitRef < ' tcx > {
337- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
338- tcx. def_span ( self . def_id ( ) )
339- }
340- }
341-
342- impl < ' tcx > Key for ty:: PolyExistentialTraitRef < ' tcx > {
343- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
344- tcx. def_span ( self . def_id ( ) )
345- }
346- }
347-
348- impl < ' tcx > Key for ( ty:: PolyTraitRef < ' tcx > , ty:: PolyTraitRef < ' tcx > ) {
349- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
350- tcx. def_span ( self . 0 . def_id ( ) )
351- }
352- }
353-
354253impl < ' tcx > Key for GenericArg < ' tcx > {
355254 fn default_span ( & self , _: TyCtxt < ' _ > ) -> Span {
356255 DUMMY_SP
357256 }
358257}
359258
360- impl < ' tcx > Key for ty:: Const < ' tcx > {
361- fn default_span ( & self , _: TyCtxt < ' _ > ) -> Span {
362- DUMMY_SP
363- }
364- }
365-
366259impl < ' tcx > Key for Ty < ' tcx > {
367260 fn default_span ( & self , _: TyCtxt < ' _ > ) -> Span {
368261 DUMMY_SP
@@ -377,12 +270,6 @@ impl<'tcx> Key for Ty<'tcx> {
377270 }
378271}
379272
380- impl < ' tcx > Key for TyAndLayout < ' tcx > {
381- fn default_span ( & self , _: TyCtxt < ' _ > ) -> Span {
382- DUMMY_SP
383- }
384- }
385-
386273impl < ' tcx > Key for ( Ty < ' tcx > , Ty < ' tcx > ) {
387274 fn default_span ( & self , _: TyCtxt < ' _ > ) -> Span {
388275 DUMMY_SP
@@ -395,12 +282,6 @@ impl<'tcx> Key for ty::Clauses<'tcx> {
395282 }
396283}
397284
398- impl < ' tcx > Key for ty:: ParamEnv < ' tcx > {
399- fn default_span ( & self , _: TyCtxt < ' _ > ) -> Span {
400- DUMMY_SP
401- }
402- }
403-
404285impl < ' tcx , T : Key > Key for ty:: PseudoCanonicalInput < ' tcx , T > {
405286 fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
406287 self . value . default_span ( tcx)
@@ -443,18 +324,6 @@ impl<'tcx, T: Clone> Key for (CanonicalQueryInput<'tcx, T>, bool) {
443324 }
444325}
445326
446- impl Key for ( Symbol , u32 , u32 ) {
447- fn default_span ( & self , _tcx : TyCtxt < ' _ > ) -> Span {
448- DUMMY_SP
449- }
450- }
451-
452- impl < ' tcx > Key for ( DefId , Ty < ' tcx > , GenericArgsRef < ' tcx > , ty:: ParamEnv < ' tcx > ) {
453- fn default_span ( & self , _tcx : TyCtxt < ' _ > ) -> Span {
454- DUMMY_SP
455- }
456- }
457-
458327impl < ' tcx > Key for ( Ty < ' tcx > , rustc_abi:: VariantIdx ) {
459328 fn default_span ( & self , _tcx : TyCtxt < ' _ > ) -> Span {
460329 DUMMY_SP
@@ -485,39 +354,10 @@ impl<'tcx> Key for ty::Value<'tcx> {
485354 }
486355}
487356
488- impl Key for HirId {
489- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
490- tcx. hir_span ( * self )
491- }
492-
493- #[ inline( always) ]
494- fn key_as_def_id ( & self ) -> Option < DefId > {
495- None
496- }
497- }
498-
499- impl Key for ( LocalDefId , HirId ) {
500- fn default_span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
501- tcx. hir_span ( self . 1 )
502- }
503-
504- #[ inline( always) ]
505- fn key_as_def_id ( & self ) -> Option < DefId > {
506- Some ( self . 0 . into ( ) )
507- }
508- }
509-
510357impl < ' tcx > Key for ( LocalExpnId , & ' tcx TokenStream ) {
511- type Cache < V > = DefaultCache < Self , V > ;
512-
513358 fn default_span ( & self , _tcx : TyCtxt < ' _ > ) -> Span {
514359 self . 0 . expn_data ( ) . call_site
515360 }
516-
517- #[ inline( always) ]
518- fn key_as_def_id ( & self ) -> Option < DefId > {
519- None
520- }
521361}
522362
523363impl < ' tcx > Key for ( ValidityRequirement , ty:: PseudoCanonicalInput < ' tcx , Ty < ' tcx > > ) {
0 commit comments