summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc-ui/coverage
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/rustdoc-ui/coverage
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rustdoc-ui/coverage')
-rw-r--r--src/test/rustdoc-ui/coverage/allow_missing_docs.rs41
-rw-r--r--src/test/rustdoc-ui/coverage/allow_missing_docs.stderr20
-rw-r--r--src/test/rustdoc-ui/coverage/allow_missing_docs.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/basic.rs50
-rw-r--r--src/test/rustdoc-ui/coverage/basic.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/doc-examples-json.rs13
-rw-r--r--src/test/rustdoc-ui/coverage/doc-examples-json.stdout1
-rw-r--r--src/test/rustdoc-ui/coverage/doc-examples.rs27
-rw-r--r--src/test/rustdoc-ui/coverage/doc-examples.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/empty.rs4
-rw-r--r--src/test/rustdoc-ui/coverage/empty.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/enum-tuple-documented.rs37
-rw-r--r--src/test/rustdoc-ui/coverage/enum-tuple-documented.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/enum-tuple.rs18
-rw-r--r--src/test/rustdoc-ui/coverage/enum-tuple.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/enums.rs22
-rw-r--r--src/test/rustdoc-ui/coverage/enums.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/exotic.rs15
-rw-r--r--src/test/rustdoc-ui/coverage/exotic.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/html.rs4
-rw-r--r--src/test/rustdoc-ui/coverage/html.stderr2
-rw-r--r--src/test/rustdoc-ui/coverage/json.rs65
-rw-r--r--src/test/rustdoc-ui/coverage/json.stdout1
-rw-r--r--src/test/rustdoc-ui/coverage/private.rs21
-rw-r--r--src/test/rustdoc-ui/coverage/private.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/statics-consts.rs23
-rw-r--r--src/test/rustdoc-ui/coverage/statics-consts.stdout7
-rw-r--r--src/test/rustdoc-ui/coverage/traits.rs38
-rw-r--r--src/test/rustdoc-ui/coverage/traits.stdout7
29 files changed, 479 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/coverage/allow_missing_docs.rs b/src/test/rustdoc-ui/coverage/allow_missing_docs.rs
new file mode 100644
index 000000000..c771c09da
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/allow_missing_docs.rs
@@ -0,0 +1,41 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+//! Make sure to have some docs on your crate root
+
+#[allow(missing_docs)]
+pub mod mod_foo {
+ pub struct Bar;
+}
+
+/// This is a struct with an `#[allow(missing_docs)]`
+pub struct AllowTheMissingDocs {
+ #[allow(missing_docs)]
+ pub empty_str: String,
+
+ /// This has
+ #[allow(missing_docs)]
+ /// but also has documentation comments
+ pub hello: usize,
+
+ /// The doc id just to create a boilerplate comment
+ pub doc_id: Vec<u8>,
+}
+
+/// A function that has a documentation
+pub fn this_is_func() {}
+
+#[allow(missing_docs)]
+pub struct DemoStruct {
+ something: usize,
+}
+
+#[allow(missing_docs)]
+pub mod bar {
+ #[warn(missing_docs)]
+ pub struct Bar { //~ WARN
+ pub f: u32, //~ WARN
+ }
+
+ pub struct NeedsNoDocs;
+}
diff --git a/src/test/rustdoc-ui/coverage/allow_missing_docs.stderr b/src/test/rustdoc-ui/coverage/allow_missing_docs.stderr
new file mode 100644
index 000000000..3d5b512d1
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/allow_missing_docs.stderr
@@ -0,0 +1,20 @@
+warning: missing documentation for a struct
+ --> $DIR/allow_missing_docs.rs:36:5
+ |
+LL | pub struct Bar {
+ | ^^^^^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/allow_missing_docs.rs:35:12
+ |
+LL | #[warn(missing_docs)]
+ | ^^^^^^^^^^^^
+
+warning: missing documentation for a struct field
+ --> $DIR/allow_missing_docs.rs:37:9
+ |
+LL | pub f: u32,
+ | ^^^^^^^^^^
+
+warning: 2 warnings emitted
+
diff --git a/src/test/rustdoc-ui/coverage/allow_missing_docs.stdout b/src/test/rustdoc-ui/coverage/allow_missing_docs.stdout
new file mode 100644
index 000000000..17e8ee9e2
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/allow_missing_docs.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...i/coverage/allow_missing_docs.rs | 5 | 71.4% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 5 | 71.4% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/basic.rs b/src/test/rustdoc-ui/coverage/basic.rs
new file mode 100644
index 000000000..6c26b751c
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/basic.rs
@@ -0,0 +1,50 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+#![feature(extern_types)]
+
+//! Make sure to have some docs on your crate root
+
+/// This struct is documented, but its fields are not.
+///
+/// However, one field is private, so it shouldn't show in the total.
+pub struct SomeStruct {
+ pub some_field: usize,
+ other_field: usize,
+}
+
+impl SomeStruct {
+ /// Method with docs
+ pub fn this_fn(&self) {}
+
+ // Method without docs
+ pub fn other_method(&self) {}
+}
+
+// struct without docs
+pub struct OtherStruct;
+
+// function with no docs
+pub fn some_fn() {}
+
+/// Function with docs
+pub fn other_fn() {}
+
+pub enum SomeEnum {
+ /// Some of these variants are documented...
+ VarOne,
+ /// ...but some of them are not.
+ VarTwo,
+ // (like this one)
+ VarThree,
+}
+
+/// There's a macro here, too
+#[macro_export]
+macro_rules! some_macro {
+ () => {};
+}
+
+extern "C" {
+ pub type ExternType;
+}
diff --git a/src/test/rustdoc-ui/coverage/basic.stdout b/src/test/rustdoc-ui/coverage/basic.stdout
new file mode 100644
index 000000000..3c602b3da
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/basic.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...est/rustdoc-ui/coverage/basic.rs | 7 | 50.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 7 | 50.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/doc-examples-json.rs b/src/test/rustdoc-ui/coverage/doc-examples-json.rs
new file mode 100644
index 000000000..1da181379
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/doc-examples-json.rs
@@ -0,0 +1,13 @@
+// check-pass
+// compile-flags:-Z unstable-options --output-format json --show-coverage
+
+// This check ensures that only one doc example is counted since they're "optional" on
+// certain items.
+
+/// ```
+/// let x = 12;
+/// ```
+pub const Foo: u32 = 0;
+
+/// doc
+pub const Bar: u32 = 0;
diff --git a/src/test/rustdoc-ui/coverage/doc-examples-json.stdout b/src/test/rustdoc-ui/coverage/doc-examples-json.stdout
new file mode 100644
index 000000000..92f585569
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/doc-examples-json.stdout
@@ -0,0 +1 @@
+{"$DIR/doc-examples-json.rs":{"total":3,"with_docs":2,"total_examples":2,"with_examples":1}}
diff --git a/src/test/rustdoc-ui/coverage/doc-examples.rs b/src/test/rustdoc-ui/coverage/doc-examples.rs
new file mode 100644
index 000000000..cd718f8a3
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/doc-examples.rs
@@ -0,0 +1,27 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+//! This test ensure that only rust code examples are counted.
+
+/// Doc
+///
+/// ```
+/// let x = 2;
+/// ```
+pub struct Foo;
+
+/// Doc
+///
+/// ```text
+/// yolo
+/// ```
+pub trait Bar {}
+
+/// Doc
+///
+/// ```ignore (just for the sake of this test)
+/// let x = 2;
+/// ```
+pub fn foo<T: Bar, D: ::std::fmt::Debug>(a: Foo, b: u32, c: T, d: D) -> u32 {
+ 0
+}
diff --git a/src/test/rustdoc-ui/coverage/doc-examples.stdout b/src/test/rustdoc-ui/coverage/doc-examples.stdout
new file mode 100644
index 000000000..8188740f8
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/doc-examples.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...tdoc-ui/coverage/doc-examples.rs | 4 | 100.0% | 1 | 25.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 4 | 100.0% | 1 | 25.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/empty.rs b/src/test/rustdoc-ui/coverage/empty.rs
new file mode 100644
index 000000000..55a87e9d9
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/empty.rs
@@ -0,0 +1,4 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+// an empty crate still has one item to document: the crate root
diff --git a/src/test/rustdoc-ui/coverage/empty.stdout b/src/test/rustdoc-ui/coverage/empty.stdout
new file mode 100644
index 000000000..890a7d56e
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/empty.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...est/rustdoc-ui/coverage/empty.rs | 0 | 0.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 0 | 0.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/enum-tuple-documented.rs b/src/test/rustdoc-ui/coverage/enum-tuple-documented.rs
new file mode 100644
index 000000000..e9c165b19
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/enum-tuple-documented.rs
@@ -0,0 +1,37 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+// The point of this test is to ensure that the number of "documented" items
+// is higher than in `enum-tuple.rs`.
+
+//! (remember the crate root is still a module)
+
+/// so check out this enum here
+pub enum ThisEnum {
+ /// VarOne.
+ VarOne(
+ /// hello!
+ String,
+ ),
+ /// Var Two.
+ VarTwo(
+ /// Hello
+ String,
+ /// Bis repetita.
+ String,
+ ),
+}
+
+/// Struct.
+pub struct ThisStruct(
+ /// hello
+ u32,
+);
+
+/// Struct.
+pub struct ThisStruct2(
+ /// hello
+ u32,
+ /// Bis repetita.
+ u8,
+);
diff --git a/src/test/rustdoc-ui/coverage/enum-tuple-documented.stdout b/src/test/rustdoc-ui/coverage/enum-tuple-documented.stdout
new file mode 100644
index 000000000..82c98f43f
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/enum-tuple-documented.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...overage/enum-tuple-documented.rs | 9 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 9 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/enum-tuple.rs b/src/test/rustdoc-ui/coverage/enum-tuple.rs
new file mode 100644
index 000000000..5fb205450
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/enum-tuple.rs
@@ -0,0 +1,18 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+//! (remember the crate root is still a module)
+
+/// so check out this enum here
+pub enum ThisEnum {
+ /// No need to document the field if there is only one in a tuple variant!
+ VarOne(String),
+ /// But if there is more than one... still fine!
+ VarTwo(String, String),
+}
+
+/// Struct.
+pub struct ThisStruct(u32);
+
+/// Struct.
+pub struct ThisStruct2(u32, u8);
diff --git a/src/test/rustdoc-ui/coverage/enum-tuple.stdout b/src/test/rustdoc-ui/coverage/enum-tuple.stdout
new file mode 100644
index 000000000..a3377d59c
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/enum-tuple.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...ustdoc-ui/coverage/enum-tuple.rs | 6 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 6 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/enums.rs b/src/test/rustdoc-ui/coverage/enums.rs
new file mode 100644
index 000000000..a4ae36d68
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/enums.rs
@@ -0,0 +1,22 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+//! (remember the crate root is still a module)
+
+/// so check out this enum here
+pub enum ThisEnum {
+ /// this variant has some weird stuff going on
+ VarOne {
+ /// like, it has some named fields inside
+ field_one: usize,
+ // (these show up as struct fields)
+ field_two: usize,
+ },
+ /// here's another variant for you
+ VarTwo(String),
+ // but not all of them need to be documented as thoroughly
+ VarThree,
+}
+
+/// uninhabited enums? sure, let's throw one of those around
+pub enum OtherEnum {}
diff --git a/src/test/rustdoc-ui/coverage/enums.stdout b/src/test/rustdoc-ui/coverage/enums.stdout
new file mode 100644
index 000000000..64c012c1f
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/enums.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...est/rustdoc-ui/coverage/enums.rs | 6 | 75.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 6 | 75.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/exotic.rs b/src/test/rustdoc-ui/coverage/exotic.rs
new file mode 100644
index 000000000..72b70d698
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/exotic.rs
@@ -0,0 +1,15 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+#![feature(rustdoc_internals)]
+
+//! the features only used in std also have entries in the table, so make sure those get pulled out
+//! properly as well
+
+/// woo, check it out, we can write our own primitive docs lol
+#[doc(primitive="unit")]
+mod prim_unit {}
+
+/// keywords? sure, pile them on
+#[doc(keyword="where")]
+mod where_keyword {}
diff --git a/src/test/rustdoc-ui/coverage/exotic.stdout b/src/test/rustdoc-ui/coverage/exotic.stdout
new file mode 100644
index 000000000..27798b813
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/exotic.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...st/rustdoc-ui/coverage/exotic.rs | 3 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 3 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/html.rs b/src/test/rustdoc-ui/coverage/html.rs
new file mode 100644
index 000000000..181cb4c50
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/html.rs
@@ -0,0 +1,4 @@
+// compile-flags:-Z unstable-options --output-format html --show-coverage
+
+/// Foo
+pub struct Xo;
diff --git a/src/test/rustdoc-ui/coverage/html.stderr b/src/test/rustdoc-ui/coverage/html.stderr
new file mode 100644
index 000000000..adca375d4
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/html.stderr
@@ -0,0 +1,2 @@
+error: html output format isn't supported for the --show-coverage option
+
diff --git a/src/test/rustdoc-ui/coverage/json.rs b/src/test/rustdoc-ui/coverage/json.rs
new file mode 100644
index 000000000..a591cd5db
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/json.rs
@@ -0,0 +1,65 @@
+// check-pass
+// compile-flags:-Z unstable-options --output-format json --show-coverage
+
+pub mod foo {
+ /// Hello!
+ pub struct Foo;
+ /// Bar
+ pub enum Bar { A }
+}
+
+/// X
+pub struct X;
+
+/// Bar
+///
+/// ```
+/// let x = 12;
+/// ```
+pub mod bar {
+ /// bar
+ pub struct Bar;
+ /// X
+ pub enum X {
+ /// ```
+ /// let x = "should be ignored!";
+ /// ```
+ Y
+ }
+}
+
+/// yolo
+///
+/// ```text
+/// should not be counted as a code example!
+/// ```
+pub enum Yolo { X }
+
+impl Yolo {
+ /// ```
+ /// let x = "should be ignored!";
+ /// ```
+ pub const Const: u32 = 0;
+}
+
+pub struct Xo<T: Clone> {
+ /// ```
+ /// let x = "should be ignored!";
+ /// ```
+ x: T,
+}
+
+/// ```
+/// let x = "should be ignored!";
+/// ```
+pub static StaticFoo: u32 = 0;
+
+/// ```
+/// let x = "should be ignored!";
+/// ```
+pub const ConstFoo: u32 = 0;
+
+/// ```
+/// let x = "should be ignored!";
+/// ```
+pub type TypeFoo = u32;
diff --git a/src/test/rustdoc-ui/coverage/json.stdout b/src/test/rustdoc-ui/coverage/json.stdout
new file mode 100644
index 000000000..c2be73ce3
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/json.stdout
@@ -0,0 +1 @@
+{"$DIR/json.rs":{"total":17,"with_docs":12,"total_examples":15,"with_examples":6}}
diff --git a/src/test/rustdoc-ui/coverage/private.rs b/src/test/rustdoc-ui/coverage/private.rs
new file mode 100644
index 000000000..2a0271727
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/private.rs
@@ -0,0 +1,21 @@
+// compile-flags:-Z unstable-options --show-coverage --document-private-items
+// check-pass
+
+#![allow(unused)]
+
+//! when `--document-private-items` is passed, nothing is safe. everything must have docs or your
+//! score will suffer the consequences
+
+mod this_mod {
+ fn private_fn() {}
+}
+
+/// See, our public items have docs!
+pub struct SomeStruct {
+ /// Look, all perfectly documented!
+ pub field: usize,
+ other: usize,
+}
+
+/// Nothing shady going on here. Just a bunch of well-documented code. (cough)
+pub fn public_fn() {}
diff --git a/src/test/rustdoc-ui/coverage/private.stdout b/src/test/rustdoc-ui/coverage/private.stdout
new file mode 100644
index 000000000..37a0f5187
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/private.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...t/rustdoc-ui/coverage/private.rs | 4 | 57.1% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 4 | 57.1% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/statics-consts.rs b/src/test/rustdoc-ui/coverage/statics-consts.rs
new file mode 100644
index 000000000..5a35260fa
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/statics-consts.rs
@@ -0,0 +1,23 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+//! gotta make sure we can count statics and consts correctly, too
+
+/// static like electricity, right?
+pub static THIS_STATIC: usize = 0;
+
+/// (it's not electricity, is it)
+pub const THIS_CONST: usize = 1;
+
+/// associated consts show up separately, but let's throw them in as well
+pub trait SomeTrait {
+ /// just like that, yeah
+ const ASSOC_CONST: usize;
+}
+
+pub struct SomeStruct;
+
+impl SomeStruct {
+ /// wait, structs can have them too, can't forget those
+ pub const ASSOC_CONST: usize = 100;
+}
diff --git a/src/test/rustdoc-ui/coverage/statics-consts.stdout b/src/test/rustdoc-ui/coverage/statics-consts.stdout
new file mode 100644
index 000000000..dbea3a3ea
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/statics-consts.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...oc-ui/coverage/statics-consts.rs | 6 | 85.7% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 6 | 85.7% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/src/test/rustdoc-ui/coverage/traits.rs b/src/test/rustdoc-ui/coverage/traits.rs
new file mode 100644
index 000000000..daa08ec25
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/traits.rs
@@ -0,0 +1,38 @@
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+#![feature(trait_alias)]
+#![feature(type_alias_impl_trait)]
+
+/// look at this trait right here
+pub trait ThisTrait {
+ /// that's a trait all right
+ fn right_here(&self);
+
+ /// even the provided functions show up as trait methods
+ fn aww_yeah(&self) {}
+
+ /// gotta check those associated types, they're slippery
+ type SomeType;
+}
+
+/// so what happens if we take some struct...
+#[derive(Clone)]
+pub struct SomeStruct;
+
+/// ...and slap this trait on it?
+impl ThisTrait for SomeStruct {
+ /// nothing! trait impls are totally ignored in this calculation, sorry.
+ fn right_here(&self) {}
+
+ type SomeType = String;
+}
+
+/// but what about those aliases? i hear they're pretty exotic
+pub trait MyAlias = ThisTrait + Send + Sync;
+
+/// woah, getting all opaque in here
+pub type ThisExists = impl ThisTrait;
+
+/// why don't we get a little more concrete
+pub fn defines() -> ThisExists { SomeStruct {} }
diff --git a/src/test/rustdoc-ui/coverage/traits.stdout b/src/test/rustdoc-ui/coverage/traits.stdout
new file mode 100644
index 000000000..5053d0209
--- /dev/null
+++ b/src/test/rustdoc-ui/coverage/traits.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...st/rustdoc-ui/coverage/traits.rs | 8 | 88.9% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 8 | 88.9% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+