-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Improve usability for "make variable mut" suggestion #12618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Related #8449, though this one would be just about providing the rustc suggestion in more places. I think we used to do this, but changed it because it led to some problems? |
The easy solution here is to also provide the quick fix where the main error is reported. The problem is that, for other diagnostics, this will end up with quick fixes that say something like "consider removing this semicolon", while not pointing at a semicolon at all (selecting the quick fix will remove a semicolon somewhere else). This is very confusing and something I'd like to avoid. Maybe this specific diagnostic could be implemented natively now? That way we'd have full control over how it looks. |
Hmm, I guess this particular error doesn't really need the borrow-checker? |
Seems to me that the only tricky part of the diagnostic is implicit borrows, so it has to check not only for |
Yeah, I think as long as RA can see the type signature of the called function (including if it's in a trait), it should be fairly straightforward to determine if there's mutation (famous last words...). |
We already keep track of autorefs / derefs. I think there's a bit of a tricky part with keeping track where we "need mut" during inference so that everything in |
Native diagnostic is implemented in #14232. The suggestion for rustc diagnostic still only works on declaration but I think the native diagnostic is good enough that fixing rustc suggestion doesn't worth the effort. |
With code like
RA suggests that I make
v
mut
(which I expect!). However, in order to apply the suggestion, I have to navigate to the space betweenlet
andv
, at which point it's no faster than typing it myself.When I used to use RLS, I could press
Cmd-.
at the point of use (v.push
) and have it apply the suggestion to the declaration place. Could RA do this as well? It'd be a great quality of life improvement IMO.Originally posted on Zulip.
The text was updated successfully, but these errors were encountered: