@@ -1112,6 +1112,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11121112 // generator, this will raise error in other places
11131113 // or ignore error with const_async_blocks feature
11141114 GeneratorCandidate => { }
1115+ // FnDef where the function is const
1116+ FnPointerCandidate { is_const : true } => { }
11151117 ConstDropCandidate => { }
11161118 _ => {
11171119 // reject all other types of candidates
@@ -1539,6 +1541,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15391541 }
15401542 }
15411543
1544+ // Drop otherwise equivalent non-const fn pointer candidates
1545+ ( FnPointerCandidate { .. } , FnPointerCandidate { is_const : false } ) => true ,
1546+
15421547 // Global bounds from the where clause should be ignored
15431548 // here (see issue #50825). Otherwise, we have a where
15441549 // clause so don't go around looking for impls.
@@ -1549,7 +1554,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15491554 ImplCandidate ( ..)
15501555 | ClosureCandidate
15511556 | GeneratorCandidate
1552- | FnPointerCandidate
1557+ | FnPointerCandidate { .. }
15531558 | BuiltinObjectCandidate
15541559 | BuiltinUnsizeCandidate
15551560 | TraitUpcastingUnsizeCandidate ( _)
@@ -1567,7 +1572,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15671572 ImplCandidate ( _)
15681573 | ClosureCandidate
15691574 | GeneratorCandidate
1570- | FnPointerCandidate
1575+ | FnPointerCandidate { .. }
15711576 | BuiltinObjectCandidate
15721577 | BuiltinUnsizeCandidate
15731578 | TraitUpcastingUnsizeCandidate ( _)
@@ -1597,7 +1602,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15971602 ImplCandidate ( ..)
15981603 | ClosureCandidate
15991604 | GeneratorCandidate
1600- | FnPointerCandidate
1605+ | FnPointerCandidate { .. }
16011606 | BuiltinObjectCandidate
16021607 | BuiltinUnsizeCandidate
16031608 | TraitUpcastingUnsizeCandidate ( _)
@@ -1609,7 +1614,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16091614 ImplCandidate ( ..)
16101615 | ClosureCandidate
16111616 | GeneratorCandidate
1612- | FnPointerCandidate
1617+ | FnPointerCandidate { .. }
16131618 | BuiltinObjectCandidate
16141619 | BuiltinUnsizeCandidate
16151620 | TraitUpcastingUnsizeCandidate ( _)
@@ -1690,7 +1695,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16901695 ImplCandidate ( _)
16911696 | ClosureCandidate
16921697 | GeneratorCandidate
1693- | FnPointerCandidate
1698+ | FnPointerCandidate { .. }
16941699 | BuiltinObjectCandidate
16951700 | BuiltinUnsizeCandidate
16961701 | TraitUpcastingUnsizeCandidate ( _)
@@ -1699,7 +1704,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16991704 ImplCandidate ( _)
17001705 | ClosureCandidate
17011706 | GeneratorCandidate
1702- | FnPointerCandidate
1707+ | FnPointerCandidate { .. }
17031708 | BuiltinObjectCandidate
17041709 | BuiltinUnsizeCandidate
17051710 | TraitUpcastingUnsizeCandidate ( _)
0 commit comments