Normalize associated types in paths in expressions#14436
Merged
bors merged 2 commits intorust-lang:masterfrom Apr 5, 2023
Merged
Normalize associated types in paths in expressions#14436bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
HKalbasi
reviewed
Apr 4, 2023
Comment on lines
+885
to
+888
| // to a projection, which `TyLoweringContext` cannot handle on its own. | ||
| while !remaining_segments.is_empty() { | ||
| let resolved_segment = path.segments().get(remaining_idx - 1).unwrap(); | ||
| let current_segment = remaining_segments.take(1); |
Member
There was a problem hiding this comment.
There are a bunch of unwrap in this function, which I think it is possible to remove by defining some windows like thing for PathSegments (or by using Itertools::tuple_windows) and a function which goes from a &PathSegment to a &PathSegments (similar to slice::from_ref).
Member
There was a problem hiding this comment.
we've got these path segment unwraps in more places (our API for paths isn't really that great currently)
Member
There was a problem hiding this comment.
Okay, so we can do it in a follow up.
Member
|
@bors r+ |
Contributor
Contributor
Contributor
|
☀️ Test successful - checks-actions |
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.
Part of #14393
When we resolve paths in expressions (either path expressions or paths in struct expressions), there's a need of projection normalization, which
TyLoweringContextcannot do on its own. We've been properly applying normalization for paths in struct expressions without type anchor, but not for others:With this PR we correctly resolve the whole path, but we need some more tweaks in HIR and/or IDE layers to properly resolve a qualifier (prefix) of such paths and provide IDE features that are pointed out in #14393 to be currently broken.