@@ -2154,23 +2154,6 @@ impl<'tcx> Borrow<[Goal<'tcx>]> for Interned<'tcx, List<Goal<'tcx>>> {
2154
2154
}
2155
2155
}
2156
2156
2157
- macro_rules! intern_method {
2158
- ( $lt_tcx: tt, $name: ident: $method: ident( $alloc: ty,
2159
- $alloc_method: expr,
2160
- $alloc_to_key: expr) -> $ty: ty) => {
2161
- impl <$lt_tcx> TyCtxt <$lt_tcx> {
2162
- pub fn $method( self , v: $alloc) -> & $lt_tcx $ty {
2163
- let key = ( $alloc_to_key) ( & v) ;
2164
-
2165
- self . interners. $name. intern_ref( key, || {
2166
- Interned ( $alloc_method( & self . interners. arena, v) )
2167
-
2168
- } ) . 0
2169
- }
2170
- }
2171
- }
2172
- }
2173
-
2174
2157
macro_rules! direct_interners {
2175
2158
( $lt_tcx: tt, $( $name: ident: $method: ident( $ty: ty) ) ,+) => {
2176
2159
$( impl <$lt_tcx> PartialEq for Interned <$lt_tcx, $ty> {
@@ -2187,11 +2170,13 @@ macro_rules! direct_interners {
2187
2170
}
2188
2171
}
2189
2172
2190
- intern_method!(
2191
- $lt_tcx,
2192
- $name: $method( $ty,
2193
- |a: & $lt_tcx SyncDroplessArena , v| -> & $lt_tcx $ty { a. alloc( v) } ,
2194
- |x| x) -> $ty) ; ) +
2173
+ impl <$lt_tcx> TyCtxt <$lt_tcx> {
2174
+ pub fn $method( self , v: $ty) -> & $lt_tcx $ty {
2175
+ self . interners. $name. intern_ref( & v, || {
2176
+ Interned ( self . interners. arena. alloc( v) )
2177
+ } ) . 0
2178
+ }
2179
+ } ) +
2195
2180
}
2196
2181
}
2197
2182
@@ -2207,10 +2192,13 @@ direct_interners!('tcx,
2207
2192
2208
2193
macro_rules! slice_interners {
2209
2194
( $( $field: ident: $method: ident( $ty: ty) ) ,+) => (
2210
- $( intern_method!( ' tcx, $field: $method(
2211
- & [ $ty] ,
2212
- |a, v| List :: from_arena( a, v) ,
2213
- Deref :: deref) -> List <$ty>) ; ) +
2195
+ $( impl <' tcx> TyCtxt <' tcx> {
2196
+ pub fn $method( self , v: & [ $ty] ) -> & ' tcx List <$ty> {
2197
+ self . interners. $field. intern_ref( v, || {
2198
+ Interned ( List :: from_arena( & self . interners. arena, v) )
2199
+ } ) . 0
2200
+ }
2201
+ } ) +
2214
2202
) ;
2215
2203
}
2216
2204
0 commit comments