@@ -1112,6 +1112,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1112
1112
// generator, this will raise error in other places
1113
1113
// or ignore error with const_async_blocks feature
1114
1114
GeneratorCandidate => { }
1115
+ // FnDef where the function is const
1116
+ FnPointerCandidate { is_const : true } => { }
1115
1117
ConstDropCandidate => { }
1116
1118
_ => {
1117
1119
// reject all other types of candidates
@@ -1539,6 +1541,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1539
1541
}
1540
1542
}
1541
1543
1544
+ // Drop otherwise equivalent non-const fn pointer candidates
1545
+ ( FnPointerCandidate { .. } , FnPointerCandidate { is_const : false } ) => true ,
1546
+
1542
1547
// Global bounds from the where clause should be ignored
1543
1548
// here (see issue #50825). Otherwise, we have a where
1544
1549
// clause so don't go around looking for impls.
@@ -1549,7 +1554,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1549
1554
ImplCandidate ( ..)
1550
1555
| ClosureCandidate
1551
1556
| GeneratorCandidate
1552
- | FnPointerCandidate
1557
+ | FnPointerCandidate { .. }
1553
1558
| BuiltinObjectCandidate
1554
1559
| BuiltinUnsizeCandidate
1555
1560
| TraitUpcastingUnsizeCandidate ( _)
@@ -1567,7 +1572,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1567
1572
ImplCandidate ( _)
1568
1573
| ClosureCandidate
1569
1574
| GeneratorCandidate
1570
- | FnPointerCandidate
1575
+ | FnPointerCandidate { .. }
1571
1576
| BuiltinObjectCandidate
1572
1577
| BuiltinUnsizeCandidate
1573
1578
| TraitUpcastingUnsizeCandidate ( _)
@@ -1597,7 +1602,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1597
1602
ImplCandidate ( ..)
1598
1603
| ClosureCandidate
1599
1604
| GeneratorCandidate
1600
- | FnPointerCandidate
1605
+ | FnPointerCandidate { .. }
1601
1606
| BuiltinObjectCandidate
1602
1607
| BuiltinUnsizeCandidate
1603
1608
| TraitUpcastingUnsizeCandidate ( _)
@@ -1609,7 +1614,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1609
1614
ImplCandidate ( ..)
1610
1615
| ClosureCandidate
1611
1616
| GeneratorCandidate
1612
- | FnPointerCandidate
1617
+ | FnPointerCandidate { .. }
1613
1618
| BuiltinObjectCandidate
1614
1619
| BuiltinUnsizeCandidate
1615
1620
| TraitUpcastingUnsizeCandidate ( _)
@@ -1690,7 +1695,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1690
1695
ImplCandidate ( _)
1691
1696
| ClosureCandidate
1692
1697
| GeneratorCandidate
1693
- | FnPointerCandidate
1698
+ | FnPointerCandidate { .. }
1694
1699
| BuiltinObjectCandidate
1695
1700
| BuiltinUnsizeCandidate
1696
1701
| TraitUpcastingUnsizeCandidate ( _)
@@ -1699,7 +1704,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1699
1704
ImplCandidate ( _)
1700
1705
| ClosureCandidate
1701
1706
| GeneratorCandidate
1702
- | FnPointerCandidate
1707
+ | FnPointerCandidate { .. }
1703
1708
| BuiltinObjectCandidate
1704
1709
| BuiltinUnsizeCandidate
1705
1710
| TraitUpcastingUnsizeCandidate ( _)
0 commit comments