@@ -16,32 +16,29 @@ impl<'tcx> MirPass<'tcx> for RemoveZsts {
1616 let ( basic_blocks, local_decls) = body. basic_blocks_and_local_decls_mut ( ) ;
1717 for block in basic_blocks. iter_mut ( ) {
1818 for statement in block. statements . iter_mut ( ) {
19- match statement. kind {
20- StatementKind :: Assign ( box ( place, _) ) => {
21- let place_ty = place. ty ( local_decls, tcx) . ty ;
22- if !maybe_zst ( place_ty) {
23- continue ;
24- }
25- let layout = match tcx. layout_of ( param_env. and ( place_ty) ) {
26- Ok ( layout) => layout,
27- Err ( _) => continue ,
28- } ;
29- if !layout. is_zst ( ) {
30- continue ;
31- }
32- if involves_a_union ( place, local_decls, tcx) {
33- continue ;
34- }
35- if tcx. consider_optimizing ( || {
36- format ! (
37- "RemoveZsts - Place: {:?} SourceInfo: {:?}" ,
38- place, statement. source_info
39- )
40- } ) {
41- statement. make_nop ( ) ;
42- }
19+ if let StatementKind :: Assign ( box ( place, _) ) = statement. kind {
20+ let place_ty = place. ty ( local_decls, tcx) . ty ;
21+ if !maybe_zst ( place_ty) {
22+ continue ;
23+ }
24+ let layout = match tcx. layout_of ( param_env. and ( place_ty) ) {
25+ Ok ( layout) => layout,
26+ Err ( _) => continue ,
27+ } ;
28+ if !layout. is_zst ( ) {
29+ continue ;
30+ }
31+ if involves_a_union ( place, local_decls, tcx) {
32+ continue ;
33+ }
34+ if tcx. consider_optimizing ( || {
35+ format ! (
36+ "RemoveZsts - Place: {:?} SourceInfo: {:?}" ,
37+ place, statement. source_info
38+ )
39+ } ) {
40+ statement. make_nop ( ) ;
4341 }
44- _ => { }
4542 }
4643 }
4744 }
0 commit comments