Suggest split_at_mut on multiple mutable index access#68819
Suggest split_at_mut on multiple mutable index access#68819bors merged 1 commit intorust-lang:masterfrom
split_at_mut on multiple mutable index access#68819Conversation
|
(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.
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.
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.