Fix resolution for inherent array methods#10180
Merged
bors[bot] merged 3 commits intorust-lang:masterfrom Sep 8, 2021
yotamofek:fix-array-method-resolution
Merged
Fix resolution for inherent array methods#10180bors[bot] merged 3 commits intorust-lang:masterfrom yotamofek:fix-array-method-resolution
bors[bot] merged 3 commits intorust-lang:masterfrom
yotamofek:fix-array-method-resolution
Conversation
flodiebold
reviewed
Sep 8, 2021
Member
flodiebold
left a comment
There was a problem hiding this comment.
yeah, that seems acceptable to me. Can you extract the logic into two functions and add some comments explaining it?
bors d+
Contributor
|
✌️ yotamofek can now approve this pull request. To approve and merge a pull request, simply reply with |
Contributor
Author
|
@flodiebold Done. Would love your opinion about the function names and comments, I can hardly understand what the code I wrote does, so I'm not sure the explanation is very clear 😛 |
Member
|
Seems ok, I can maybe try to improve them later a bit, but let's merge it for now 👍 Thanks! bors r+ |
Contributor
This file contains hidden or 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
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.
My second attempt at fixing #9992 , previous attempt was here: #10017 , but the logic was broken.
I know that this is not an ideal solution.... that would require, IIUC, a pretty big overhaul of the const generics handling in
rust-analyzer. But, given that some of the array methods were/are being stabilized (e.g. rust-lang/rust#87174 ), I think it'll be very beneficial torust-analyzerusers to have some preliminary support for them. (I know it's something I've been running into quite a lot lately :) )As far as my limited understanding of this project's architecture goes, I think this isn't the worst hack in the world, and shouldn't be too much of a hassle to undo if/when const generics become better supported. If the maintainers deem this approach viable, I'll want to add some comments, emphasizing the purpose of this code, and that it should be removed at some point in the future.