about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/doc/rustdoc/src/unstable-features.md5
-rw-r--r--src/librustdoc/html/render/mod.rs18
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css4
-rw-r--r--src/librustdoc/html/static/css/themes/ayu.css2
-rw-r--r--src/librustdoc/html/static/css/themes/dark.css2
-rw-r--r--src/librustdoc/html/static/css/themes/light.css2
-rw-r--r--src/test/rustdoc-gui/anchors.goml28
-rw-r--r--src/test/rustdoc-gui/headers-color.goml9
-rw-r--r--src/test/rustdoc-gui/item-info-width.goml2
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs2
-rw-r--r--src/test/rustdoc-json/primitive.rs2
-rw-r--r--src/test/rustdoc-ui/coverage/exotic.rs3
-rw-r--r--src/test/rustdoc-ui/invalid-keyword.rs2
-rw-r--r--src/test/rustdoc/issue-32374.rs9
-rw-r--r--src/test/rustdoc/keyword.rs2
-rw-r--r--src/test/rustdoc/mixing-doc-comments-and-attrs.rs26
-rw-r--r--src/test/rustdoc/tab_title.rs2
-rw-r--r--src/test/ui-fulldeps/internal-lints/existing_doc_keyword.rs2
-rw-r--r--src/test/ui/feature-gates/feature-gate-doc_keyword.rs5
-rw-r--r--src/test/ui/feature-gates/feature-gate-doc_keyword.stderr12
-rw-r--r--src/test/ui/feature-gates/feature-gate-rustdoc_internals.rs5
-rw-r--r--src/test/ui/feature-gates/feature-gate-rustdoc_internals.stderr12
-rw-r--r--src/test/ui/rustdoc/doc_keyword.rs2
-rw-r--r--src/test/ui/rustdoc/renamed-features-rustdoc_internals.rs5
-rw-r--r--src/test/ui/rustdoc/renamed-features-rustdoc_internals.stderr19
25 files changed, 117 insertions, 65 deletions
diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md
index 8da1d22a4d1..6e52127591c 100644
--- a/src/doc/rustdoc/src/unstable-features.md
+++ b/src/doc/rustdoc/src/unstable-features.md
@@ -138,7 +138,8 @@ This is for Rust compiler internal use only.
 
 Since primitive types are defined in the compiler, there's no place to attach documentation
 attributes. The `#[doc(primitive)]` attribute is used by the standard library to provide a way
-to generate documentation for primitive types, and requires `#![feature(doc_primitive)]` to enable.
+to generate documentation for primitive types, and requires `#![feature(rustdoc_internals)]` to
+enable.
 
 ## Document keywords
 
