FnPtr
blanket impls cause "multiple applicable items in scope" for unrelated types.
#109892
Labels
A-trait-system
Area: Trait system
C-bug
Category: This is a bug.
P-high
High priority
regression-from-stable-to-nightly
Performance or correctness regression from stable to nightly.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Note: the below reduction originally came from a
use num_traits::Float;
+0.0.max(x)
in the wild.I haven't found a way to demonstrate this outside of the "float inference vars +
Ord
method" combo, but:works on stable (
1.68.2
) and beta (1.69.0-beta.6
), and errors on nightly with:Even though it doesn't show the source for candidate
#2
, I'm almost certain it's this:rust/library/core/src/ptr/mod.rs
Lines 2064 to 2070 in f13ccef
from (cc @lcnr @oli-obk):
FnPtr
trait that is implemented for all function pointers #108080On the original PR I left comments like #99531 (comment), trying to rectify the issues with the original approach, but they didn't go anywhere and the version that one in the end is the (arguably) more fragile original one, that uses blanket
impl
s and works around their unwanted interactions.It's possible in this case all it takes is checking for "float inference vars" and making sure they can never be considered to implement
FnPtr
, but I'm worried there might be other edge cases lurking in the shadows.Also, did both of those PRs skip crater? I feel like this shouldn't be that hard to hit in the wild.
The text was updated successfully, but these errors were encountered: