diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2023-06-22 10:42:02 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2023-06-24 12:20:26 +0200 |
| commit | c643bedf7c90940005da021ba80b6c4e6dcbdaa5 (patch) | |
| tree | e3df03f501327263456f21edd625e35588f2d699 /tests/rustdoc | |
| parent | e0ba2d038db3afa968e13075b1d6eabd24339708 (diff) | |
| download | rust-c643bedf7c90940005da021ba80b6c4e6dcbdaa5.tar.gz rust-c643bedf7c90940005da021ba80b6c4e6dcbdaa5.zip | |
rustdoc: render gen params & where-clauses of cross-crate assoc tys in impl blocks
Diffstat (limited to 'tests/rustdoc')
| -rw-r--r-- | tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs | 12 | ||||
| -rw-r--r-- | tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs | 17 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs b/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs index db2491b87b4..74ceb697af6 100644 --- a/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs +++ b/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs @@ -42,3 +42,15 @@ pub use aux::Main; // @has main/trait.Aid.html // @has - '//*[@id="associatedtype.Result"]' "type Result<'inter: 'src>" pub use aux::Aid; + +// Below, ensure that we correctly display generic parameters and where-clauses on +// associated types inside trait *impls*. More particularly, check that we don't render +// any bounds (here `Self::Alias<T>: ...`) as item bounds unlike all the trait test cases above. + +// @has main/struct.Implementor.html +// @has - '//*[@id="associatedtype.Alias"]' \ +// "type Alias<T: Eq> = T \ +// where \ +// String: From<T>, \ +// <Implementor as Implementee>::Alias<T>: From<<Implementor as Implementee>::Alias<T>>" +pub use aux::Implementor; diff --git a/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs b/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs index 6644c8e4147..551e97a2fa9 100644 --- a/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs +++ b/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs @@ -44,3 +44,20 @@ pub trait Helper { pub trait Aid<'src> { type Result<'inter: 'src>; } + +pub trait Implementee { + type Alias<T: Eq> + where + String: From<T>; +} + +pub struct Implementor; + +impl Implementee for Implementor { + type Alias<T: Eq> = T + where + String: From<T>, + // We will check that this bound doesn't get turned into an item bound since + // associated types in impls are not allowed to have any. + Self::Alias<T>: From<Self::Alias<T>>; +} |
