about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-26 18:42:01 +0000
committerbors <bors@rust-lang.org>2023-06-26 18:42:01 +0000
commit36fb58e433c782e27dd41034284e157cf86d587f (patch)
treee5ca502ddc19701f65dfb140b813ef88f33dadcd /tests
parent6f8c27ae89dfd32895419d7ef5b89844bcad1bcd (diff)
parent40e3fcfd59b02665464bc17fe6a11ebd311ac78a (diff)
downloadrust-36fb58e433c782e27dd41034284e157cf86d587f.tar.gz
rust-36fb58e433c782e27dd41034284e157cf86d587f.zip
Auto merge of #113057 - TaKO8Ki:rollup-071lc9g, r=TaKO8Ki
Rollup of 2 pull requests

Successful merges:

 - #112677 (remove unused field)
 - #112920 (rustdoc: render generic params & where-clauses of cross-crate assoc tys in impls)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs12
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs17
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>>;
+}