@@ -1686,7 +1686,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
1686
1686
let mut discr = prev_discr. map_or ( initial, |d| d. wrap_incr ( ) ) ;
1687
1687
if let VariantDiscr :: Explicit ( expr_did) = v. discr {
1688
1688
let substs = Substs :: empty ( ) ;
1689
- match queries :: const_eval:: get ( tcx , DUMMY_SP , ( expr_did, substs) ) {
1689
+ match tcx . const_eval ( ( expr_did, substs) ) {
1690
1690
Ok ( ConstVal :: Integral ( v) ) => {
1691
1691
discr = v;
1692
1692
}
@@ -1725,7 +1725,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
1725
1725
}
1726
1726
ty:: VariantDiscr :: Explicit ( expr_did) => {
1727
1727
let substs = Substs :: empty ( ) ;
1728
- match queries :: const_eval:: get ( tcx , DUMMY_SP , ( expr_did, substs) ) {
1728
+ match tcx . const_eval ( ( expr_did, substs) ) {
1729
1729
Ok ( ConstVal :: Integral ( v) ) => {
1730
1730
explicit_value = v;
1731
1731
break ;
@@ -1760,7 +1760,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
1760
1760
}
1761
1761
1762
1762
pub fn destructor ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> Option < Destructor > {
1763
- queries :: adt_destructor:: get ( tcx , DUMMY_SP , self . did )
1763
+ tcx . adt_destructor ( self . did )
1764
1764
}
1765
1765
1766
1766
/// Returns a list of types such that `Self: Sized` if and only
@@ -2045,10 +2045,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2045
2045
self . typeck_tables_of ( self . hir . body_owner_def_id ( body) )
2046
2046
}
2047
2047
2048
- pub fn typeck_tables_of ( self , def_id : DefId ) -> & ' gcx TypeckTables < ' gcx > {
2049
- queries:: typeck_tables_of:: get ( self , DUMMY_SP , def_id)
2050
- }
2051
-
2052
2048
pub fn expr_span ( self , id : NodeId ) -> Span {
2053
2049
match self . hir . find ( id) {
2054
2050
Some ( hir_map:: NodeExpr ( e) ) => {
@@ -2136,24 +2132,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2136
2132
. collect ( )
2137
2133
}
2138
2134
2139
- pub fn impl_polarity ( self , id : DefId ) -> hir:: ImplPolarity {
2140
- queries:: impl_polarity:: get ( self , DUMMY_SP , id)
2141
- }
2142
-
2143
2135
pub fn trait_relevant_for_never ( self , did : DefId ) -> bool {
2144
2136
self . associated_items ( did) . any ( |item| {
2145
2137
item. relevant_for_never ( )
2146
2138
} )
2147
2139
}
2148
2140
2149
- pub fn coerce_unsized_info ( self , did : DefId ) -> adjustment:: CoerceUnsizedInfo {
2150
- queries:: coerce_unsized_info:: get ( self , DUMMY_SP , did)
2151
- }
2152
-
2153
- pub fn associated_item ( self , def_id : DefId ) -> AssociatedItem {
2154
- queries:: associated_item:: get ( self , DUMMY_SP , def_id)
2155
- }
2156
-
2157
2141
fn associated_item_from_trait_item_ref ( self ,
2158
2142
parent_def_id : DefId ,
2159
2143
trait_item_ref : & hir:: TraitItemRef )
@@ -2207,23 +2191,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2207
2191
}
2208
2192
}
2209
2193
2210
- pub fn associated_item_def_ids ( self , def_id : DefId ) -> Rc < Vec < DefId > > {
2211
- queries:: associated_item_def_ids:: get ( self , DUMMY_SP , def_id)
2212
- }
2213
-
2214
2194
#[ inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait.
2215
2195
pub fn associated_items ( self , def_id : DefId )
2216
2196
-> impl Iterator < Item = ty:: AssociatedItem > + ' a {
2217
2197
let def_ids = self . associated_item_def_ids ( def_id) ;
2218
2198
( 0 ..def_ids. len ( ) ) . map ( move |i| self . associated_item ( def_ids[ i] ) )
2219
2199
}
2220
2200
2221
- /// Returns the trait-ref corresponding to a given impl, or None if it is
2222
- /// an inherent impl.
2223
- pub fn impl_trait_ref ( self , id : DefId ) -> Option < TraitRef < ' gcx > > {
2224
- queries:: impl_trait_ref:: get ( self , DUMMY_SP , id)
2225
- }
2226
-
2227
2201
/// Returns true if the impls are the same polarity and are implementing
2228
2202
/// a trait which contains no items
2229
2203
pub fn impls_are_allowed_to_overlap ( self , def_id1 : DefId , def_id2 : DefId ) -> bool {
@@ -2325,40 +2299,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2325
2299
}
2326
2300
}
2327
2301
2328
- // If the given item is in an external crate, looks up its type and adds it to
2329
- // the type cache. Returns the type parameters and type.
2330
- pub fn type_of ( self , did : DefId ) -> Ty < ' gcx > {
2331
- queries:: type_of:: get ( self , DUMMY_SP , did)
2332
- }
2333
-
2334
- /// Given the did of a trait, returns its canonical trait ref.
2335
- pub fn trait_def ( self , did : DefId ) -> & ' gcx TraitDef {
2336
- queries:: trait_def:: get ( self , DUMMY_SP , did)
2337
- }
2338
-
2339
- /// Given the did of an ADT, return a reference to its definition.
2340
- pub fn adt_def ( self , did : DefId ) -> & ' gcx AdtDef {
2341
- queries:: adt_def:: get ( self , DUMMY_SP , did)
2342
- }
2343
-
2344
- /// Given the did of an item, returns its generics.
2345
- pub fn generics_of ( self , did : DefId ) -> & ' gcx Generics {
2346
- queries:: generics_of:: get ( self , DUMMY_SP , did)
2347
- }
2348
-
2349
- /// Given the did of an item, returns its full set of predicates.
2350
- pub fn predicates_of ( self , did : DefId ) -> GenericPredicates < ' gcx > {
2351
- queries:: predicates_of:: get ( self , DUMMY_SP , did)
2352
- }
2353
-
2354
- /// Given the did of a trait, returns its superpredicates.
2355
- pub fn super_predicates_of ( self , did : DefId ) -> GenericPredicates < ' gcx > {
2356
- queries:: super_predicates_of:: get ( self , DUMMY_SP , did)
2357
- }
2358
-
2359
2302
/// Given the did of an item, returns its MIR, borrowed immutably.
2360
2303
pub fn item_mir ( self , did : DefId ) -> Ref < ' gcx , Mir < ' gcx > > {
2361
- queries :: mir:: get ( self , DUMMY_SP , did) . borrow ( )
2304
+ self . mir ( did) . borrow ( )
2362
2305
}
2363
2306
2364
2307
/// Return the possibly-auto-generated MIR of a (DefId, Subst) pair.
@@ -2367,7 +2310,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2367
2310
{
2368
2311
match instance {
2369
2312
ty:: InstanceDef :: Item ( did) if true => self . item_mir ( did) ,
2370
- _ => queries :: mir_shims:: get ( self , DUMMY_SP , instance) . borrow ( ) ,
2313
+ _ => self . mir_shims ( instance) . borrow ( ) ,
2371
2314
}
2372
2315
}
2373
2316
@@ -2399,10 +2342,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2399
2342
self . get_attrs ( did) . iter ( ) . any ( |item| item. check_name ( attr) )
2400
2343
}
2401
2344
2402
- pub fn variances_of ( self , item_id : DefId ) -> Rc < Vec < ty:: Variance > > {
2403
- queries:: variances_of:: get ( self , DUMMY_SP , item_id)
2404
- }
2405
-
2406
2345
pub fn trait_has_default_impl ( self , trait_def_id : DefId ) -> bool {
2407
2346
let def = self . trait_def ( trait_def_id) ;
2408
2347
def. flags . get ( ) . intersects ( TraitFlags :: HAS_DEFAULT_IMPL )
@@ -2437,14 +2376,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2437
2376
def. flags . set ( def. flags . get ( ) | TraitFlags :: HAS_REMOTE_IMPLS ) ;
2438
2377
}
2439
2378
2440
- pub fn closure_kind ( self , def_id : DefId ) -> ty:: ClosureKind {
2441
- queries:: closure_kind:: get ( self , DUMMY_SP , def_id)
2442
- }
2443
-
2444
- pub fn closure_type ( self , def_id : DefId ) -> ty:: PolyFnSig < ' tcx > {
2445
- queries:: closure_type:: get ( self , DUMMY_SP , def_id)
2446
- }
2447
-
2448
2379
/// Given the def_id of an impl, return the def_id of the trait it implements.
2449
2380
/// If it implements no trait, return `None`.
2450
2381
pub fn trait_id_of_impl ( self , def_id : DefId ) -> Option < DefId > {
0 commit comments