@@ -13,7 +13,7 @@ use std::hash::{Hash, Hasher};
1313use std:: marker:: { PhantomData , PointeeSized } ;
1414use std:: ops:: { Bound , Deref } ;
1515use std:: sync:: { Arc , OnceLock } ;
16- use std:: { fmt, iter, mem } ;
16+ use std:: { fmt, iter} ;
1717
1818use rustc_abi:: { ExternAbi , FieldIdx , Layout , LayoutData , TargetDataLayout , VariantIdx } ;
1919use rustc_ast as ast;
@@ -45,7 +45,6 @@ use rustc_session::lint::Lint;
4545use rustc_span:: def_id:: { CRATE_DEF_ID , DefPathHash , StableCrateId } ;
4646use rustc_span:: { DUMMY_SP , Ident , Span , Symbol , kw, sym} ;
4747use rustc_type_ir:: TyKind :: * ;
48- pub use rustc_type_ir:: lift:: Lift ;
4948use rustc_type_ir:: { CollectAndApply , FnSigKind , WithCachedTypeInfo , elaborate, search_graph} ;
5049use tracing:: { debug, instrument} ;
5150
@@ -1002,10 +1001,6 @@ impl<'tcx> TyCtxt<'tcx> {
10021001 ( start, end)
10031002 }
10041003
1005- pub fn lift < T : Lift < TyCtxt < ' tcx > > > ( self , value : T ) -> Option < T :: Lifted > {
1006- value. lift_to_interner ( self )
1007- }
1008-
10091004 /// Creates a type context. To use the context call `fn enter` which
10101005 /// provides a `TyCtxt`.
10111006 ///
@@ -1729,82 +1724,6 @@ impl<'tcx> TyCtxt<'tcx> {
17291724 }
17301725}
17311726
1732- macro_rules! nop_lift {
1733- ( $set: ident; $ty: ty => $lifted: ty) => {
1734- impl <' a, ' tcx> Lift <TyCtxt <' tcx>> for $ty {
1735- type Lifted = $lifted;
1736- fn lift_to_interner( self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
1737- // Assert that the set has the right type.
1738- // Given an argument that has an interned type, the return type has the type of
1739- // the corresponding interner set. This won't actually return anything, we're
1740- // just doing this to compute said type!
1741- fn _intern_set_ty_from_interned_ty<' tcx, Inner >(
1742- _x: Interned <' tcx, Inner >,
1743- ) -> InternedSet <' tcx, Inner > {
1744- unreachable!( )
1745- }
1746- fn _type_eq<T >( _x: & T , _y: & T ) { }
1747- fn _test<' tcx>( x: $lifted, tcx: TyCtxt <' tcx>) {
1748- // If `x` is a newtype around an `Interned<T>`, then `interner` is an
1749- // interner of appropriate type. (Ideally we'd also check that `x` is a
1750- // newtype with just that one field. Not sure how to do that.)
1751- let interner = _intern_set_ty_from_interned_ty( x. 0 ) ;
1752- // Now check that this is the same type as `interners.$set`.
1753- _type_eq( & interner, & tcx. interners. $set) ;
1754- }
1755-
1756- tcx. interners
1757- . $set
1758- . contains_pointer_to( & InternedInSet ( & * self . 0.0 ) )
1759- // SAFETY: `self` is interned and therefore valid
1760- // for the entire lifetime of the `TyCtxt`.
1761- . then( || unsafe { mem:: transmute( self ) } )
1762- }
1763- }
1764- } ;
1765- }
1766-
1767- macro_rules! nop_list_lift {
1768- ( $set: ident; $ty: ty => $lifted: ty) => {
1769- impl <' a, ' tcx> Lift <TyCtxt <' tcx>> for & ' a List <$ty> {
1770- type Lifted = & ' tcx List <$lifted>;
1771- fn lift_to_interner( self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
1772- // Assert that the set has the right type.
1773- if false {
1774- let _x: & InternedSet <' tcx, List <$lifted>> = & tcx. interners. $set;
1775- }
1776-
1777- if self . is_empty( ) {
1778- return Some ( List :: empty( ) ) ;
1779- }
1780- tcx. interners
1781- . $set
1782- . contains_pointer_to( & InternedInSet ( self ) )
1783- . then( || unsafe { mem:: transmute( self ) } )
1784- }
1785- }
1786- } ;
1787- }
1788-
1789- nop_lift ! { type_; Ty <' a> => Ty <' tcx> }
1790- nop_lift ! { region; Region <' a> => Region <' tcx> }
1791- nop_lift ! { const_; Const <' a> => Const <' tcx> }
1792- nop_lift ! { pat; Pattern <' a> => Pattern <' tcx> }
1793- nop_lift ! { const_allocation; ConstAllocation <' a> => ConstAllocation <' tcx> }
1794- nop_lift ! { predicate; Predicate <' a> => Predicate <' tcx> }
1795- nop_lift ! { predicate; Clause <' a> => Clause <' tcx> }
1796- nop_lift ! { layout; Layout <' a> => Layout <' tcx> }
1797- nop_lift ! { valtree; ValTree <' a> => ValTree <' tcx> }
1798-
1799- nop_list_lift ! { type_lists; Ty <' a> => Ty <' tcx> }
1800- nop_list_lift ! {
1801- poly_existential_predicates; PolyExistentialPredicate <' a> => PolyExistentialPredicate <' tcx>
1802- }
1803- nop_list_lift ! { bound_variable_kinds; ty:: BoundVariableKind <' a> => ty:: BoundVariableKind <' tcx> }
1804-
1805- // This is the impl for `&'a GenericArgs<'a>`.
1806- nop_list_lift ! { args; GenericArg <' a> => GenericArg <' tcx> }
1807-
18081727macro_rules! sty_debug_print {
18091728 ( $fmt: expr, $ctxt: expr, $( $variant: ident) ,* ) => { {
18101729 // Curious inner module to allow variant names to be used as
0 commit comments