Skip to content

Conversation

@GTimothy
Copy link

@GTimothy GTimothy commented Feb 6, 2026

fixes #150001
fixes rust-lang/rust-analyzer#16076
fixes #134917

The issues are threefold and linked:

  1. Assigning data to a collection suggests 3 solutions all marked as MachineApplicable
  2. The suggestions are slightly wrong with regards to their borrowing needs.
  3. The suggestions are not guaranteed to produce code that is valid, and suggestion number two is equivalent to an update, not an insertion.

This PR:

  • splits the large triple suggestion into three
  • sets them to MaybeIncorrect
  • automatically determines the required borrowing to use.

I think this solution may not be very elegant, expecially the key typechecking / borrowing part, but it works. I am however very open to any improvement/change :)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 6, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2026

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • People who recently interacted with files modified in this PR: borrowck, compiler
  • borrowck, compiler expanded to 21 candidates
  • Random selection from 13 candidates

@rustbot

This comment has been minimized.

splits the large triple suggestion into three
sets them to MaybeIncorrect
automatically determines the required borrowing to use.
@GTimothy GTimothy force-pushed the map-diagnostics-fix branch from 8034656 to 2371906 Compare February 6, 2026 12:18
@GTimothy
Copy link
Author

GTimothy commented Feb 6, 2026

oops, meant to title "Fix 'assign to data in an index of' map suggestions"
Should probably rename the commit too.

@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
checking C++ file formatting
spellchecking files
building external tool typos from package typos-cli@1.38.1
finished building tool typos
error: `exessive` should be `excessive`
    ╭▸ compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:664:39
    │
664 │                         // remove the exessive referencing if necessary, but get_mut requires a ref
    ╰╴                                      ━━━━━━━━
rerun tidy with `--extra-checks=spellcheck --bless` to fix typos
tidy [extra_checks]: checks with external tool 'typos' failed
tidy [extra_checks]: FAIL
tidy: The following check failed: extra_checks
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/checkout --cargo-path=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/checkout/obj/build --concurrency=4 --npm-path=/node/bin/yarn --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1612:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1365:29

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Build completed unsuccessfully in 0:02:40
  local time: Fri Feb  6 12:25:01 UTC 2026
  network time: Fri, 06 Feb 2026 12:25:01 GMT
##[error]Process completed with exit code 1.

@GTimothy GTimothy marked this pull request as draft February 6, 2026 13:03
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

4 participants