about summary refs log tree commit diff
path: root/src/test/rustdoc/doc-notable_trait-slice.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2021-11-29 12:18:57 -0700
committerMichael Howell <michael@notriddle.com>2021-11-29 12:23:07 -0700
commit85ba6c7b3489f5b23ca146d6ebde657bf8b52c36 (patch)
treeb1d337e852eb729d6cd8f3c8f14afd2113f51477 /src/test/rustdoc/doc-notable_trait-slice.rs
parent6db0a0e9a4a2f55b1a85954e114ada0b45c32e45 (diff)
downloadrust-85ba6c7b3489f5b23ca146d6ebde657bf8b52c36.tar.gz
rust-85ba6c7b3489f5b23ca146d6ebde657bf8b52c36.zip
Only show notable traits if both types are the same
Checking only their DefId doesn't work because all slices have the same
fake DefId.

Fixes #91347
Diffstat (limited to 'src/test/rustdoc/doc-notable_trait-slice.rs')
-rw-r--r--src/test/rustdoc/doc-notable_trait-slice.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/rustdoc/doc-notable_trait-slice.rs b/src/test/rustdoc/doc-notable_trait-slice.rs
new file mode 100644
index 00000000000..b0d41402721
--- /dev/null
+++ b/src/test/rustdoc/doc-notable_trait-slice.rs
@@ -0,0 +1,20 @@
+#![feature(doc_notable_trait)]
+
+#[doc(notable_trait)]
+pub trait SomeTrait {}
+
+pub struct SomeStruct;
+pub struct OtherStruct;
+impl SomeTrait for &[SomeStruct] {}
+
+// @has doc_notable_trait_slice/fn.bare_fn_matches.html
+// @has - '//code[@class="content"]' 'impl SomeTrait for &[SomeStruct]'
+pub fn bare_fn_matches() -> &'static [SomeStruct] {
+    &[]
+}
+
+// @has doc_notable_trait_slice/fn.bare_fn_no_matches.html
+// @!has - '//code[@class="content"]' 'impl SomeTrait for &[SomeStruct]'
+pub fn bare_fn_no_matches() -> &'static [OtherStruct] {
+    &[]
+}