about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-16 13:46:01 +0000
committerbors <bors@rust-lang.org>2021-04-16 13:46:01 +0000
commit2faef12b656d40522ca3b4a53b36299b4364e717 (patch)
treecd720d31399a713ad854b977cc401d72f5ccd02f /src/test/rustdoc
parent3833636446b670ee905fba5f8d18881b1739814e (diff)
parentc7c59d7c3b5ace6f47a48fb74c7114e1f60a4667 (diff)
downloadrust-2faef12b656d40522ca3b4a53b36299b4364e717.tar.gz
rust-2faef12b656d40522ca3b4a53b36299b4364e717.zip
Auto merge of #84241 - Dylan-DPC:rollup-jk9nt6k, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #83337 (rustdoc: Hide item contents, not items)
 - #83944 (Fix a couple resolve bugs from binder refactor)
 - #84145 (Address comments for vecdeque_binary_search #78021)
 - #84172 (Compiler error messages: reduce assertiveness of message E0384)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/attributes.rs10
-rw-r--r--src/test/rustdoc/item-hide-threshold.rs155
-rw-r--r--src/test/rustdoc/trait-attributes.rs6
3 files changed, 163 insertions, 8 deletions
diff --git a/src/test/rustdoc/attributes.rs b/src/test/rustdoc/attributes.rs
index 54c5939f908..51cd4a6cbfd 100644
--- a/src/test/rustdoc/attributes.rs
+++ b/src/test/rustdoc/attributes.rs
@@ -1,21 +1,21 @@
 #![crate_name = "foo"]
 
-// @has foo/fn.f.html '//*[@class="docblock attributes"]' '#[no_mangle]'
+// @has foo/fn.f.html '//*[@class="rust fn"]' '#[no_mangle]'
 #[no_mangle]
 pub extern "C" fn f() {}
 
-// @has foo/fn.g.html '//*[@class="docblock attributes"]' '#[export_name = "bar"]'
+// @has foo/fn.g.html '//*[@class="rust fn"]' '#[export_name = "bar"]'
 #[export_name = "bar"]
 pub extern "C" fn g() {}
 
-// @matches foo/enum.Foo.html '//*[@class="docblock attributes top-attr"]' \
-//      '(?m)\A#\[repr\(i64\)\]\n#\[must_use\]\Z'
+// @matches foo/enum.Foo.html '//*[@class="rust enum"]' \
+//      '#\[repr\(i64\)\]\n#\[must_use\]'
 #[repr(i64)]
 #[must_use]
 pub enum Foo {
     Bar,
 }
 
-// @has foo/struct.Repr.html '//*[@class="docblock attributes top-attr"]' '#[repr(C, align(8))]'
+// @has foo/struct.Repr.html '//*[@class="docblock type-decl"]' '#[repr(C, align(8))]'
 #[repr(C, align(8))]
 pub struct Repr;
