-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: Goto definition for deref_mut
#16696
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rustbot
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Feb 27, 2024
Veykril
approved these changes
Feb 27, 2024
Thanks! I wonder if we record that for indexing expressions as well so that we can resolve |
Good point. I'll check for that case tomorrow |
☀️ Test successful - checks-actions |
bors
added a commit
that referenced
this pull request
Feb 29, 2024
fix: Goto definition for `index_mut` Mostly same with #16696. https://github.com/rust-lang/rust-analyzer/blob/0ac05c05271f31c43d31017cbd288e8737a0edb0/crates/hir-ty/src/infer/mutability.rs#L103-L133 Thankfully, we are doing similar method resolutions so we can use them like the mentioned PR. As there are only three `LangItem`s having `Mut` in there names; `FnMut`, `DerefMut` and `IndexMut`, I think that this is the last one 😄
This was referenced May 9, 2024
This was referenced May 28, 2024
This was referenced Jun 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #16520
rust-analyzer/crates/hir/src/source_analyzer.rs
Lines 375 to 393 in a3236be
As we can see from the above, current implementation routes all dereferencing prefix operations to
Deref::deref
implementation, not regarding mutabilities.rust-analyzer/crates/hir-ty/src/infer/mutability.rs
Lines 134 to 151 in a3236be
Since we are resolving them already in mutability inferences, we can use those results for proper
deref
/deref_mut
routing.