@@ -1100,6 +1100,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11001100 // generator, this will raise error in other places
11011101 // or ignore error with const_async_blocks feature
11021102 GeneratorCandidate => { }
1103+ // FnDef where the function is const
1104+ FnPointerCandidate { is_const : true } => { }
11031105 ConstDropCandidate => { }
11041106 _ => {
11051107 // reject all other types of candidates
@@ -1513,6 +1515,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15131515 }
15141516 }
15151517
1518+ // Drop otherwise equivalent non-const fn pointer candidates
1519+ ( FnPointerCandidate { .. } , FnPointerCandidate { is_const : false } ) => true ,
1520+
15161521 // Global bounds from the where clause should be ignored
15171522 // here (see issue #50825). Otherwise, we have a where
15181523 // clause so don't go around looking for impls.
@@ -1523,7 +1528,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15231528 ImplCandidate ( ..)
15241529 | ClosureCandidate
15251530 | GeneratorCandidate
1526- | FnPointerCandidate
1531+ | FnPointerCandidate { .. }
15271532 | BuiltinObjectCandidate
15281533 | BuiltinUnsizeCandidate
15291534 | TraitUpcastingUnsizeCandidate ( _)
@@ -1541,7 +1546,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15411546 ImplCandidate ( _)
15421547 | ClosureCandidate
15431548 | GeneratorCandidate
1544- | FnPointerCandidate
1549+ | FnPointerCandidate { .. }
15451550 | BuiltinObjectCandidate
15461551 | BuiltinUnsizeCandidate
15471552 | TraitUpcastingUnsizeCandidate ( _)
@@ -1571,7 +1576,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15711576 ImplCandidate ( ..)
15721577 | ClosureCandidate
15731578 | GeneratorCandidate
1574- | FnPointerCandidate
1579+ | FnPointerCandidate { .. }
15751580 | BuiltinObjectCandidate
15761581 | BuiltinUnsizeCandidate
15771582 | TraitUpcastingUnsizeCandidate ( _)
@@ -1583,7 +1588,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15831588 ImplCandidate ( ..)
15841589 | ClosureCandidate
15851590 | GeneratorCandidate
1586- | FnPointerCandidate
1591+ | FnPointerCandidate { .. }
15871592 | BuiltinObjectCandidate
15881593 | BuiltinUnsizeCandidate
15891594 | TraitUpcastingUnsizeCandidate ( _)
@@ -1664,7 +1669,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16641669 ImplCandidate ( _)
16651670 | ClosureCandidate
16661671 | GeneratorCandidate
1667- | FnPointerCandidate
1672+ | FnPointerCandidate { .. }
16681673 | BuiltinObjectCandidate
16691674 | BuiltinUnsizeCandidate
16701675 | TraitUpcastingUnsizeCandidate ( _)
@@ -1673,7 +1678,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16731678 ImplCandidate ( _)
16741679 | ClosureCandidate
16751680 | GeneratorCandidate
1676- | FnPointerCandidate
1681+ | FnPointerCandidate { .. }
16771682 | BuiltinObjectCandidate
16781683 | BuiltinUnsizeCandidate
16791684 | TraitUpcastingUnsizeCandidate ( _)
0 commit comments