diff --git a/src/test/rustdoc/item-hide-threshold.rs b/src/test/rustdoc/item-hide-threshold.rs
new file mode 100644
index 00000000000..616eef95662
--- /dev/null
+++ b/src/test/rustdoc/item-hide-threshold.rs
@@ -0,0 +1,155 @@
+#![allow(unused)]
+
+// @has 'item_hide_threshold/struct.PubStruct.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
+pub struct PubStruct {
+    pub a: usize,
+    pub b: usize,
+}
+
+// @has 'item_hide_threshold/struct.BigPubStruct.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
+// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
+pub struct BigPubStruct {
+    pub a: usize,
+    pub b: usize,
+    pub c: usize,
+    pub d: usize,
+    pub e: usize,
+    pub f: usize,
+    pub g: usize,
+    pub h: usize,
+    pub i: usize,
+    pub j: usize,
+    pub k: usize,
+    pub l: usize,
+    pub m: usize,
+}
+
+// @has 'item_hide_threshold/union.BigUnion.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
+// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
+pub union BigUnion {
+    pub a: usize,
+    pub b: usize,
+    pub c: usize,
+    pub d: usize,
+    pub e: usize,
+    pub f: usize,
+    pub g: usize,
+    pub h: usize,
+    pub i: usize,
+    pub j: usize,
+    pub k: usize,
+    pub l: usize,
+    pub m: usize,
+}
+
+// @has 'item_hide_threshold/union.Union.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
+pub union Union {
+    pub a: usize,
+    pub b: usize,
+    pub c: usize,
+}
+
+// @has 'item_hide_threshold/struct.PrivStruct.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
+// @has - '//div[@class="docblock type-decl"]' 'fields omitted'
+pub struct PrivStruct {
+    a: usize,
+    b: usize,
+}
+
+// @has 'item_hide_threshold/enum.Enum.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
+pub enum Enum {
+    A, B, C,
+    D {
+        a: u8,
+        b: u8
+    }
+}
+
+// @has 'item_hide_threshold/enum.LargeEnum.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
+// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show variants'
+pub enum LargeEnum {
+    A, B, C, D, E, F(u8), G, H, I, J, K, L, M
+}
+
+// @has 'item_hide_threshold/trait.Trait.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
+pub trait Trait {
+    type A;
+    #[must_use]
+    fn foo();
+    fn bar();
+}
+
+// @has 'item_hide_threshold/trait.GinormousTrait.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
+// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show associated items'
+pub trait GinormousTrait {
+    type A;
+    type B;
+    type C;
+    type D;
+    type E;
+    type F;
+    type G;
+    type H;
+    type I;
+    type J;
+    type K;
+    type L;
+    type M;
+    const N: usize = 1;
+    #[must_use]
+    fn foo();
+    fn bar();
+}
+
+// @has 'item_hide_threshold/trait.HugeTrait.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
+// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show associated constants and methods'
+pub trait HugeTrait {
+    type A;
+    const M: usize = 1;
+    const N: usize = 1;
+    const O: usize = 1;
+    const P: usize = 1;
+    const Q: usize = 1;
+    const R: usize = 1;
+    const S: usize = 1;
+    const T: usize = 1;
+    const U: usize = 1;
+    const V: usize = 1;
+    const W: usize = 1;
+    const X: usize = 1;
+    #[must_use]
+    fn foo();
+    fn bar();
+}
+
+// @has 'item_hide_threshold/trait.BigTrait.html'
+// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
+// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show methods'
+pub trait BigTrait {
+    type A;
+    #[must_use]
+    fn foo();
+    fn bar();
+    fn baz();
+    fn quux();
+    fn frob();
+    fn greeble();
+    fn blap();
+    fn whoop();
+    fn pow();
+    fn bang();
+    fn oomph();
+    fn argh();
+    fn wap();
+    fn ouch();
+}
diff --git a/src/test/rustdoc/trait-attributes.rs b/src/test/rustdoc/trait-attributes.rs
index 2a103509ae1..2bb24a82193 100644
--- a/src/test/rustdoc/trait-attributes.rs
+++ b/src/test/rustdoc/trait-attributes.rs
@@ -2,7 +2,7 @@
 
 
 pub trait Foo {
-    // @has foo/trait.Foo.html '//h3[@id="tymethod.foo"]//span[@class="docblock attributes"]' '#[must_use]'
+    // @has foo/trait.Foo.html '//h3[@id="tymethod.foo"]//div[@class="code-attribute"]' '#[must_use]'
     #[must_use]
     fn foo();
 }
@@ -11,11 +11,11 @@ pub trait Foo {
 pub struct Bar;
 
 impl Bar {
-    // @has foo/struct.Bar.html '//h4[@id="method.bar"]//span[@class="docblock attributes"]' '#[must_use]'
+    // @has foo/struct.Bar.html '//h4[@id="method.bar"]//div[@class="code-attribute"]' '#[must_use]'
     #[must_use]
     pub fn bar() {}
 
-    // @has foo/struct.Bar.html '//h4[@id="method.bar2"]//span[@class="docblock attributes"]' '#[must_use]'
+    // @has foo/struct.Bar.html '//h4[@id="method.bar2"]//div[@class="code-attribute"]' '#[must_use]'
     #[must_use]
     pub fn bar2() {}
 }