@@ -1100,6 +1100,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1100
1100
// generator, this will raise error in other places
1101
1101
// or ignore error with const_async_blocks feature
1102
1102
GeneratorCandidate => { }
1103
+ // FnDef where the function is const
1104
+ FnPointerCandidate { is_const : true } => { }
1103
1105
ConstDropCandidate => { }
1104
1106
_ => {
1105
1107
// reject all other types of candidates
@@ -1513,6 +1515,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1513
1515
}
1514
1516
}
1515
1517
1518
+ // Drop otherwise equivalent non-const fn pointer candidates
1519
+ ( FnPointerCandidate { .. } , FnPointerCandidate { is_const : false } ) => true ,
1520
+
1516
1521
// Global bounds from the where clause should be ignored
1517
1522
// here (see issue #50825). Otherwise, we have a where
1518
1523
// clause so don't go around looking for impls.
@@ -1523,7 +1528,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1523
1528
ImplCandidate ( ..)
1524
1529
| ClosureCandidate
1525
1530
| GeneratorCandidate
1526
- | FnPointerCandidate
1531
+ | FnPointerCandidate { .. }
1527
1532
| BuiltinObjectCandidate
1528
1533
| BuiltinUnsizeCandidate
1529
1534
| TraitUpcastingUnsizeCandidate ( _)
@@ -1541,7 +1546,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1541
1546
ImplCandidate ( _)
1542
1547
| ClosureCandidate
1543
1548
| GeneratorCandidate
1544
- | FnPointerCandidate
1549
+ | FnPointerCandidate { .. }
1545
1550
| BuiltinObjectCandidate
1546
1551
| BuiltinUnsizeCandidate
1547
1552
| TraitUpcastingUnsizeCandidate ( _)
@@ -1571,7 +1576,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1571
1576
ImplCandidate ( ..)
1572
1577
| ClosureCandidate
1573
1578
| GeneratorCandidate
1574
- | FnPointerCandidate
1579
+ | FnPointerCandidate { .. }
1575
1580
| BuiltinObjectCandidate
1576
1581
| BuiltinUnsizeCandidate
1577
1582
| TraitUpcastingUnsizeCandidate ( _)
@@ -1583,7 +1588,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1583
1588
ImplCandidate ( ..)
1584
1589
| ClosureCandidate
1585
1590
| GeneratorCandidate
1586
- | FnPointerCandidate
1591
+ | FnPointerCandidate { .. }
1587
1592
| BuiltinObjectCandidate
1588
1593
| BuiltinUnsizeCandidate
1589
1594
| TraitUpcastingUnsizeCandidate ( _)
@@ -1664,7 +1669,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1664
1669
ImplCandidate ( _)
1665
1670
| ClosureCandidate
1666
1671
| GeneratorCandidate
1667
- | FnPointerCandidate
1672
+ | FnPointerCandidate { .. }
1668
1673
| BuiltinObjectCandidate
1669
1674
| BuiltinUnsizeCandidate
1670
1675
| TraitUpcastingUnsizeCandidate ( _)
@@ -1673,7 +1678,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1673
1678
ImplCandidate ( _)
1674
1679
| ClosureCandidate
1675
1680
| GeneratorCandidate
1676
- | FnPointerCandidate
1681
+ | FnPointerCandidate { .. }
1677
1682
| BuiltinObjectCandidate
1678
1683
| BuiltinUnsizeCandidate
1679
1684
| TraitUpcastingUnsizeCandidate ( _)
0 commit comments