@@ -341,9 +341,10 @@ fn make_mirror_unadjusted<'a, 'tcx>(
341
341
} else {
342
342
// FIXME overflow
343
343
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
+ {
347
348
cx. control_flow_destroyed . push ( (
348
349
op. span ,
349
350
"`&&` operator" . into ( ) ,
@@ -354,7 +355,9 @@ fn make_mirror_unadjusted<'a, 'tcx>(
354
355
rhs : rhs. to_ref ( ) ,
355
356
}
356
357
}
357
- ( hir:: BinOpKind :: Or , hir:: Constness :: Const ) => {
358
+ ( hir:: BinOpKind :: Or , hir:: Constness :: Const )
359
+ if !cx. tcx . features ( ) . const_if_match =>
360
+ {
358
361
cx. control_flow_destroyed . push ( (
359
362
op. span ,
360
363
"`||` operator" . into ( ) ,
@@ -366,14 +369,14 @@ fn make_mirror_unadjusted<'a, 'tcx>(
366
369
}
367
370
}
368
371
369
- ( hir:: BinOpKind :: And , hir :: Constness :: NotConst ) => {
372
+ ( hir:: BinOpKind :: And , _ ) => {
370
373
ExprKind :: LogicalOp {
371
374
op : LogicalOp :: And ,
372
375
lhs : lhs. to_ref ( ) ,
373
376
rhs : rhs. to_ref ( ) ,
374
377
}
375
378
}
376
- ( hir:: BinOpKind :: Or , hir :: Constness :: NotConst ) => {
379
+ ( hir:: BinOpKind :: Or , _ ) => {
377
380
ExprKind :: LogicalOp {
378
381
op : LogicalOp :: Or ,
379
382
lhs : lhs. to_ref ( ) ,
0 commit comments