@@ -13,7 +13,7 @@ use rustc_middle::mir::{
1313 RetagKind , RuntimePhase , Rvalue , SourceScope , Statement , StatementKind , Terminator ,
1414 TerminatorKind , UnOp , START_BLOCK ,
1515} ;
16- use rustc_middle:: ty:: { self , InstanceDef , ParamEnv , Ty , TyCtxt } ;
16+ use rustc_middle:: ty:: { self , InstanceDef , ParamEnv , Ty , TyCtxt , TypeVisitable } ;
1717use rustc_mir_dataflow:: impls:: MaybeStorageLive ;
1818use rustc_mir_dataflow:: storage:: always_storage_live_locals;
1919use rustc_mir_dataflow:: { Analysis , ResultsCursor } ;
@@ -231,6 +231,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
231231 return true ;
232232 }
233233
234+ // We sometimes have to use `defining_opaque_types` for subtyping
235+ // to succeed here and figuring out how exactly that should work
236+ // is annoying. It is harmless enough to just not validate anything
237+ // in that case. We still check this after analysis as all opque
238+ // types have been revealed at this point.
239+ if ( src, dest) . has_opaque_types ( ) {
240+ return true ;
241+ }
242+
234243 crate :: util:: is_subtype ( self . tcx , self . param_env , src, dest)
235244 }
236245}
0 commit comments