@@ -75,6 +75,8 @@ pub use self::context::{Lift, TypeckTables};
75
75
76
76
pub use self :: trait_def:: { TraitDef , TraitFlags } ;
77
77
78
+ pub use self :: maps:: queries;
79
+
78
80
pub mod adjustment;
79
81
pub mod cast;
80
82
pub mod error;
@@ -1947,7 +1949,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1947
1949
}
1948
1950
1949
1951
pub fn item_tables ( self , def_id : DefId ) -> & ' gcx TypeckTables < ' gcx > {
1950
- self . maps . typeck_tables ( self , DUMMY_SP , def_id)
1952
+ queries :: typeck_tables:: get ( self , DUMMY_SP , def_id)
1951
1953
}
1952
1954
1953
1955
pub fn expr_span ( self , id : NodeId ) -> Span {
@@ -2055,12 +2057,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2055
2057
}
2056
2058
2057
2059
pub fn custom_coerce_unsized_kind ( self , did : DefId ) -> adjustment:: CustomCoerceUnsized {
2058
- self . maps . custom_coerce_unsized_kind ( self , DUMMY_SP , did)
2060
+ queries :: custom_coerce_unsized_kind:: get ( self , DUMMY_SP , did)
2059
2061
}
2060
2062
2061
2063
pub fn associated_item ( self , def_id : DefId ) -> AssociatedItem {
2062
2064
if !def_id. is_local ( ) {
2063
- return self . maps . associated_item ( self , DUMMY_SP , def_id) ;
2065
+ return queries :: associated_item:: get ( self , DUMMY_SP , def_id) ;
2064
2066
}
2065
2067
2066
2068
self . maps . associated_item . memoize ( def_id, || {
@@ -2165,7 +2167,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2165
2167
2166
2168
pub fn associated_item_def_ids ( self , def_id : DefId ) -> Rc < Vec < DefId > > {
2167
2169
if !def_id. is_local ( ) {
2168
- return self . maps . associated_item_def_ids ( self , DUMMY_SP , def_id) ;
2170
+ return queries :: associated_item_def_ids:: get ( self , DUMMY_SP , def_id) ;
2169
2171
}
2170
2172
2171
2173
self . maps . associated_item_def_ids . memoize ( def_id, || {
@@ -2200,7 +2202,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2200
2202
/// Returns the trait-ref corresponding to a given impl, or None if it is
2201
2203
/// an inherent impl.
2202
2204
pub fn impl_trait_ref ( self , id : DefId ) -> Option < TraitRef < ' gcx > > {
2203
- self . maps . impl_trait_ref ( self , DUMMY_SP , id)
2205
+ queries :: impl_trait_ref:: get ( self , DUMMY_SP , id)
2204
2206
}
2205
2207
2206
2208
// Returns `ty::VariantDef` if `def` refers to a struct,
@@ -2279,37 +2281,37 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2279
2281
// If the given item is in an external crate, looks up its type and adds it to
2280
2282
// the type cache. Returns the type parameters and type.
2281
2283
pub fn item_type ( self , did : DefId ) -> Ty < ' gcx > {
2282
- self . maps . ty ( self , DUMMY_SP , did)
2284
+ queries :: ty :: get ( self , DUMMY_SP , did)
2283
2285
}
2284
2286
2285
2287
/// Given the did of a trait, returns its canonical trait ref.
2286
2288
pub fn lookup_trait_def ( self , did : DefId ) -> & ' gcx TraitDef {
2287
- self . maps . trait_def ( self , DUMMY_SP , did)
2289
+ queries :: trait_def:: get ( self , DUMMY_SP , did)
2288
2290
}
2289
2291
2290
2292
/// Given the did of an ADT, return a reference to its definition.
2291
2293
pub fn lookup_adt_def ( self , did : DefId ) -> & ' gcx AdtDef {
2292
- self . maps . adt_def ( self , DUMMY_SP , did)
2294
+ queries :: adt_def:: get ( self , DUMMY_SP , did)
2293
2295
}
2294
2296
2295
2297
/// Given the did of an item, returns its generics.
2296
2298
pub fn item_generics ( self , did : DefId ) -> & ' gcx Generics {
2297
- self . maps . generics ( self , DUMMY_SP , did)
2299
+ queries :: generics:: get ( self , DUMMY_SP , did)
2298
2300
}
2299
2301
2300
2302
/// Given the did of an item, returns its full set of predicates.
2301
2303
pub fn item_predicates ( self , did : DefId ) -> GenericPredicates < ' gcx > {
2302
- self . maps . predicates ( self , DUMMY_SP , did)
2304
+ queries :: predicates:: get ( self , DUMMY_SP , did)
2303
2305
}
2304
2306
2305
2307
/// Given the did of a trait, returns its superpredicates.
2306
2308
pub fn item_super_predicates ( self , did : DefId ) -> GenericPredicates < ' gcx > {
2307
- self . maps . super_predicates ( self , DUMMY_SP , did)
2309
+ queries :: super_predicates:: get ( self , DUMMY_SP , did)
2308
2310
}
2309
2311
2310
2312
/// Given the did of an item, returns its MIR, borrowed immutably.
2311
2313
pub fn item_mir ( self , did : DefId ) -> Ref < ' gcx , Mir < ' gcx > > {
2312
- self . maps . mir ( self , DUMMY_SP , did) . borrow ( )
2314
+ queries :: mir:: get ( self , DUMMY_SP , did) . borrow ( )
2313
2315
}
2314
2316
2315
2317
/// If `type_needs_drop` returns true, then `ty` is definitely
@@ -2361,7 +2363,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2361
2363
}
2362
2364
2363
2365
pub fn item_variances ( self , item_id : DefId ) -> Rc < Vec < ty:: Variance > > {
2364
- self . maps . variances ( self , DUMMY_SP , item_id)
2366
+ queries :: variances:: get ( self , DUMMY_SP , item_id)
2365
2367
}
2366
2368
2367
2369
pub fn trait_has_default_impl ( self , trait_def_id : DefId ) -> bool {
@@ -2436,11 +2438,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2436
2438
}
2437
2439
2438
2440
pub fn closure_kind ( self , def_id : DefId ) -> ty:: ClosureKind {
2439
- self . maps . closure_kind ( self , DUMMY_SP , def_id)
2441
+ queries :: closure_kind:: get ( self , DUMMY_SP , def_id)
2440
2442
}
2441
2443
2442
2444
pub fn closure_type ( self , def_id : DefId ) -> ty:: PolyFnSig < ' tcx > {
2443
- self . maps . closure_type ( self , DUMMY_SP , def_id)
2445
+ queries :: closure_type:: get ( self , DUMMY_SP , def_id)
2444
2446
}
2445
2447
2446
2448
/// Given the def_id of an impl, return the def_id of the trait it implements.
0 commit comments