Rust fails to coerce to a fn pointer when passing an array as an argument to a generic function. #136420
Labels
A-coercions
Area: implicit and explicit `expr as Type` coercions
A-inference
Area: Type inference
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
I tried this code:
I expected the six lines to either all compile or all error. Instead, only the
f([foo, bar])
line fails, with the following error:For some reason, it's failing to coerce the function items into function pointers, but only when an array is being passed to a generic function.
Discovered by @xero-lib
Meta
Issue reproducible on the playground with stable rust 1.84.1, and nightly rust
1.86.0-nightly (2025-02-01 8239a37f9c0951a037cf)
@rustbot labels +A-inference +A-coercions
The text was updated successfully, but these errors were encountered: