@@ -31,7 +31,6 @@ use ty;
31
31
use ty:: subst:: { Subst , Substs } ;
32
32
use ty:: util:: IntTypeExt ;
33
33
use ty:: walk:: TypeWalker ;
34
- use util:: common:: MemoizationMap ;
35
34
use util:: nodemap:: { NodeSet , DefIdMap , FxHashMap } ;
36
35
37
36
use serialize:: { self , Encodable , Encoder } ;
@@ -2154,30 +2153,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2154
2153
}
2155
2154
2156
2155
pub fn associated_item_def_ids ( self , def_id : DefId ) -> Rc < Vec < DefId > > {
2157
- if !def_id. is_local ( ) {
2158
- return queries:: associated_item_def_ids:: get ( self , DUMMY_SP , def_id) ;
2159
- }
2160
-
2161
- self . maps . associated_item_def_ids . memoize ( def_id, || {
2162
- let id = self . hir . as_local_node_id ( def_id) . unwrap ( ) ;
2163
- let item = self . hir . expect_item ( id) ;
2164
- let vec: Vec < _ > = match item. node {
2165
- hir:: ItemTrait ( .., ref trait_item_refs) => {
2166
- trait_item_refs. iter ( )
2167
- . map ( |trait_item_ref| trait_item_ref. id )
2168
- . map ( |id| self . hir . local_def_id ( id. node_id ) )
2169
- . collect ( )
2170
- }
2171
- hir:: ItemImpl ( .., ref impl_item_refs) => {
2172
- impl_item_refs. iter ( )
2173
- . map ( |impl_item_ref| impl_item_ref. id )
2174
- . map ( |id| self . hir . local_def_id ( id. node_id ) )
2175
- . collect ( )
2176
- }
2177
- _ => span_bug ! ( item. span, "associated_item_def_ids: not impl or trait" )
2178
- } ;
2179
- Rc :: new ( vec)
2180
- } )
2156
+ queries:: associated_item_def_ids:: get ( self , DUMMY_SP , def_id)
2181
2157
}
2182
2158
2183
2159
#[ inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait.
@@ -2708,9 +2684,33 @@ fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
2708
2684
ty
2709
2685
}
2710
2686
2687
+ fn associated_item_def_ids < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
2688
+ def_id : DefId )
2689
+ -> Rc < Vec < DefId > > {
2690
+ let id = tcx. hir . as_local_node_id ( def_id) . unwrap ( ) ;
2691
+ let item = tcx. hir . expect_item ( id) ;
2692
+ let vec: Vec < _ > = match item. node {
2693
+ hir:: ItemTrait ( .., ref trait_item_refs) => {
2694
+ trait_item_refs. iter ( )
2695
+ . map ( |trait_item_ref| trait_item_ref. id )
2696
+ . map ( |id| tcx. hir . local_def_id ( id. node_id ) )
2697
+ . collect ( )
2698
+ }
2699
+ hir:: ItemImpl ( .., ref impl_item_refs) => {
2700
+ impl_item_refs. iter ( )
2701
+ . map ( |impl_item_ref| impl_item_ref. id )
2702
+ . map ( |id| tcx. hir . local_def_id ( id. node_id ) )
2703
+ . collect ( )
2704
+ }
2705
+ _ => span_bug ! ( item. span, "associated_item_def_ids: not impl or trait" )
2706
+ } ;
2707
+ Rc :: new ( vec)
2708
+ }
2709
+
2711
2710
pub fn provide ( providers : & mut ty:: maps:: Providers ) {
2712
2711
* providers = ty:: maps:: Providers {
2713
2712
associated_item,
2713
+ associated_item_def_ids,
2714
2714
adt_sized_constraint,
2715
2715
..* providers
2716
2716
} ;
0 commit comments