@@ -1686,7 +1686,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
16861686 let mut discr = prev_discr. map_or ( initial, |d| d. wrap_incr ( ) ) ;
16871687 if let VariantDiscr :: Explicit ( expr_did) = v. discr {
16881688 let substs = Substs :: empty ( ) ;
1689- match queries :: const_eval:: get ( tcx , DUMMY_SP , ( expr_did, substs) ) {
1689+ match tcx . const_eval ( ( expr_did, substs) ) {
16901690 Ok ( ConstVal :: Integral ( v) ) => {
16911691 discr = v;
16921692 }
@@ -1725,7 +1725,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
17251725 }
17261726 ty:: VariantDiscr :: Explicit ( expr_did) => {
17271727 let substs = Substs :: empty ( ) ;
1728- match queries :: const_eval:: get ( tcx , DUMMY_SP , ( expr_did, substs) ) {
1728+ match tcx . const_eval ( ( expr_did, substs) ) {
17291729 Ok ( ConstVal :: Integral ( v) ) => {
17301730 explicit_value = v;
17311731 break ;
@@ -1760,7 +1760,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
17601760 }
17611761
17621762 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 )
17641764 }
17651765
17661766 /// Returns a list of types such that `Self: Sized` if and only
@@ -2045,10 +2045,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
20452045 self . typeck_tables_of ( self . hir . body_owner_def_id ( body) )
20462046 }
20472047
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-
20522048 pub fn expr_span ( self , id : NodeId ) -> Span {
20532049 match self . hir . find ( id) {
20542050 Some ( hir_map:: NodeExpr ( e) ) => {
@@ -2136,24 +2132,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
21362132 . collect ( )
21372133 }
21382134
2139- pub fn impl_polarity ( self , id : DefId ) -> hir:: ImplPolarity {
2140- queries:: impl_polarity:: get ( self , DUMMY_SP , id)
2141- }
2142-
21432135 pub fn trait_relevant_for_never ( self , did : DefId ) -> bool {
21442136 self . associated_items ( did) . any ( |item| {
21452137 item. relevant_for_never ( )
21462138 } )
21472139 }
21482140
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-
21572141 fn associated_item_from_trait_item_ref ( self ,
21582142 parent_def_id : DefId ,
21592143 trait_item_ref : & hir:: TraitItemRef )
@@ -2207,23 +2191,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
22072191 }
22082192 }
22092193
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-
22142194 #[ inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait.
22152195 pub fn associated_items ( self , def_id : DefId )
22162196 -> impl Iterator < Item = ty:: AssociatedItem > + ' a {
22172197 let def_ids = self . associated_item_def_ids ( def_id) ;
22182198 ( 0 ..def_ids. len ( ) ) . map ( move |i| self . associated_item ( def_ids[ i] ) )
22192199 }
22202200
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-
22272201 /// Returns true if the impls are the same polarity and are implementing
22282202 /// a trait which contains no items
22292203 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> {
23252299 }
23262300 }
23272301
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-
23592302 /// Given the did of an item, returns its MIR, borrowed immutably.
23602303 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 ( )
23622305 }
23632306
23642307 /// Return the possibly-auto-generated MIR of a (DefId, Subst) pair.
@@ -2367,7 +2310,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
23672310 {
23682311 match instance {
23692312 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 ( ) ,
23712314 }
23722315 }
23732316
@@ -2399,10 +2342,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
23992342 self . get_attrs ( did) . iter ( ) . any ( |item| item. check_name ( attr) )
24002343 }
24012344
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-
24062345 pub fn trait_has_default_impl ( self , trait_def_id : DefId ) -> bool {
24072346 let def = self . trait_def ( trait_def_id) ;
24082347 def. flags . get ( ) . intersects ( TraitFlags :: HAS_DEFAULT_IMPL )
@@ -2437,14 +2376,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
24372376 def. flags . set ( def. flags . get ( ) | TraitFlags :: HAS_REMOTE_IMPLS ) ;
24382377 }
24392378
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-
24482379 /// Given the def_id of an impl, return the def_id of the trait it implements.
24492380 /// If it implements no trait, return `None`.
24502381 pub fn trait_id_of_impl ( self , def_id : DefId ) -> Option < DefId > {
0 commit comments