@@ -181,7 +181,6 @@ pub enum ProjectionElem<V: PartialEq> {
181181 } ,
182182 /// "Downcast" to a variant of an enum or a coroutine.
183183 Downcast ( VariantId ) ,
184- OpaqueCast ( std:: convert:: Infallible ) , // TODO remove this
185184}
186185
187186impl < V : PartialEq > ProjectionElem < V > {
@@ -195,7 +194,6 @@ impl<V: PartialEq> ProjectionElem<V> {
195194 }
196195 ProjectionElem :: Subslice { from, to } => ProjectionElem :: Subslice { from, to } ,
197196 ProjectionElem :: Downcast ( variant_id) => ProjectionElem :: Downcast ( variant_id) ,
198- ProjectionElem :: OpaqueCast ( ty) => ProjectionElem :: OpaqueCast ( ty) ,
199197 }
200198 }
201199
@@ -212,7 +210,6 @@ impl<V: PartialEq> ProjectionElem<V> {
212210 }
213211 ProjectionElem :: Subslice { from, to } => ProjectionElem :: Subslice { from, to } ,
214212 ProjectionElem :: Downcast ( variant_id) => ProjectionElem :: Downcast ( variant_id) ,
215- ProjectionElem :: OpaqueCast ( ty) => ProjectionElem :: OpaqueCast ( ty) ,
216213 } )
217214 }
218215}
@@ -1257,7 +1254,7 @@ impl<'db> PlaceTy<'db> {
12571254 . instantiate ( infcx. interner , args)
12581255 . skip_norm_wip ( )
12591256 }
1260- // TODO TyKind::Coroutine...
1257+ // FIXME TyKind::Coroutine...
12611258 _ => panic ! ( "can't downcast non-adt non-coroutine type: {self_ty:?}" ) ,
12621259 }
12631260 } else {
@@ -1272,7 +1269,7 @@ impl<'db> PlaceTy<'db> {
12721269 TyKind :: Closure ( _, args) => {
12731270 args. as_closure ( ) . tupled_upvars_ty ( ) . tuple_fields ( ) [ f. 0 as usize ]
12741271 }
1275- // TODO TyKind::Coroutine / TyKind::CoroutineClosure...
1272+ // FIXME TyKind::Coroutine / TyKind::CoroutineClosure...
12761273 TyKind :: Tuple ( tys) => tys
12771274 . get ( f. 0 as usize )
12781275 . cloned ( )
@@ -1291,7 +1288,7 @@ impl<'db> PlaceTy<'db> {
12911288 ) -> PlaceTy < ' db > {
12921289 self . projection_ty_core (
12931290 infcx. interner ,
1294- & elem,
1291+ elem,
12951292 |ty| {
12961293 if matches ! ( ty. kind( ) , TyKind :: Alias ( ..) ) {
12971294 let mut ocx = ObligationCtxt :: new ( infcx) ;
@@ -1330,7 +1327,7 @@ impl<'db> PlaceTy<'db> {
13301327 if self . variant_id . is_some ( ) && !matches ! ( elem, ProjectionElem :: Field ( ..) ) {
13311328 panic ! ( "cannot use non field projection on downcasted place" )
13321329 }
1333- let answer = match * elem {
1330+ match * elem {
13341331 ProjectionElem :: Deref => {
13351332 let ty = structurally_normalize ( self . ty ) . builtin_deref ( true ) . unwrap_or_else ( || {
13361333 panic ! ( "deref projection of non-dereferenceable ty {:?}" , self )
@@ -1355,13 +1352,9 @@ impl<'db> PlaceTy<'db> {
13551352 } )
13561353 }
13571354 ProjectionElem :: Downcast ( index) => PlaceTy { ty : self . ty , variant_id : Some ( index) } ,
1358- ProjectionElem :: Field ( f) => PlaceTy :: from_ty ( handle_field (
1359- structurally_normalize ( self . ty ) ,
1360- self . variant_id . clone ( ) ,
1361- f,
1362- ) ) ,
1363- ProjectionElem :: OpaqueCast ( _ty) => unimplemented ! ( "not emitted, to be removed" ) ,
1364- } ;
1365- answer
1355+ ProjectionElem :: Field ( f) => {
1356+ PlaceTy :: from_ty ( handle_field ( structurally_normalize ( self . ty ) , self . variant_id , f) )
1357+ }
1358+ }
13661359 }
13671360}
0 commit comments