-
Notifications
You must be signed in to change notification settings - Fork 13k
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 deref impl typedef #68093
Merged
Merged
Fix deref impl typedef #68093
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
12f029b
Fix deref impl on type alias
GuillaumeGomez fd4a88f
Add test for typedef deref
GuillaumeGomez 81a5b94
formatting
GuillaumeGomez 6e79146
remove unneeded code from cache.rs
GuillaumeGomez e6ad49a
Include type alias implementations
GuillaumeGomez d755238
Simplify deref impls for type aliases
GuillaumeGomez 8a9b951
Fix rendering on sidebar and update tests
GuillaumeGomez 3094c37
Improve code readability
GuillaumeGomez 482dc77
formatting
GuillaumeGomez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#![crate_name = "foo"] | ||
|
||
// @has 'foo/struct.Bar.html' | ||
// @has '-' '//*[@id="deref-methods"]' 'Methods from Deref<Target = FooC>' | ||
// @has '-' '//*[@class="impl-items"]//*[@id="method.foo_a"]' 'pub fn foo_a(&self)' | ||
// @has '-' '//*[@class="impl-items"]//*[@id="method.foo_b"]' 'pub fn foo_b(&self)' | ||
// @has '-' '//*[@class="impl-items"]//*[@id="method.foo_c"]' 'pub fn foo_c(&self)' | ||
// @has '-' '//*[@class="sidebar-title"]' 'Methods from Deref<Target=FooC>' | ||
// @has '-' '//*[@class="sidebar-links"]/a[@href="#method.foo_a"]' 'foo_a' | ||
// @has '-' '//*[@class="sidebar-links"]/a[@href="#method.foo_b"]' 'foo_b' | ||
// @has '-' '//*[@class="sidebar-links"]/a[@href="#method.foo_c"]' 'foo_c' | ||
|
||
pub struct FooA; | ||
pub type FooB = FooA; | ||
pub type FooC = FooB; | ||
|
||
impl FooA { | ||
pub fn foo_a(&self) {} | ||
} | ||
|
||
impl FooB { | ||
pub fn foo_b(&self) {} | ||
} | ||
|
||
impl FooC { | ||
pub fn foo_c(&self) {} | ||
} | ||
|
||
pub struct Bar; | ||
impl std::ops::Deref for Bar { | ||
type Target = FooC; | ||
fn deref(&self) -> &Self::Target { unimplemented!() } | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try deduplicating the
ret.push
with the one afterwards? Maybefor for_ in type_alias.into_iter().chain(self.for_.clean(cx)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do it this way, we'll have to clone
trait_
anditems
one extra time. I'll write something else instead to avoid the duplication of code.