File tree 1 file changed +10
-15
lines changed
compiler/rustc_mir_transform/src
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>(
1027
1027
tcx : TyCtxt < ' tcx > ,
1028
1028
instance : InstanceDef < ' tcx > ,
1029
1029
) -> 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" ) ;
1042
1038
}
1043
- _ => Ok ( tcx. instance_mir ( instance) ) ,
1044
- } ,
1045
- _ => Ok ( tcx. instance_mir ( instance) ) ,
1039
+ }
1046
1040
}
1041
+ Ok ( tcx. instance_mir ( instance) )
1047
1042
}
You can’t perform that action at this time.
0 commit comments