@@ -149,7 +150,7 @@ Rust keywords are documented in the standard library (look for `match` for examp
 To do so, the `#[doc(keyword = "...")]` attribute is used. Example:
 
 ```rust
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
 
 /// Some documentation about the keyword.
 #[doc(keyword = "keyword")]
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index ffd09663f82..24baca285c6 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -682,7 +682,7 @@ fn short_item_info(
 
     // Render unstable items. But don't render "rustc_private" crates (internal compiler crates).
     // Those crates are permanently unstable so it makes no sense to render "unstable" everywhere.
-    if let Some((StabilityLevel::Unstable { reason, issue, .. }, feature)) = item
+    if let Some((StabilityLevel::Unstable { reason: _, issue, .. }, feature)) = item
         .stability(cx.tcx())
         .as_ref()
         .filter(|stab| stab.feature != sym::rustc_private)
@@ -702,22 +702,6 @@ fn short_item_info(
 
         message.push_str(&format!(" ({})", feature));
 
-        if let Some(unstable_reason) = reason {
-            let mut ids = cx.id_map.borrow_mut();
-            message = format!(
-                "<details><summary>{}</summary>{}</details>",
-                message,
-                MarkdownHtml(
-                    &unstable_reason.as_str(),
-                    &mut ids,
-                    error_codes,
-                    cx.shared.edition(),
-                    &cx.shared.playground,
-                )
-                .into_string()
-            );
-        }
-
         extra_info.push(format!("<div class=\"stab unstable\">{}</div>", message));
     }
 
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 27f9c183b8e..0f3eb2ca07d 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -964,8 +964,6 @@ body.blur > :not(#help) {
 	display: table;
 }
 .stab {
-	border-width: 1px;
-	border-style: solid;
 	padding: 3px;
 	margin-bottom: 5px;
 	font-size: 90%;
@@ -976,7 +974,7 @@ body.blur > :not(#help) {
 }
 
 .stab .emoji {
-	font-size: 1.5em;
+	font-size: 1.2em;
 }
 
 /* Black one-pixel outline around emoji shapes */
diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css
index 85fb34b3959..13e8dc85a24 100644
--- a/src/librustdoc/html/static/css/themes/ayu.css
+++ b/src/librustdoc/html/static/css/themes/ayu.css
@@ -218,6 +218,8 @@ a {
 }
 a.srclink,
 a#toggle-all-docs,
+a.anchor,
+.section-header a,
 #source-sidebar a,
 pre.rust a,
 .sidebar a,
diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css
index 5a6c08bafd2..8caf8a05d50 100644
--- a/src/librustdoc/html/static/css/themes/dark.css
+++ b/src/librustdoc/html/static/css/themes/dark.css
@@ -180,6 +180,8 @@ a {
 }
 a.srclink,
 a#toggle-all-docs,
+a.anchor,
+.section-header a,
 #source-sidebar a,
 pre.rust a,
 .sidebar a,
diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css
index 05f12fc365d..fec71674e63 100644
--- a/src/librustdoc/html/static/css/themes/light.css
+++ b/src/librustdoc/html/static/css/themes/light.css
@@ -175,6 +175,8 @@ a {
 }
 a.srclink,
 a#toggle-all-docs,
+a.anchor,
+.section-header a,
 #source-sidebar a,
 pre.rust a,
 .sidebar a,
diff --git a/src/test/rustdoc-gui/anchors.goml b/src/test/rustdoc-gui/anchors.goml
index 6953009604c..4ce0ed1a4b8 100644
--- a/src/test/rustdoc-gui/anchors.goml
+++ b/src/test/rustdoc-gui/anchors.goml
@@ -1,17 +1,29 @@
+// This test is to ensure that the anchors (`ยง`) have the expected color.
 goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
 
+// This is needed to ensure that the text color is computed.
+show-text: true
+
 // Set the theme to light.
 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
 // We reload the page so the local storage settings are being used.
 reload:
 
-assert-css: ("#toggle-all-docs", {"color": "rgba(0, 0, 0, 0)"})
-assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgba(0, 0, 0, 0)"})
-assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgba(0, 0, 0, 0)"})
-assert-css: (".srclink", {"color": "rgba(0, 0, 0, 0)"})
-assert-css: (".srclink", {"color": "rgba(0, 0, 0, 0)"})
+assert-css: ("#toggle-all-docs", {"color": "rgb(0, 0, 0)"})
+assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
+assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 68, 142)"})
+assert-css: (".srclink", {"color": "rgb(0, 0, 0)"})
+assert-css: (".srclink", {"color": "rgb(0, 0, 0)"})
+
+assert-css: ("#top-doc-prose-title", {"color": "rgb(0, 0, 0)"})
+
+assert-css: (".sidebar a", {"color": "rgb(0, 0, 0)"})
+assert-css: (".in-band a", {"color": "rgb(0, 0, 0)"})
 
-assert-css: ("#top-doc-prose-title", {"color": "rgba(0, 0, 0, 0)"})
+// We move the cursor over the "Implementations" title so the anchor is displayed.
+move-cursor-to: "h2#implementations"
+assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"})
 
-assert-css: (".sidebar a", {"color": "rgba(0, 0, 0, 0)"})
-assert-css: (".in-band a", {"color": "rgba(0, 0, 0, 0)"})
+// Same thing with the impl block title.
+move-cursor-to: "#impl"
+assert-css: ("#impl a.anchor", {"color": "rgb(0, 0, 0)"})
diff --git a/src/test/rustdoc-gui/headers-color.goml b/src/test/rustdoc-gui/headers-color.goml
index b5be31bd2cc..7002812bb62 100644
--- a/src/test/rustdoc-gui/headers-color.goml
+++ b/src/test/rustdoc-gui/headers-color.goml
@@ -17,6 +17,9 @@ assert-css: ("#impl", {"color": "rgb(197, 197, 197)", "background-color": "rgba(
 goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
 assert-css: ("#method\.must_use", {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, ALL)
 
+goto: file://|DOC_PATH|/test_docs/index.html
+assert-css: (".section-header a", {"color": "rgb(197, 197, 197)"}, ALL)
+
 // Dark theme
 local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
 goto: file://|DOC_PATH|/test_docs/struct.Foo.html
@@ -30,6 +33,9 @@ assert-css: ("#impl", {"color": "rgb(221, 221, 221)", "background-color": "rgb(7
 goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
 assert-css: ("#method\.must_use", {"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"}, ALL)
 
+goto: file://|DOC_PATH|/test_docs/index.html
+assert-css: (".section-header a", {"color": "rgb(221, 221, 221)"}, ALL)
+
 // Light theme
 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
 reload:
@@ -44,3 +50,6 @@ assert-css: ("#impl", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 25
 
 goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
 assert-css: ("#method\.must_use", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"}, ALL)
+
+goto: file://|DOC_PATH|/test_docs/index.html
+assert-css: (".section-header a", {"color": "rgb(0, 0, 0)"}, ALL)
diff --git a/src/test/rustdoc-gui/item-info-width.goml b/src/test/rustdoc-gui/item-info-width.goml
index 44b79e60912..cdc00d34114 100644
--- a/src/test/rustdoc-gui/item-info-width.goml
+++ b/src/test/rustdoc-gui/item-info-width.goml
@@ -4,4 +4,4 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html
 size: (1100, 800)
 // We check that ".item-info" is bigger than its content.
 assert-css: (".item-info", {"width": "807px"})
-assert-css: (".item-info .stab", {"width": "343px"})
+assert-css: (".item-info .stab", {"width": "341px"})
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index 14d8b186130..458bcc4780c 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -2,7 +2,7 @@
 //! documentation generated so we can test each different features.
 
 #![crate_name = "test_docs"]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
 #![feature(doc_cfg)]
 
 use std::convert::AsRef;
diff --git a/src/test/rustdoc-json/primitive.rs b/src/test/rustdoc-json/primitive.rs
index 3a7d6d18c1b..b84c2f7c6ac 100644
--- a/src/test/rustdoc-json/primitive.rs
+++ b/src/test/rustdoc-json/primitive.rs
@@ -1,6 +1,6 @@
 // edition:2018
 
-#![feature(doc_primitive)]
+#![feature(rustdoc_internals)]
 
 #[doc(primitive = "usize")]
 mod usize {}
diff --git a/src/test/rustdoc-ui/coverage/exotic.rs b/src/test/rustdoc-ui/coverage/exotic.rs
index 18f2014d9e4..72b70d6980b 100644
--- a/src/test/rustdoc-ui/coverage/exotic.rs
+++ b/src/test/rustdoc-ui/coverage/exotic.rs
@@ -1,8 +1,7 @@
 // compile-flags:-Z unstable-options --show-coverage
 // check-pass
 
-#![feature(doc_keyword)]
-#![feature(doc_primitive)]
+#![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
diff --git a/src/test/rustdoc-ui/invalid-keyword.rs b/src/test/rustdoc-ui/invalid-keyword.rs
index ce2abc69bbd..2d70471c85e 100644
--- a/src/test/rustdoc-ui/invalid-keyword.rs
+++ b/src/test/rustdoc-ui/invalid-keyword.rs
@@ -1,4 +1,4 @@
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
 
 #[doc(keyword = "foo df")] //~ ERROR
 mod foo {}
diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs
index 4e92ae49a20..7654a561527 100644
--- a/src/test/rustdoc/issue-32374.rs
+++ b/src/test/rustdoc/issue-32374.rs
@@ -1,7 +1,6 @@
 #![feature(staged_api)]
 #![doc(issue_tracker_base_url = "https://issue_url/")]
-
-#![unstable(feature="test", issue = "32374")]
+#![unstable(feature = "test", issue = "32374")]
 
 // @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \
 //      'Deprecated'
@@ -23,12 +22,6 @@ pub struct T;
 //      '๐Ÿ‘Ž Deprecated since 1.0.0: deprecated'
 // @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \
 //      '๐Ÿ”ฌ This is a nightly-only experimental API. (test #32374)'
-// @has issue_32374/struct.U.html '//details' \
-//      '๐Ÿ”ฌ This is a nightly-only experimental API. (test #32374)'
-// @has issue_32374/struct.U.html '//summary' \
-//      '๐Ÿ”ฌ This is a nightly-only experimental API. (test #32374)'
-// @has issue_32374/struct.U.html '//details/p' \
-//      'unstable'
 #[rustc_deprecated(since = "1.0.0", reason = "deprecated")]
 #[unstable(feature = "test", issue = "32374", reason = "unstable")]
 pub struct U;
diff --git a/src/test/rustdoc/keyword.rs b/src/test/rustdoc/keyword.rs
index 652517c5c90..16f7cac5f51 100644
--- a/src/test/rustdoc/keyword.rs
+++ b/src/test/rustdoc/keyword.rs
@@ -1,6 +1,6 @@
 #![crate_name = "foo"]
 
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
 
 // @has foo/index.html '//h2[@id="keywords"]' 'Keywords'
 // @has foo/index.html '//a[@href="keyword.match.html"]' 'match'
diff --git a/src/test/rustdoc/mixing-doc-comments-and-attrs.rs b/src/test/rustdoc/mixing-doc-comments-and-attrs.rs
new file mode 100644
index 00000000000..c26d3a31987
--- /dev/null
+++ b/src/test/rustdoc/mixing-doc-comments-and-attrs.rs
@@ -0,0 +1,26 @@
+#![crate_name = "foo"]
+
+// @has 'foo/struct.S1.html'
+// @count - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p' \
+//     1
+// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[1]' \
+//     'Hello world! Goodbye! Hello again!'
+
+#[doc = "Hello world!\n\n"]
+/// Goodbye!
+#[doc = "  Hello again!\n"]
+pub struct S1;
+
+// @has 'foo/struct.S2.html'
+// @count - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p' \
+//     2
+// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[1]' \
+//     'Hello world!'
+// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[2]' \
+//     'Goodbye! Hello again!'
+
+/// Hello world!
+///
+#[doc = "Goodbye!"]
+/// Hello again!
+pub struct S2;
diff --git a/src/test/rustdoc/tab_title.rs b/src/test/rustdoc/tab_title.rs
index 7dce6092dea..0cc4f147e1c 100644
--- a/src/test/rustdoc/tab_title.rs
+++ b/src/test/rustdoc/tab_title.rs
@@ -1,5 +1,5 @@
 #![crate_name = "foo"]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
 
 // tests for the html <title> element
 
diff --git a/src/test/ui-fulldeps/internal-lints/existing_doc_keyword.rs b/src/test/ui-fulldeps/internal-lints/existing_doc_keyword.rs
index 053712a4b4e..7783dc40fcf 100644
--- a/src/test/ui-fulldeps/internal-lints/existing_doc_keyword.rs
+++ b/src/test/ui-fulldeps/internal-lints/existing_doc_keyword.rs
@@ -1,7 +1,7 @@
 // compile-flags: -Z unstable-options
 
 #![feature(rustc_private)]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
 
 #![crate_type = "lib"]
 
diff --git a/src/test/ui/feature-gates/feature-gate-doc_keyword.rs b/src/test/ui/feature-gates/feature-gate-doc_keyword.rs
deleted file mode 100644
index 4bb9a40deb0..00000000000
--- a/src/test/ui/feature-gates/feature-gate-doc_keyword.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#[doc(keyword = "match")] //~ ERROR: `#[doc(keyword)]` is experimental
-/// wonderful
-mod foo{}
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr b/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr
deleted file mode 100644
index c5dc7d537fd..00000000000
--- a/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: `#[doc(keyword)]` is experimental
-  --> $DIR/feature-gate-doc_keyword.rs:1:1
-   |
-LL | #[doc(keyword = "match")]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #51315 <https://github.com/rust-lang/rust/issues/51315> for more information
-   = help: add `#![feature(doc_keyword)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gates/feature-gate-rustdoc_internals.rs b/src/test/ui/feature-gates/feature-gate-rustdoc_internals.rs
new file mode 100644
index 00000000000..d2ff4f62009
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-rustdoc_internals.rs
@@ -0,0 +1,5 @@
+#[doc(keyword = "match")] //~ ERROR: `#[doc(keyword)]` is meant for internal use only
+/// wonderful
+mod foo {}
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-rustdoc_internals.stderr b/src/test/ui/feature-gates/feature-gate-rustdoc_internals.stderr
new file mode 100644
index 00000000000..e96461ac38a
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-rustdoc_internals.stderr
@@ -0,0 +1,12 @@
+error[E0658]: `#[doc(keyword)]` is meant for internal use only
+  --> $DIR/feature-gate-rustdoc_internals.rs:1:1
+   |
+LL | #[doc(keyword = "match")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #90418 <https://github.com/rust-lang/rust/issues/90418> for more information
+   = help: add `#![feature(rustdoc_internals)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/rustdoc/doc_keyword.rs b/src/test/ui/rustdoc/doc_keyword.rs
index 4518f77ef93..43b84e5018c 100644
--- a/src/test/ui/rustdoc/doc_keyword.rs
+++ b/src/test/ui/rustdoc/doc_keyword.rs
@@ -1,5 +1,5 @@
 #![crate_type = "lib"]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
 
 #![doc(keyword = "hello")] //~ ERROR
 
diff --git a/src/test/ui/rustdoc/renamed-features-rustdoc_internals.rs b/src/test/ui/rustdoc/renamed-features-rustdoc_internals.rs
new file mode 100644
index 00000000000..739c624d0c6
--- /dev/null
+++ b/src/test/ui/rustdoc/renamed-features-rustdoc_internals.rs
@@ -0,0 +1,5 @@
+#![feature(doc_keyword)] //~ ERROR
+#![feature(doc_primitive)] //~ ERROR
+#![crate_type = "lib"]
+
+pub fn foo() {}
diff --git a/src/test/ui/rustdoc/renamed-features-rustdoc_internals.stderr b/src/test/ui/rustdoc/renamed-features-rustdoc_internals.stderr
new file mode 100644
index 00000000000..d0979ce97ac
--- /dev/null
+++ b/src/test/ui/rustdoc/renamed-features-rustdoc_internals.stderr
@@ -0,0 +1,19 @@
+error[E0557]: feature has been removed
+  --> $DIR/renamed-features-rustdoc_internals.rs:1:12
+   |
+LL | #![feature(doc_keyword)]
+   |            ^^^^^^^^^^^ feature has been removed
+   |
+   = note: merged into `#![feature(rustdoc_internals)]`
+
+error[E0557]: feature has been removed
+  --> $DIR/renamed-features-rustdoc_internals.rs:2:12
+   |
+LL | #![feature(doc_primitive)]
+   |            ^^^^^^^^^^^^^ feature has been removed
+   |
+   = note: merged into `#![feature(rustdoc_internals)]`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0557`.