strange borrowing suggestion #134805
Labels
A-borrow-checker
Area: The borrow checker
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Rustc suggests borrowing of a function's return type when there is a trait not implemented error for the function's parameters.
Not only does the borrow not help, a dereferencing is required instead, but it is suggested for the return type, which is not where the problem is at all.
Consider the following program:
On latest nightly
1.85.0-nightly (2024-12-25 7c002ff9a70cb84fd1a9)
(same as on stable and beta):The example shows that if there is one parameter, a borrow is not suggested. It happens only if there is two parameters.
Related (but not the same): #132041
The text was updated successfully, but these errors were encountered: