Skip to content
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 adding a local for vector to fix borrowck errors #95807

Merged
merged 1 commit into from
Apr 10, 2022

Conversation

TaKO8Ki
Copy link
Member

@TaKO8Ki TaKO8Ki commented Apr 8, 2022

closes #95574

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 8, 2022
@rust-highfive
Copy link
Collaborator

r? @fee1-dead

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 8, 2022
Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Ideally instead of highlighting the expression that borrows, we could extend it to its usage, so instead of:

help: try adding a local
LL |     vec[vec.len() - 1] = 123;
   |         ^^^^^^^^^

We could do:

help: try adding a local
LL |     vec[vec.len() - 1] = 123;
   |         ^^^^^^^^^^^^^

But I don't think this is trivial.

@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 10, 2022

📌 Commit 71fea61 has been approved by fee1-dead

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 10, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 10, 2022
…r, r=fee1-dead

Suggest adding a local for vector to fix borrowck errors

closes rust-lang#95574
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#95566 (Avoid duplication of doc comments in `std::char` constants and functions)
 - rust-lang#95784 (Suggest replacing `typeof(...)` with an actual type)
 - rust-lang#95807 (Suggest adding a local for vector to fix borrowck errors)
 - rust-lang#95849 (Check for git submodules in non-git source tree.)
 - rust-lang#95852 (Fix missing space in lossy provenance cast lint)
 - rust-lang#95857 (Allow multiple derefs to be splitted in deref_separator)
 - rust-lang#95868 (rustdoc: Reduce allocations in a `html::markdown` function)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c172544 into rust-lang:master Apr 10, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 10, 2022
@TaKO8Ki TaKO8Ki deleted the suggest-local-var-for-vector branch April 11, 2022 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E0502 diagnostic missing help text when using IndexMut instead of .get_mut.
5 participants