-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Correctly handle associated items of a trait inside a #[doc(hidden)]
item
#111095
Merged
bors
merged 4 commits into
rust-lang:master
from
GuillaumeGomez:fix-assoc-item-trait-inside-hidden
May 10, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
879f8de
Correctly handle associated items of a trait inside a `#[doc(hidden)]…
GuillaumeGomez fb160d5
Modules can be reexported and it should be handled by rustdoc
GuillaumeGomez cbc6daa
Improve code to remove duplication
GuillaumeGomez 8de4308
Add regression test for #111064
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
31 changes: 31 additions & 0 deletions
31
tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs
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,31 @@ | ||
#![feature(no_core)] | ||
#![no_core] | ||
#![crate_name = "foo"] | ||
|
||
// @!has 'foo/hidden/index.html' | ||
// FIXME: add missing `@` for the two next tests once issue is fixed! | ||
// To be done in <https://github.com/rust-lang/rust/issues/111249>. | ||
// !has 'foo/hidden/inner/index.html' | ||
// !has 'foo/hidden/inner/trait.Foo.html' | ||
#[doc(hidden)] | ||
pub mod hidden { | ||
pub mod inner { | ||
pub trait Foo { | ||
/// Hello, world! | ||
fn test(); | ||
} | ||
} | ||
} | ||
|
||
// @has 'foo/visible/index.html' | ||
// @has 'foo/visible/trait.Foo.html' | ||
#[doc(inline)] | ||
pub use hidden::inner as visible; | ||
|
||
// @has 'foo/struct.Bar.html' | ||
// @count - '//*[@id="impl-Foo-for-Bar"]' 1 | ||
pub struct Bar; | ||
|
||
impl visible::Foo for Bar { | ||
fn test() {} | ||
} |
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,21 @@ | ||
// Regression test for <https://github.com/rust-lang/rust/issues/111064>. | ||
// Methods from a re-exported trait inside a `#[doc(hidden)]` item should | ||
// be visible. | ||
|
||
#![crate_name = "foo"] | ||
|
||
// @has 'foo/index.html' | ||
// @has - '//*[@id="main-content"]//*[@class="item-name"]/a[@href="trait.Foo.html"]' 'Foo' | ||
|
||
// @has 'foo/trait.Foo.html' | ||
// @has - '//*[@id="main-content"]//*[@class="code-header"]' 'fn test()' | ||
|
||
#[doc(hidden)] | ||
mod hidden { | ||
pub trait Foo { | ||
/// Hello, world! | ||
fn test(); | ||
} | ||
} | ||
|
||
pub use hidden::Foo; |
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.
Why are
name
andrenamed
both needed? It seems likename
is completely ignored ifrenamed
is Some.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.
I wondered if I should pass the "computed"
name
or if I should do it in the function. In the end I picked this approach because it's not possible to pass the "non-computed" name since you need to pass bothname
andrenamed
.