-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Suggest split_at_mut
on multiple mutable index access
#68819
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
cc @oli-obk a (very) simplified version of the suggestion we discussed last RustConf. |
| ------ first borrow later used here | ||
| | ||
= help: consider using `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For short arrays, should we hint at patterns too? https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a9b151b57dc05010be68d1d714be741c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would be a good advice to give, but the compiler at this time doesn't know the possible size of the vector. I think that can be good follow up work.
Edited main post as to not close the issue yet. Still merging since this makes the @bors r+ |
📌 Commit 0f73133 has been approved by |
r? @oli-obk |
Suggest `split_at_mut` on multiple mutable index access cc rust-lang#58792.
Rollup of 7 pull requests Successful merges: - #68282 (Instrument C / C++ in MemorySanitizer example) - #68758 (Fix 59191 - ICE when macro replaces crate root with non-module item) - #68805 (bootstrap: fix clippy warnings) - #68810 (Remove Copy impl from OnceWith) - #68815 (remove redundant imports (clippy::single_component_path_imports)) - #68818 (fix couple of perf related clippy warnings) - #68819 (Suggest `split_at_mut` on multiple mutable index access) Failed merges: r? @ghost
I wonder why this PR works for |
|
cc #58792.