about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/tool.rs9
-rw-r--r--src/doc/rustdoc/README.md5
-rw-r--r--src/doc/rustdoc/src/the-doc-attribute.md7
-rw-r--r--src/librustdoc/html/static/main.js4
-rw-r--r--src/librustdoc/html/static/rustdoc.css10
-rw-r--r--src/test/rustdoc-gui/escape-key.goml27
-rw-r--r--src/test/rustdoc/external-doc.rs1
-rw-r--r--src/test/ui/attributes/key-value-expansion-on-mac.rs1
-rw-r--r--src/test/ui/attributes/key-value-expansion-on-mac.stderr2
-rw-r--r--src/test/ui/feature-gates/feature-gate-extended_key_value_attributes.rs8
-rw-r--r--src/test/ui/feature-gates/feature-gate-extended_key_value_attributes.stderr39
-rw-r--r--src/test/ui/suffixed-literal-meta.rs2
-rw-r--r--src/test/ui/symbol-names/trait-objects.rs48
-rw-r--r--src/test/ui/symbol-names/trait-objects.v0.stderr56
-rw-r--r--src/tools/compiletest/src/runtest.rs6
15 files changed, 167 insertions, 58 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 12571c1b97d..dd8c6023a44 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -593,7 +593,14 @@ impl Step for Cargo {
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         let builder = run.builder;
-        run.path("src/tools/cargo").default_condition(builder.config.extended)
+        run.path("src/tools/cargo").default_condition(
+            builder.config.extended
+                && builder.config.tools.as_ref().map_or(
+                    true,
+                    // If `tools` is set, search list for this tool.
+                    |tools| tools.iter().any(|tool| tool == "cargo"),
+                ),
+        )
     }
 
     fn make_run(run: RunConfig<'_>) {
diff --git a/src/doc/rustdoc/README.md b/src/doc/rustdoc/README.md
new file mode 100644
index 00000000000..7d97d5e4ab5
--- /dev/null
+++ b/src/doc/rustdoc/README.md
@@ -0,0 +1,5 @@
+# Rustdoc
+
+This is documentation for rustdoc itself, written in mdbook format.
+To build the book, use `x.py doc src/doc/rustdoc`.
+To run doctests, use `x.py test src/doc/rustdoc`.
diff --git a/src/doc/rustdoc/src/the-doc-attribute.md b/src/doc/rustdoc/src/the-doc-attribute.md
index 52f2a3728fa..d192f7d5ce9 100644
--- a/src/doc/rustdoc/src/the-doc-attribute.md
+++ b/src/doc/rustdoc/src/the-doc-attribute.md
@@ -35,6 +35,13 @@ Which can feel more flexible. Note that this would generate this:
 
 but given that docs are rendered via Markdown, it will remove these newlines.
 
+Another use case is for including external files as documentation:
+
+```rust,no_run
+#[doc = include_str!("../README.md")]
+# fn f() {}
+```
+
 The `doc` attribute has more options though! These don't involve the text of
 the output, but instead, various aspects of the presentation of the output.
 We've split them into two kinds below: attributes that are useful at the
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 307ce9ac375..7c00cf940c7 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -425,9 +425,9 @@ function hideThemeButtonState() {
     function handleEscape(ev) {
         var help = getHelpElement(false);
         var search = searchState.outputElement();
-        if (!hasClass(help, "hidden")) {
+        if (help && !hasClass(help, "hidden")) {
             displayHelp(false, ev, help);
-        } else if (!hasClass(search, "hidden")) {
+        } else if (search && !hasClass(search, "hidden")) {
             searchState.clearInputTimeout();
             ev.preventDefault();
             searchState.hideResults(search);
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 28fa867b95f..6d581108836 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -427,9 +427,13 @@ nav.sub {
 	border-bottom: 1px solid;
 }
 
-#main > .docblock h1 { font-size: 1.3em; }
-#main > .docblock h2 { font-size: 1.15em; }
-#main > .docblock h3, #main > .docblock h4, #main > .docblock h5 { font-size: 1em; }
+.top-doc .docblock h1 { font-size: 1.3em; }
+.top-doc .docblock h2 { font-size: 1.15em; }
+.top-doc .docblock h3,
+.top-doc .docblock h4,
+.top-doc .docblock h5 {
+	font-size: 1em;
+}
 
 .docblock h1 { font-size: 1em; }
 .docblock h2 { font-size: 0.95em; }
diff --git a/src/test/rustdoc-gui/escape-key.goml b/src/test/rustdoc-gui/escape-key.goml
new file mode 100644
index 00000000000..303dd000ba3
--- /dev/null
+++ b/src/test/rustdoc-gui/escape-key.goml
@@ -0,0 +1,27 @@
+goto: file://|DOC_PATH|/test_docs/index.html
+// First, we check that the search results are hidden when the Escape key is pressed.
+write: (".search-input", "test")
+wait-for: "#search > h1" // The search element is empty before the first search 
+assert: ("#search", "class", "content")
+assert: ("#main", "class", "content hidden")
+press-key: "Escape"
+assert: ("#search", "class", "content hidden")
+assert: ("#main", "class", "content")
+
+// Check that focusing the search input brings back the search results
+focus: ".search-input"
+assert: ("#search", "class", "content")
+assert: ("#main", "class", "content hidden")
+
+// Now let's check that when the help popup is displayed and we press Escape, it doesn't
+// hide the search results too.
+click: "#help-button"
+assert: ("#help", "class", "")
+press-key: "Escape"
+assert: ("#help", "class", "hidden")
+assert: ("#search", "class", "content")
+assert: ("#main", "class", "content hidden")
+
+// FIXME: Once https://github.com/rust-lang/rust/pull/84462 is merged, add check to ensure
+// that Escape hides the search results when a result is focused.
+// press-key: "ArrowDown"
diff --git a/src/test/rustdoc/external-doc.rs b/src/test/rustdoc/external-doc.rs
index befd31a5492..0dadca551a9 100644
--- a/src/test/rustdoc/external-doc.rs
+++ b/src/test/rustdoc/external-doc.rs
@@ -1,5 +1,4 @@
 #![feature(external_doc)]
-#![feature(extended_key_value_attributes)]
 
 // @has external_doc/struct.CanHasDocs.html
 // @has - '//h1' 'External Docs'
diff --git a/src/test/ui/attributes/key-value-expansion-on-mac.rs b/src/test/ui/attributes/key-value-expansion-on-mac.rs
index 1247ff2b230..95bc1c04961 100644
--- a/src/test/ui/attributes/key-value-expansion-on-mac.rs
+++ b/src/test/ui/attributes/key-value-expansion-on-mac.rs
@@ -1,4 +1,3 @@
-#![feature(extended_key_value_attributes)]
 #![feature(rustc_attrs)]
 
 #[rustc_dummy = stringify!(a)] // OK
diff --git a/src/test/ui/attributes/key-value-expansion-on-mac.stderr b/src/test/ui/attributes/key-value-expansion-on-mac.stderr
index b74f3518a7e..fa9ea543765 100644
--- a/src/test/ui/attributes/key-value-expansion-on-mac.stderr
+++ b/src/test/ui/attributes/key-value-expansion-on-mac.stderr
@@ -1,5 +1,5 @@
 error: unexpected token: `stringify!(b)`
-  --> $DIR/key-value-expansion-on-mac.rs:12:17
+  --> $DIR/key-value-expansion-on-mac.rs:11:17
    |
 LL | #[rustc_dummy = stringify!(b)]
    |                 ^^^^^^^^^^^^^
diff --git a/src/test/ui/feature-gates/feature-gate-extended_key_value_attributes.rs b/src/test/ui/feature-gates/feature-gate-extended_key_value_attributes.rs
deleted file mode 100644
index f19fdb45f1f..00000000000
--- a/src/test/ui/feature-gates/feature-gate-extended_key_value_attributes.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#[cfg(FALSE)]
-#[attr = multi::segment::path] //~ ERROR arbitrary expressions in key-value attributes are unstable
-#[attr = macro_call!()] //~ ERROR arbitrary expressions in key-value attributes are unstable
-#[attr = 1 + 2] //~ ERROR arbitrary expressions in key-value attributes are unstable
-#[attr = what?] //~ ERROR arbitrary expressions in key-value attributes are unstable
-struct S;
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-extended_key_value_attributes.stderr b/src/test/ui/feature-gates/feature-gate-extended_key_value_attributes.stderr
deleted file mode 100644
index 9887814b907..00000000000
--- a/src/test/ui/feature-gates/feature-gate-extended_key_value_attributes.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0658]: arbitrary expressions in key-value attributes are unstable
-  --> $DIR/feature-gate-extended_key_value_attributes.rs:2:10
-   |
-LL | #[attr = multi::segment::path]
-   |          ^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #78835 <https://github.com/rust-lang/rust/issues/78835> for more information
-   = help: add `#![feature(extended_key_value_attributes)]` to the crate attributes to enable
-
-error[E0658]: arbitrary expressions in key-value attributes are unstable
-  --> $DIR/feature-gate-extended_key_value_attributes.rs:3:10
-   |
-LL | #[attr = macro_call!()]
-   |          ^^^^^^^^^^^^^
-   |
-   = note: see issue #78835 <https://github.com/rust-lang/rust/issues/78835> for more information
-   = help: add `#![feature(extended_key_value_attributes)]` to the crate attributes to enable
-
-error[E0658]: arbitrary expressions in key-value attributes are unstable
-  --> $DIR/feature-gate-extended_key_value_attributes.rs:4:10
-   |
-LL | #[attr = 1 + 2]
-   |          ^^^^^
-   |
-   = note: see issue #78835 <https://github.com/rust-lang/rust/issues/78835> for more information
-   = help: add `#![feature(extended_key_value_attributes)]` to the crate attributes to enable
-
-error[E0658]: arbitrary expressions in key-value attributes are unstable
-  --> $DIR/feature-gate-extended_key_value_attributes.rs:5:10
-   |
-LL | #[attr = what?]
-   |          ^^^^^
-   |
-   = note: see issue #78835 <https://github.com/rust-lang/rust/issues/78835> for more information
-   = help: add `#![feature(extended_key_value_attributes)]` to the crate attributes to enable
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/suffixed-literal-meta.rs b/src/test/ui/suffixed-literal-meta.rs
index 319264aec9c..a6531490c01 100644
--- a/src/test/ui/suffixed-literal-meta.rs
+++ b/src/test/ui/suffixed-literal-meta.rs
@@ -1,4 +1,4 @@
-#![feature(rustc_attrs, extended_key_value_attributes)]
+#![feature(rustc_attrs)]
 
 #[rustc_dummy = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
 #[rustc_dummy = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
diff --git a/src/test/ui/symbol-names/trait-objects.rs b/src/test/ui/symbol-names/trait-objects.rs
new file mode 100644
index 00000000000..cea1a89d757
--- /dev/null
+++ b/src/test/ui/symbol-names/trait-objects.rs
@@ -0,0 +1,48 @@
+// Ensure that trait objects don't include more than one binder. See #83611
+
+// build-fail
+// revisions: v0
+//[v0]compile-flags: -Z symbol-mangling-version=v0
+//[v0]normalize-stderr-test: "Cs.*?_" -> "CRATE_HASH"
+//[v0]normalize-stderr-test: "core\[.*?\]" -> "core[HASH]"
+
+#![feature(rustc_attrs)]
+
+trait Bar {
+    fn method(&self) {}
+}
+
+impl Bar for &dyn FnMut(&u8) {
+    #[rustc_symbol_name]
+    //[v0]~^ ERROR symbol-name
+    //[v0]~| ERROR demangling
+    //[v0]~| ERROR demangling-alt
+    fn method(&self) {}
+}
+
+trait Foo {
+    fn method(&self) {}
+}
+
+impl Foo for &(dyn FnMut(&u8) + for<'b> Send) {
+    #[rustc_symbol_name]
+    //[v0]~^ ERROR symbol-name
+    //[v0]~| ERROR demangling
+    //[v0]~| ERROR demangling-alt
+    fn method(&self) {}
+}
+
+trait Baz {
+    fn method(&self) {}
+}
+
+impl Baz for &(dyn for<'b> Send + FnMut(&u8)) {
+    #[rustc_symbol_name]
+    //[v0]~^ ERROR symbol-name
+    //[v0]~| ERROR demangling
+    //[v0]~| ERROR demangling-alt
+    fn method(&self) {}
+}
+
+fn main() {
+}
diff --git a/src/test/ui/symbol-names/trait-objects.v0.stderr b/src/test/ui/symbol-names/trait-objects.v0.stderr
new file mode 100644
index 00000000000..2b09318f06c
--- /dev/null
+++ b/src/test/ui/symbol-names/trait-objects.v0.stderr
@@ -0,0 +1,56 @@
+error: symbol-name(_RNvXCRATE_HASH13trait_objectsRDG_INtNtNtCRATE_HASH4core3ops8function5FnMutTRL0_hEEp6OutputuEL_NtB2_3Bar6method)
+  --> $DIR/trait-objects.rs:16:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects[17891616a171812d]::Bar>::method)
+  --> $DIR/trait-objects.rs:16:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects::Bar>::method)
+  --> $DIR/trait-objects.rs:16:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: symbol-name(_RNvXs_CRATE_HASH13trait_objectsRDG_INtNtNtCRATE_HASH4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtBI_6marker4SendEL_NtB4_3Foo6method)
+  --> $DIR/trait-objects.rs:28:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[17891616a171812d]::Foo>::method)
+  --> $DIR/trait-objects.rs:28:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> + core::marker::Send as trait_objects::Foo>::method)
+  --> $DIR/trait-objects.rs:28:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: symbol-name(_RNvXs0_CRATE_HASH13trait_objectsRDG_INtNtNtCRATE_HASH4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtBJ_6marker4SendEL_NtB5_3Baz6method)
+  --> $DIR/trait-objects.rs:40:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[17891616a171812d]::Baz>::method)
+  --> $DIR/trait-objects.rs:40:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> + core::marker::Send as trait_objects::Baz>::method)
+  --> $DIR/trait-objects.rs:40:5
+   |
+LL |     #[rustc_symbol_name]
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index f4e16483d8c..54b079a3e86 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2327,7 +2327,11 @@ impl<'test> TestCx<'test> {
         // For now, though…
         if let Some(rev) = self.revision {
             let prefixes = format!("CHECK,{}", rev);
-            filecheck.args(&["--check-prefixes", &prefixes]);
+            if self.config.llvm_version.unwrap_or(0) >= 130000 {
+                filecheck.args(&["--allow-unused-prefixes", "--check-prefixes", &prefixes]);
+            } else {
+                filecheck.args(&["--check-prefixes", &prefixes]);
+            }
         }
         self.compose_and_run(filecheck, "", None, None)
     }