-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
1 change: 1 addition & 0 deletions
1
src/test/rustdoc/inline_cross/assoc_item_trait_bounds_with_bindings.out0.html
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 @@ | ||
<h4 class="code-header">type <a href="#associatedtype.Out0" class="associatedtype">Out0</a>: <a class="trait" href="../assoc_item_trait_bounds_with_bindings/trait.Support.html" title="trait assoc_item_trait_bounds_with_bindings::Support">Support</a><Item = <a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>></h4> |
1 change: 1 addition & 0 deletions
1
src/test/rustdoc/inline_cross/assoc_item_trait_bounds_with_bindings.out9.html
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 @@ | ||
<h4 class="code-header">type <a href="#associatedtype.Out9" class="associatedtype">Out9</a>: <a class="trait" href="{{channel}}/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="{{channel}}/std/primitive.bool.html">bool</a> + <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></h4> |
40 changes: 40 additions & 0 deletions
40
src/test/rustdoc/inline_cross/assoc_item_trait_bounds_with_bindings.rs
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,40 @@ | ||
// Regression test for issues #77763, #84579 and #102142. | ||
#![crate_name = "main"] | ||
|
||
// aux-build:assoc_item_trait_bounds_with_bindings.rs | ||
// build-aux-docs | ||
// ignore-cross-compile | ||
extern crate assoc_item_trait_bounds_with_bindings as aux; | ||
|
||
// FIXME(fmease): Don't render an incorrect `T: ?Sized` where-clause for parameters | ||
// of GATs like `Main::Out{2,4}`. Add a snapshot test once it's fixed. | ||
// FIXME(fmease): Print the `for<>` parameter list in the bounds of | ||
// `Main::Out{6,11,12}`. | ||
|
||
// @has main/trait.Main.html | ||
// @has - '//*[@id="associatedtype.Out0"]' 'type Out0: Support<Item = ()>' | ||
// @has - '//*[@id="associatedtype.Out1"]' 'type Out1: Support<Item = Self::Item>' | ||
// @has - '//*[@id="associatedtype.Out2"]' 'type Out2<T>: Support<Item = T>' | ||
// @has - '//*[@id="associatedtype.Out3"]' 'type Out3: Support<Produce<()> = bool>' | ||
// @has - '//*[@id="associatedtype.Out4"]' 'type Out4<T>: Support<Produce<T> = T>' | ||
// @has - '//*[@id="associatedtype.Out5"]' "type Out5: Support<Output<'static> = &'static ()>" | ||
// @has - '//*[@id="associatedtype.Out6"]' "type Out6: Support<Output<'a> = &'a ()>" | ||
// @has - '//*[@id="associatedtype.Out7"]' "type Out7: Support<Item = String, Produce<i32> = u32> + Unrelated" | ||
// @has - '//*[@id="associatedtype.Out8"]' "type Out8: Unrelated + Protocol<i16, Q1 = u128, Q0 = ()>" | ||
// @has - '//*[@id="associatedtype.Out9"]' "type Out9: FnMut(i32) -> bool + Clone" | ||
// @has - '//*[@id="associatedtype.Out10"]' "type Out10<'q>: Support<Output<'q> = ()>" | ||
// @has - '//*[@id="associatedtype.Out11"]' "type Out11: Helper<A<'s> = &'s (), B<'r> = ()>" | ||
// @has - '//*[@id="associatedtype.Out12"]' "type Out12: Helper<B<'w> = Cow<'w, str>, A<'w> = bool>" | ||
// | ||
// Snapshots: Check that we do not render any where-clauses for those associated types since all of | ||
// the trait bounds contained within were moved to the bounds of the respective item. | ||
// | ||
// @snapshot out0 - '//*[@id="associatedtype.Out0"]/*[@class="code-header"]' | ||
// @snapshot out9 - '//*[@id="associatedtype.Out9"]/*[@class="code-header"]' | ||
// | ||
// @has - '//*[@id="tymethod.make"]' \ | ||
// "fn make<F>(F, impl FnMut(&str) -> bool)\ | ||
// where \ | ||
// F: FnOnce(u32) -> String, \ | ||
// Self::Out2<()>: Protocol<u8, Q0 = Self::Item, Q1 = ()>" | ||
pub use aux::Main; |
40 changes: 40 additions & 0 deletions
40
src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds_with_bindings.rs
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,40 @@ | ||
pub trait Main { | ||
type Item; | ||
|
||
type Out0: Support<Item = ()>; | ||
type Out1: Support<Item = Self::Item>; | ||
type Out2<T>: Support<Item = T>; | ||
type Out3: Support<Produce<()> = bool>; | ||
type Out4<T>: Support<Produce<T> = T>; | ||
type Out5: Support<Output<'static> = &'static ()>; | ||
type Out6: for<'a> Support<Output<'a> = &'a ()>; | ||
type Out7: Support<Item = String, Produce<i32> = u32> + Unrelated; | ||
type Out8: Unrelated + Protocol<i16, Q1 = u128, Q0 = ()>; | ||
type Out9: FnMut(i32) -> bool + Clone; | ||
type Out10<'q>: Support<Output<'q> = ()>; | ||
type Out11: for<'r, 's> Helper<A<'s> = &'s (), B<'r> = ()>; | ||
type Out12: for<'w> Helper<B<'w> = std::borrow::Cow<'w, str>, A<'w> = bool>; | ||
|
||
fn make<F>(_: F, _: impl FnMut(&str) -> bool) | ||
where | ||
F: FnOnce(u32) -> String, | ||
Self::Out2<()>: Protocol<u8, Q0 = Self::Item, Q1 = ()>; | ||
} | ||
|
||
pub trait Support { | ||
type Item; | ||
type Output<'a>; | ||
type Produce<T>; | ||
} | ||
|
||
pub trait Protocol<K> { | ||
type Q0; | ||
type Q1; | ||
} | ||
|
||
pub trait Unrelated {} | ||
|
||
pub trait Helper { | ||
3E53 | type A<'q>; | |
type B<'q>; | ||
} |
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.
rustdoc: re-sugar more cross-crate trait bounds #102439
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
Uh oh!
There was an error while loading. Please reload this page.
rustdoc: re-sugar more cross-crate trait bounds #102439
Changes from all commits
a540234
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.