about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-08-09 17:34:54 +0530
committerGitHub <noreply@github.com>2022-08-09 17:34:54 +0530
commitd910e5376b69d232071b8eeed4d65e703e13a82b (patch)
tree81ea31c690e0e14ab9d751b47b80431ad51ac0b6 /src/test/rustdoc
parent7efe24c3ed070193ca64f402036166c8ab0c44b3 (diff)
parentb3b23aada9382e7768c0bd4d8f79319d73558259 (diff)
downloadrust-d910e5376b69d232071b8eeed4d65e703e13a82b.tar.gz
rust-d910e5376b69d232071b8eeed4d65e703e13a82b.zip
Rollup merge of #100221 - compiler-errors:impossible-trait-items, r=lcnr,notriddle,camelid
Don't document impossible to call default trait items on impls

Closes #100176

This only skips documenting _default_ trait items on impls, not ones that are written inside the impl block. This is a conservative approach, since I think we should document all items written in an impl block (I guess unless hidden or whatever), but the existence of this new query I added makes this easy to extend to other rustdoc cases.
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/impossible-default.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/rustdoc/impossible-default.rs b/src/test/rustdoc/impossible-default.rs
new file mode 100644
index 00000000000..24d6e3bdac1
--- /dev/null
+++ b/src/test/rustdoc/impossible-default.rs
@@ -0,0 +1,20 @@
+#![crate_name = "foo"]
+
+// Check that default trait items that are impossible to satisfy
+
+pub trait Foo {
+    fn needs_sized(&self)
+    where
+        Self: Sized,
+    {}
+
+    fn no_needs_sized(&self) {}
+}
+
+// @!has foo/struct.Bar.html '//*[@id="method.needs_sized"]//h4[@class="code-header"]' \
+// "fn needs_sized"
+// @has foo/struct.Bar.html '//*[@id="method.no_needs_sized"]//h4[@class="code-header"]' \
+// "fn no_needs_sized"
+pub struct Bar([u8]);
+
+impl Foo for Bar {}