-
Notifications
You must be signed in to change notification settings - Fork 13.4k
rustdoc: Resolve module-level doc references more locally #65857
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
Merged
Merged
Changes from all commits
Commits
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 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// ignore-tidy-linelength | ||
|
||
// First a module with inner documentation | ||
|
||
// @has issue_55364/subone/index.html | ||
// These foo/bar links in the module's documentation should refer inside `subone` | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subone/fn.foo.html"]' 'foo' | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subone/fn.bar.html"]' 'bar' | ||
pub mod subone { | ||
//! See either [foo] or [bar]. | ||
|
||
// This should refer to subone's `bar` | ||
// @has issue_55364/subone/fn.foo.html | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subone/fn.bar.html"]' 'bar' | ||
/// See [bar] | ||
kinnison marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pub fn foo() {} | ||
// This should refer to subone's `foo` | ||
// @has issue_55364/subone/fn.bar.html | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subone/fn.foo.html"]' 'foo' | ||
/// See [foo] | ||
pub fn bar() {} | ||
} | ||
|
||
// A module with outer documentation | ||
|
||
// @has issue_55364/subtwo/index.html | ||
// These foo/bar links in the module's documentation should not reference inside `subtwo` | ||
// @!has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subtwo/fn.foo.html"]' 'foo' | ||
// @!has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subtwo/fn.bar.html"]' 'bar' | ||
// Instead it should be referencing the top level functions | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/fn.foo.html"]' 'foo' | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/fn.bar.html"]' 'bar' | ||
// Though there should be such links later | ||
// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td/a[@class="fn"][@href="fn.foo.html"]' 'foo' | ||
// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td/a[@class="fn"][@href="fn.bar.html"]' 'bar' | ||
/// See either [foo] or [bar]. | ||
pub mod subtwo { | ||
|
||
// Despite the module's docs referring to the top level foo/bar, | ||
// this should refer to subtwo's `bar` | ||
// @has issue_55364/subtwo/fn.foo.html | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subtwo/fn.bar.html"]' 'bar' | ||
/// See [bar] | ||
pub fn foo() {} | ||
kinnison marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Despite the module's docs referring to the top level foo/bar, | ||
// this should refer to subtwo's `foo` | ||
// @has issue_55364/subtwo/fn.bar.html | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subtwo/fn.foo.html"]' 'foo' | ||
/// See [foo] | ||
pub fn bar() {} | ||
} | ||
|
||
// These are the function referred to by the module above with outer docs | ||
|
||
/// See [bar] | ||
pub fn foo() {} | ||
/// See [foo] | ||
pub fn bar() {} | ||
|
||
// This module refers to the outer foo/bar by means of `super::` | ||
|
||
// @has issue_55364/subthree/index.html | ||
// This module should also refer to the top level foo/bar | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/fn.foo.html"]' 'foo' | ||
// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/fn.bar.html"]' 'bar' | ||
pub mod subthree { | ||
//! See either [foo][super::foo] or [bar][super::bar] | ||
} | ||
|
||
// Next we go *deeper* - In order to ensure it's not just "this or parent" | ||
// we test `crate::` and a `super::super::...` chain | ||
// @has issue_55364/subfour/subfive/subsix/subseven/subeight/index.html | ||
// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td[@class="docblock-short"]//a[@href="../../../../../../issue_55364/subone/fn.foo.html"]' 'other foo' | ||
// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td[@class="docblock-short"]//a[@href="../../../../../../issue_55364/subtwo/fn.bar.html"]' 'other bar' | ||
pub mod subfour { | ||
pub mod subfive { | ||
pub mod subsix { | ||
pub mod subseven { | ||
pub mod subeight { | ||
/// See [other foo][crate::subone::foo] | ||
pub fn foo() {} | ||
/// See [other bar][super::super::super::super::super::subtwo::bar] | ||
pub fn bar() {} | ||
} | ||
} | ||
} | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.