-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Error message about immutable binding is not actually caused by a binding #49839
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
In Rust 1.23 and earlier, the error was:
|
Current output is slightly more misleading, but I think improving on this will be hard:
|
This overlaps slightly with #18150, but is more targeted, leaving open. |
Triage: no change |
I'll work on it. @rustbot calim current output is following.
|
@sasurau4 you might want to first focus on the case where the |
@estebank Thanks for your advice! I was stuck on how to get the binding rhs expression |
…hod-for-loop, r=oli-obk Add suggest mut method for loop Part of rust-lang#49839 This PR focus on [the comment case](rust-lang#49839 (comment))
Thanks to @sasurau4 the output for the "inlined" case is now:
The |
See the following code:
It raises this compiler error:
The fix is to use
values_mut()
instead ofvalues()
.But the error message is confusing as the problem here is not the binding as
t
itself ismut
making it harder to debug for newcomers.The text was updated successfully, but these errors were encountered: