@@ -1214,6 +1214,25 @@ macro_rules! nop_lift {
1214
1214
impl <' a, ' tcx> Lift <' tcx> for $ty {
1215
1215
type Lifted = $lifted;
1216
1216
fn lift_to_tcx( self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
1217
+ // Assert that the set has the right type.
1218
+ // Given an argument that has an interned type, the return type has the type of
1219
+ // the corresponding interner set. This won't actually return anything, we're
1220
+ // just doing this to compute siad type!
1221
+ fn _intern_set_ty_from_interned_ty<' tcx, Inner >(
1222
+ _x: Interned <' tcx, Inner >,
1223
+ ) -> InternedSet <' tcx, Inner > {
1224
+ unreachable!( )
1225
+ }
1226
+ fn _type_eq<T >( _x: & T , _y: & T ) { }
1227
+ fn _test<' tcx>( x: $lifted, tcx: TyCtxt <' tcx>) {
1228
+ // If `x` is a newtype around an `Interned<T>`, then `interner` is an
1229
+ // interner of appropriate type. (Ideally we'd also check that `x` is a
1230
+ // newtype with just that one field. Not sure how to do that.)
1231
+ let interner = _intern_set_ty_from_interned_ty( x. 0 ) ;
1232
+ // Now check that this is the same type as `interners.$set`.
1233
+ _type_eq( & interner, & tcx. interners. $set) ;
1234
+ }
1235
+
1217
1236
tcx. interners
1218
1237
. $set
1219
1238
. contains_pointer_to( & InternedInSet ( & * self . 0.0 ) )
@@ -1230,6 +1249,11 @@ macro_rules! nop_list_lift {
1230
1249
impl <' a, ' tcx> Lift <' tcx> for & ' a List <$ty> {
1231
1250
type Lifted = & ' tcx List <$lifted>;
1232
1251
fn lift_to_tcx( self , tcx: TyCtxt <' tcx>) -> Option <Self :: Lifted > {
1252
+ // Assert that the set has the right type.
1253
+ if false {
1254
+ let _x: & InternedSet <' tcx, List <$lifted>> = & tcx. interners. $set;
1255
+ }
1256
+
1233
1257
if self . is_empty( ) {
1234
1258
return Some ( List :: empty( ) ) ;
1235
1259
}
0 commit comments