This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -1027,21 +1027,16 @@ fn try_instance_mir<'tcx>(
10271027 tcx : TyCtxt < ' tcx > ,
10281028 instance : InstanceDef < ' tcx > ,
10291029) -> Result < & ' tcx Body < ' tcx > , & ' static str > {
1030- match instance {
1031- ty:: InstanceDef :: DropGlue ( _, Some ( ty) ) => match ty. kind ( ) {
1032- ty:: Adt ( def, args) => {
1033- let fields = def. all_fields ( ) ;
1034- for field in fields {
1035- let field_ty = field. ty ( tcx, args) ;
1036- if field_ty. has_param ( ) && field_ty. has_projections ( ) {
1037- return Err ( "cannot build drop shim for polymorphic type" ) ;
1038- }
1039- }
1040-
1041- Ok ( tcx. instance_mir ( instance) )
1030+ if let ty:: InstanceDef :: DropGlue ( _, Some ( ty) ) = instance
1031+ && let ty:: Adt ( def, args) = ty. kind ( )
1032+ {
1033+ let fields = def. all_fields ( ) ;
1034+ for field in fields {
1035+ let field_ty = field. ty ( tcx, args) ;
1036+ if field_ty. has_param ( ) && field_ty. has_projections ( ) {
1037+ return Err ( "cannot build drop shim for polymorphic type" ) ;
10421038 }
1043- _ => Ok ( tcx. instance_mir ( instance) ) ,
1044- } ,
1045- _ => Ok ( tcx. instance_mir ( instance) ) ,
1039+ }
10461040 }
1041+ Ok ( tcx. instance_mir ( instance) )
10471042}
You can’t perform that action at this time.
0 commit comments