@@ -341,9 +341,10 @@ fn make_mirror_unadjusted<'a, 'tcx>(
341341 } else {
342342 // FIXME overflow
343343 match ( op. node , cx. constness ) {
344- // FIXME(eddyb) use logical ops in constants when
345- // they can handle that kind of control-flow.
346- ( hir:: BinOpKind :: And , hir:: Constness :: Const ) => {
344+ // Destroy control flow if `#![feature(const_if_match)]` is not enabled.
345+ ( hir:: BinOpKind :: And , hir:: Constness :: Const )
346+ if !cx. tcx . features ( ) . const_if_match =>
347+ {
347348 cx. control_flow_destroyed . push ( (
348349 op. span ,
349350 "`&&` operator" . into ( ) ,
@@ -354,7 +355,9 @@ fn make_mirror_unadjusted<'a, 'tcx>(
354355 rhs : rhs. to_ref ( ) ,
355356 }
356357 }
357- ( hir:: BinOpKind :: Or , hir:: Constness :: Const ) => {
358+ ( hir:: BinOpKind :: Or , hir:: Constness :: Const )
359+ if !cx. tcx . features ( ) . const_if_match =>
360+ {
358361 cx. control_flow_destroyed . push ( (
359362 op. span ,
360363 "`||` operator" . into ( ) ,
@@ -366,14 +369,14 @@ fn make_mirror_unadjusted<'a, 'tcx>(
366369 }
367370 }
368371
369- ( hir:: BinOpKind :: And , hir :: Constness :: NotConst ) => {
372+ ( hir:: BinOpKind :: And , _ ) => {
370373 ExprKind :: LogicalOp {
371374 op : LogicalOp :: And ,
372375 lhs : lhs. to_ref ( ) ,
373376 rhs : rhs. to_ref ( ) ,
374377 }
375378 }
376- ( hir:: BinOpKind :: Or , hir :: Constness :: NotConst ) => {
379+ ( hir:: BinOpKind :: Or , _ ) => {
377380 ExprKind :: LogicalOp {
378381 op : LogicalOp :: Or ,
379382 lhs : lhs. to_ref ( ) ,
0 commit comments