about summary refs log tree commit diff
path: root/tests/rustdoc/impl/universal-impl-trait.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-05-05 17:01:08 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-05-05 17:47:18 +0200
commitb84f4cc39e99f801dcd37125dffa67eb796c85b8 (patch)
tree071def2349dabae166fd66b06ee9346aa825abb9 /tests/rustdoc/impl/universal-impl-trait.rs
parentbe71d8b24f1aebe9c45279d95a76db8fa6a62574 (diff)
downloadrust-b84f4cc39e99f801dcd37125dffa67eb796c85b8.tar.gz
rust-b84f4cc39e99f801dcd37125dffa67eb796c85b8.zip
Created `tests/rustdoc/impl` subfolder to limit number of files at the top level
Diffstat (limited to 'tests/rustdoc/impl/universal-impl-trait.rs')
-rw-r--r--tests/rustdoc/impl/universal-impl-trait.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/rustdoc/impl/universal-impl-trait.rs b/tests/rustdoc/impl/universal-impl-trait.rs
new file mode 100644
index 00000000000..b78d69c0690
--- /dev/null
+++ b/tests/rustdoc/impl/universal-impl-trait.rs
@@ -0,0 +1,55 @@
+#![crate_name = "foo"]
+
+use std::io::Read;
+use std::borrow::Borrow;
+
+//@ has foo/fn.foo.html
+//@ has - //pre 'foo('
+//@ matchesraw - '_x: impl <a class="trait" href="[^"]+/trait\.Clone\.html"'
+//@ matchesraw - '_z: .+impl.+trait\.Copy\.html.+, impl.+trait\.Clone\.html'
+pub fn foo(_x: impl Clone, _y: i32, _z: (impl Copy, impl Clone)) {
+}
+
+pub trait Trait {
+    //@ has foo/trait.Trait.html
+    //@ hasraw - 'method</a>('
+    //@ matchesraw - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"'
+    fn method(&self, _x: impl std::fmt::Debug) {
+    }
+}
+
+pub struct S<T>(T);
+
+impl<T> S<T> {
+    //@ has foo/struct.S.html
+    //@ hasraw - 'bar</a>('
+    //@ matchesraw - '_bar: impl <a class="trait" href="[^"]+/trait\.Copy\.html"'
+    pub fn bar(_bar: impl Copy) {
+    }
+
+    //@ hasraw - 'baz</a>('
+    //@ matchesraw - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html'
+    pub fn baz(_baz: S<impl Clone>) {
+    }
+
+    //@ hasraw - 'qux</a>('
+    //@ matchesraw - 'trait\.Read\.html'
+    pub fn qux(_qux: impl IntoIterator<Item = S<impl Read>>) {
+    }
+}
+
+//@ hasraw - 'method</a>('
+//@ matchesraw - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"'
+impl<T> Trait for S<T> {}
+
+//@ has foo/fn.much_universe.html
+//@ matchesraw - 'T:.+Borrow.+impl .+trait\.Trait\.html'
+//@ matchesraw - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html'
+//@ matchesraw - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html'
+pub fn much_universe<
+    T: Borrow<impl Trait>,
+    U: IntoIterator<Item = impl Iterator<Item = impl Clone>>,
+>(
+    _: impl Read + Clone,
+) {
+}