Rules around call resolution on fn_traits
are confusing
#120022
Labels
C-discussion
Category: Discussion or questions that doesn't represent real issues.
F-unboxed_closures
`#![feature(unboxed_closures)]`
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
(playground)
I expected to see this happen:
FnMut
gets picked up as the next candidate fitting for closure call, code compiles succesfully.Instead, this happened: the closest candidate in method resolution should be
Self
, if anything, but, evidently,&Self
is preferred instead. It would be justifiable for closures specifically if the code could be compiled. It doesn't seem to align with anything known so far about either closures or method call expressions. Removing Fn impl makes the code compile successfully, but it shouldn't be considered at all due to unsatisfiedF: Fn
bound.Meta
rustc version:
1.76.0 nightly
Main tracking issue: #29625
The text was updated successfully, but these errors were encountered: