-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: Support inlined cross-crate re-exported trait aliases #139943
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
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,13 @@ | ||
#![feature(trait_alias)] | ||
|
||
pub trait ExtAlias0 = Copy + Iterator<Item = u8>; | ||
|
||
pub trait ExtAlias1<'a, T: 'a + Clone, const N: usize> = From<[&'a T; N]>; | ||
|
||
pub trait ExtAlias2<T> = where T: From<String>, String: Into<T>; | ||
|
||
pub trait ExtAlias3 = Sized; | ||
|
||
pub trait ExtAlias4 = where Self: Sized; | ||
|
||
pub trait ExtAlias5 = ; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,82 @@ | ||
// Basic testing for trait aliases. | ||
#![feature(trait_alias)] | ||
#![crate_name = "it"] | ||
|
||
// Check the "local case" (HIR cleaning) // | ||
|
||
//@ has it/all.html '//a[@href="traitalias.Alias0.html"]' 'Alias0' | ||
//@ has it/index.html '//h2[@id="trait-aliases"]' 'Trait Aliases' | ||
//@ has it/index.html '//a[@class="traitalias"]' 'Alias0' | ||
//@ has it/traitalias.Alias0.html | ||
//@ has - '//*[@class="rust item-decl"]//code' 'trait Alias0 = Copy + Iterator<Item = u8>;' | ||
pub trait Alias0 = Copy + Iterator<Item = u8>; | ||
|
||
//@ has it/traitalias.Alias1.html | ||
//@ has - '//pre[@class="rust item-decl"]' \ | ||
// "trait Alias1<'a, T: 'a + Clone, const N: usize> = From<[&'a T; N]>;" | ||
pub trait Alias1<'a, T: 'a + Clone, const N: usize> = From<[&'a T; N]>; | ||
|
||
//@ has it/traitalias.Alias2.html | ||
//@ has - '//pre[@class="rust item-decl"]' \ | ||
// 'trait Alias2<T> = where T: From<String>, String: Into<T>;' | ||
pub trait Alias2<T> = where T: From<String>, String: Into<T>; | ||
|
||
//@ has it/traitalias.Alias3.html | ||
//@ has - '//pre[@class="rust item-decl"]' 'trait Alias3 = ;' | ||
pub trait Alias3 =; | ||
|
||
//@ has it/traitalias.Alias4.html | ||
//@ has - '//pre[@class="rust item-decl"]' 'trait Alias4 = ;' | ||
pub trait Alias4 = where; | ||
|
||
//@ has it/fn.usage0.html | ||
//@ has - '//pre[@class="rust item-decl"]' "pub fn usage0(_: impl Alias0)" | ||
//@ has - '//a[@href="traitalias.Alias0.html"]' 'Alias0' | ||
pub fn usage0(_: impl Alias0) {} | ||
|
||
// FIXME: One can only "disambiguate" intra-doc links to trait aliases with `type@` but not with | ||
// `trait@` (fails to resolve) or `traitalias@` (doesn't exist). We should make at least one of | ||
// the latter two work, right? | ||
|
||
//@ has it/link0/index.html | ||
//@ has - '//a/@href' 'traitalias.Alias0.html' | ||
//@ has - '//a/@href' 'traitalias.Alias1.html' | ||
/// [Alias0], [type@Alias1] | ||
pub mod link0 {} | ||
|
||
// Check the "extern case" (middle cleaning) // | ||
|
||
//@ aux-build: ext-trait-aliases.rs | ||
extern crate ext_trait_aliases as ext; | ||
|
||
//@ has it/traitalias.ExtAlias0.html | ||
//@ has - '//pre[@class="rust item-decl"]' 'trait ExtAlias0 = Copy + Iterator<Item = u8>;' | ||
pub use ext::ExtAlias0; | ||
|
||
//@ has it/traitalias.ExtAlias1.html | ||
//@ has - '//pre[@class="rust item-decl"]' \ | ||
// "trait ExtAlias1<'a, T, const N: usize> = From<[&'a T; N]> where T: 'a + Clone;" | ||
pub use ext::ExtAlias1; | ||
|
||
//@ has it/traitalias.ExtAlias2.html | ||
//@ has - '//pre[@class="rust item-decl"]' \ | ||
// 'trait ExtAlias2<T> = where T: From<String>, String: Into<T>;' | ||
pub use ext::ExtAlias2; | ||
|
||
//@ has it/traitalias.ExtAlias3.html | ||
//@ has - '//pre[@class="rust item-decl"]' 'trait ExtAlias3 = Sized;' | ||
pub use ext::ExtAlias3; | ||
|
||
// NOTE: Middle cleaning can't discern `= Sized` and `= where Self: Sized` and that's okay. | ||
//@ has it/traitalias.ExtAlias4.html | ||
//@ has - '//pre[@class="rust item-decl"]' 'trait ExtAlias4 = Sized;' | ||
pub use ext::ExtAlias4; | ||
|
||
//@ has it/traitalias.ExtAlias5.html | ||
//@ has - '//pre[@class="rust item-decl"]' 'trait ExtAlias5 = ;' | ||
pub use ext::ExtAlias5; | ||
|
||
//@ has it/fn.usage1.html | ||
//@ has - '//pre[@class="rust item-decl"]' "pub fn usage1(_: impl ExtAlias0)" | ||
//@ has - '//a[@href="traitalias.ExtAlias0.html"]' 'ExtAlias0' | ||
pub fn usage1(_: impl ExtAlias0) {} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
mini drive-by refactoring