-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Remove disambiguators from intra doc link text #76078
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
+229
−40
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
89ae59a
Remove needless .to_owned() for link
jyn514 d5495e2
Refactor `ItemLink` into its own struct
jyn514 31a7b6e
Refactor RenderedLink into its own type
jyn514 9815010
Remove disambiguators from link text
jyn514 9d7e797
display_for -> suggestion_for
jyn514 18c14fd
Misc cleanup
jyn514 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
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
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,51 @@ | ||
// ignore-tidy-linelength | ||
#![deny(intra_doc_link_resolution_failure)] | ||
// first try backticks | ||
/// Trait: [`trait@Name`], fn: [`fn@Name`], [`Name`][`macro@Name`] | ||
// @has intra_link_disambiguators_removed/struct.AtDisambiguator.html | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/trait.Name.html"][code]' "Name" | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"][code]' "Name" | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/macro.Name.html"][code]' "Name" | ||
pub struct AtDisambiguator; | ||
|
||
/// fn: [`Name()`], macro: [`Name!`] | ||
// @has intra_link_disambiguators_removed/struct.SymbolDisambiguator.html | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"][code]' "Name()" | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/macro.Name.html"][code]' "Name!" | ||
pub struct SymbolDisambiguator; | ||
|
||
// Now make sure that backticks aren't added if they weren't already there | ||
/// [fn@Name] | ||
// @has intra_link_disambiguators_removed/trait.Name.html | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"]' "Name" | ||
// @!has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"][code]' "Name" | ||
|
||
// FIXME: this will turn !() into ! alone | ||
/// [Name!()] | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/macro.Name.html"]' "Name!" | ||
pub trait Name {} | ||
|
||
#[allow(non_snake_case)] | ||
|
||
// Try collapsed reference links | ||
/// [macro@Name][] | ||
// @has intra_link_disambiguators_removed/fn.Name.html | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/macro.Name.html"]' "Name" | ||
|
||
// Try links that have the same text as a generated URL | ||
/// Weird URL aligned [../intra_link_disambiguators_removed/macro.Name.html][trait@Name] | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/trait.Name.html"]' "../intra_link_disambiguators_removed/macro.Name.html" | ||
pub fn Name() {} | ||
|
||
#[macro_export] | ||
// Rustdoc doesn't currently handle links that have weird interspersing of inline code blocks. | ||
/// [fn@Na`m`e] | ||
// @has intra_link_disambiguators_removed/macro.Name.html | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"]' "fn@Name" | ||
|
||
// It also doesn't handle any case where the code block isn't the whole link text: | ||
/// [trait@`Name`] | ||
// @has - '//a[@href="../intra_link_disambiguators_removed/trait.Name.html"]' "trait@Name" | ||
macro_rules! Name { | ||
() => () | ||
} |
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.