about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-29 18:42:19 +0000
committerbors <bors@rust-lang.org>2022-06-29 18:42:19 +0000
commitddcbba036aee08f0709f98a92a342a278eae5c05 (patch)
tree746cce42c59c782314757a884b2630e8e9d1c1c2 /src
parent3fcf43bb0f3e86c16a88f239da18a1729a94d244 (diff)
parentd34c4ca9be41d14d8eb460f23abb353ce3be8ae7 (diff)
Auto merge of #98680 - matthiaskrgr:rollup-1bkrrn9, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #98434 (Ensure that `static_crt` is set in the bootstrapper whenever using `cc-rs` to get a compiler command line.)
 - #98636 (Triagebot: Fix mentions word wrapping.)
 - #98642 (Fix #98260)
 - #98643 (Improve pretty printing of valtrees for references)
 - #98646 (rustdoc: fix bugs in main.js popover help and settings)
 - #98647 (Update cargo)
 - #98652 (`alloc`: clean and ensure `no_global_oom_handling`  builds are warning-free)
 - #98660 (Unbreak stage1 tests via ignore-stage1 in `proc-macro/invalid-punct-ident-1.rs`.)
 - #98665 (Use verbose help for deprecation suggestion)
 - #98668 (Avoid some `&str` to `String` conversions with `MultiSpan::push_span_label`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/cc_detect.rs57
-rw-r--r--src/librustdoc/html/static/js/main.js8
-rw-r--r--src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile2
-rw-r--r--src/test/rustdoc-gui/pocket-menu.goml5
-rw-r--r--src/test/rustdoc-gui/settings.goml14
-rw-r--r--src/test/ui/const-generics/issue-66451.rs28
-rw-r--r--src/test/ui/const-generics/issue-66451.stderr20
-rw-r--r--src/test/ui/deprecation/atomic_initializers.stderr6
-rw-r--r--src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr13
-rw-r--r--src/test/ui/deprecation/suggestion.stderr13
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-1.rs18
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-1.stderr2
-rw-r--r--src/test/ui/typeck/issue-98260.rs9
-rw-r--r--src/test/ui/typeck/issue-98260.stderr12
m---------src/tools/cargo0
15 files changed, 155 insertions, 52 deletions
diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs
index dca782c29c2..759a99c330c 100644
--- a/src/bootstrap/cc_detect.rs
+++ b/src/bootstrap/cc_detect.rs
@@ -61,6 +61,30 @@ fn cc2ar(cc: &Path, target: TargetSelection) -> Option<PathBuf> {
     }
 }
 
+fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
+    let mut cfg = cc::Build::new();
+    cfg.cargo_metadata(false)
+        .opt_level(2)
+        .warnings(false)
+        .debug(false)
+        .target(&target.triple)
+        .host(&build.build.triple);
+    match build.crt_static(target) {
+        Some(a) => {
+            cfg.static_crt(a);
+        }
+        None => {
+            if target.contains("msvc") {
+                cfg.static_crt(true);
+            }
+            if target.contains("musl") {
+                cfg.static_flag(true);
+            }
+        }
+    }
+    cfg
+}
+
 pub fn find(build: &mut Build) {
     // For all targets we're going to need a C compiler for building some shims
     // and such as well as for being a linker for Rust code.
@@ -72,27 +96,7 @@ pub fn find(build: &mut Build) {
         .chain(iter::once(build.build))
         .collect::<HashSet<_>>();
     for target in targets.into_iter() {
-        let mut cfg = cc::Build::new();
-        cfg.cargo_metadata(false)
-            .opt_level(2)
-            .warnings(false)
-            .debug(false)
-            .target(&target.triple)
-            .host(&build.build.triple);
-        match build.crt_static(target) {
-            Some(a) => {
-                cfg.static_crt(a);
-            }
-            None => {
-                if target.contains("msvc") {
-                    cfg.static_crt(true);
-                }
-                if target.contains("musl") {
-                    cfg.static_flag(true);
-                }
-            }
-        }
-
+        let mut cfg = new_cc_build(build, target);
         let config = build.config.target_config.get(&target);
         if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
             cfg.compiler(cc);
@@ -112,15 +116,8 @@ pub fn find(build: &mut Build) {
 
         // If we use llvm-libunwind, we will need a C++ compiler as well for all targets
         // We'll need one anyways if the target triple is also a host triple
-        let mut cfg = cc::Build::new();
-        cfg.cargo_metadata(false)
-            .opt_level(2)
-            .warnings(false)
-            .debug(false)
-            .cpp(true)
-            .target(&target.triple)
-            .host(&build.build.triple);
-
+        let mut cfg = new_cc_build(build, target);
+        cfg.cpp(true);
         let cxx_configured = if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
             cfg.compiler(cxx);
             true
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index 70dbfd44425..c33e2727744 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -412,14 +412,15 @@ function loadCss(cssFileName) {
         window.hidePopoverMenus();
     }
 
-    const disableShortcuts = getSettingValue("disable-shortcuts") === "true";
     function handleShortcut(ev) {
         // Don't interfere with browser shortcuts
+        const disableShortcuts = getSettingValue("disable-shortcuts") === "true";
         if (ev.ctrlKey || ev.altKey || ev.metaKey || disableShortcuts) {
             return;
         }
 
-        if (document.activeElement.tagName === "INPUT") {
+        if (document.activeElement.tagName === "INPUT" &&
+            document.activeElement.type !== "checkbox") {
             switch (getVirtualKey(ev)) {
             case "Escape":
                 handleEscape(ev);
@@ -926,6 +927,7 @@ function loadCss(cssFileName) {
     function showHelp() {
         const menu = getHelpMenu(true);
         if (menu.style.display === "none") {
+            window.hidePopoverMenus();
             menu.style.display = "";
         }
     }
@@ -939,6 +941,8 @@ function loadCss(cssFileName) {
         const shouldShowHelp = menu.style.display === "none";
         if (shouldShowHelp) {
             showHelp();
+        } else {
+            window.hidePopoverMenus();
         }
     });
 
diff --git a/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile b/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile
index 6e25eb7e459..eb6ad9bd1a7 100644
--- a/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile
+++ b/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile
@@ -1,4 +1,4 @@
 -include ../tools.mk
 
 all:
-	$(RUSTC) --edition=2021 --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_global_oom_handling
+	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_global_oom_handling
diff --git a/src/test/rustdoc-gui/pocket-menu.goml b/src/test/rustdoc-gui/pocket-menu.goml
index ba2986e969a..54f3790a765 100644
--- a/src/test/rustdoc-gui/pocket-menu.goml
+++ b/src/test/rustdoc-gui/pocket-menu.goml
@@ -24,6 +24,11 @@ click: "#help-button"
 assert-css: ("#help-button .popover", {"display": "block"})
 assert-css: ("#settings-menu .popover", {"display": "none"})
 
+// Now verify that clicking the help menu again closes it.
+click: "#help-button"
+assert-css: ("#help-button .popover", {"display": "none"})
+assert-css: ("#settings-menu .popover", {"display": "none"})
+
 // We check the borders color now:
 
 // Ayu theme
diff --git a/src/test/rustdoc-gui/settings.goml b/src/test/rustdoc-gui/settings.goml
index 237a4751a8d..c402c7991c8 100644
--- a/src/test/rustdoc-gui/settings.goml
+++ b/src/test/rustdoc-gui/settings.goml
@@ -121,6 +121,20 @@ local-storage: {"rustdoc-disable-shortcuts": "false"}
 click: ".setting-line:last-child .toggle .label"
 assert-local-storage: {"rustdoc-disable-shortcuts": "true"}
 
+// Make sure that "Disable keyboard shortcuts" actually took effect.
+press-key: "Escape"
+press-key: "?"
+assert-false: "#help-button .popover"
+wait-for-css: ("#settings-menu .popover", {"display": "block"})
+
+// Now turn keyboard shortcuts back on, and see if they work.
+click: ".setting-line:last-child .toggle .label"
+assert-local-storage: {"rustdoc-disable-shortcuts": "false"}
+press-key: "Escape"
+press-key: "?"
+wait-for-css: ("#help-button .popover", {"display": "block"})
+assert-css: ("#settings-menu .popover", {"display": "none"})
+
 // Now we go to the settings page to check that the CSS is loaded as expected.
 goto: file://|DOC_PATH|/settings.html
 wait-for: "#settings"
diff --git a/src/test/ui/const-generics/issue-66451.rs b/src/test/ui/const-generics/issue-66451.rs
new file mode 100644
index 00000000000..3335f7d5984
--- /dev/null
+++ b/src/test/ui/const-generics/issue-66451.rs
@@ -0,0 +1,28 @@
+#![feature(adt_const_params)]
+#![allow(incomplete_features)]
+
+#[derive(Debug, PartialEq, Eq)]
+struct Foo {
+    value: i32,
+    nested: &'static Bar<i32>,
+}
+
+#[derive(Debug, PartialEq, Eq)]
+struct Bar<T>(T);
+
+struct Test<const F: Foo>;
+
+fn main() {
+    let x: Test<{
+        Foo {
+            value: 3,
+            nested: &Bar(4),
+        }
+    }> = Test;
+    let y: Test<{
+        Foo {
+            value: 3,
+            nested: &Bar(5),
+        }
+    }> = x; //~ ERROR mismatched types
+}
diff --git a/src/test/ui/const-generics/issue-66451.stderr b/src/test/ui/const-generics/issue-66451.stderr
new file mode 100644
index 00000000000..b691eac4f2d
--- /dev/null
+++ b/src/test/ui/const-generics/issue-66451.stderr
@@ -0,0 +1,20 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-66451.rs:27:10
+   |
+LL |       let y: Test<{
+   |  ____________-
+LL | |         Foo {
+LL | |             value: 3,
+LL | |             nested: &Bar(5),
+LL | |         }
+LL | |     }> = x;
+   | |      -   ^ expected `Foo { value: 3_i32, nested: &Bar::<i32>(5_i32) }`, found `Foo { value: 3_i32, nested: &Bar::<i32>(4_i32) }`
+   | |______|
+   |        expected due to this
+   |
+   = note: expected struct `Test<Foo { value: 3_i32, nested: &Bar::<i32>(5_i32) }>`
+              found struct `Test<Foo { value: 3_i32, nested: &Bar::<i32>(4_i32) }>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/deprecation/atomic_initializers.stderr b/src/test/ui/deprecation/atomic_initializers.stderr
index eaf5c61b440..30fcc9de618 100644
--- a/src/test/ui/deprecation/atomic_initializers.stderr
+++ b/src/test/ui/deprecation/atomic_initializers.stderr
@@ -2,9 +2,13 @@ warning: use of deprecated constant `std::sync::atomic::ATOMIC_ISIZE_INIT`: the
   --> $DIR/atomic_initializers.rs:8:27
    |
 LL | static FOO: AtomicIsize = ATOMIC_ISIZE_INIT;
-   |                           ^^^^^^^^^^^^^^^^^ help: replace the use of the deprecated constant: `AtomicIsize::new(0)`
+   |                           ^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default
+help: replace the use of the deprecated constant
+   |
+LL | static FOO: AtomicIsize = AtomicIsize::new(0);
+   |                           ~~~~~~~~~~~~~~~~~~~
 
 warning: 1 warning emitted
 
diff --git a/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr
index e65d21bb09b..8d4529526e3 100644
--- a/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr
+++ b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr
@@ -2,19 +2,28 @@ error: use of deprecated associated function `core::str::<impl str>::trim_left`:
   --> $DIR/issue-84637-deprecated-associated-function.rs:6:21
    |
 LL |     let _foo = str::trim_left("   aoeu");
-   |                     ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start`
+   |                     ^^^^^^^^^
    |
 note: the lint level is defined here
   --> $DIR/issue-84637-deprecated-associated-function.rs:3:9
    |
 LL | #![deny(deprecated)]
    |         ^^^^^^^^^^
+help: replace the use of the deprecated associated function
+   |
+LL |     let _foo = str::trim_start("   aoeu");
+   |                     ~~~~~~~~~~
 
 error: use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start`
   --> $DIR/issue-84637-deprecated-associated-function.rs:8:26
    |
 LL |     let _bar = "   aoeu".trim_left();
-   |                          ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start`
+   |                          ^^^^^^^^^
+   |
+help: replace the use of the deprecated associated function
+   |
+LL |     let _bar = "   aoeu".trim_start();
+   |                          ~~~~~~~~~~
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/deprecation/suggestion.stderr b/src/test/ui/deprecation/suggestion.stderr
index 8d1e108345f..c5f2fc09125 100644
--- a/src/test/ui/deprecation/suggestion.stderr
+++ b/src/test/ui/deprecation/suggestion.stderr
@@ -2,19 +2,28 @@ error: use of deprecated function `bar::deprecated`: replaced by `replacement`
   --> $DIR/suggestion.rs:42:10
    |
 LL |     bar::deprecated();
-   |          ^^^^^^^^^^ help: replace the use of the deprecated function: `replacement`
+   |          ^^^^^^^^^^
    |
 note: the lint level is defined here
   --> $DIR/suggestion.rs:8:9
    |
 LL | #![deny(deprecated)]
    |         ^^^^^^^^^^
+help: replace the use of the deprecated function
+   |
+LL |     bar::replacement();
+   |          ~~~~~~~~~~~
 
 error: use of deprecated associated function `Foo::deprecated`: replaced by `replacement`
   --> $DIR/suggestion.rs:40:9
    |
 LL |     foo.deprecated();
-   |         ^^^^^^^^^^ help: replace the use of the deprecated associated function: `replacement`
+   |         ^^^^^^^^^^
+   |
+help: replace the use of the deprecated associated function
+   |
+LL |     foo.replacement();
+   |         ~~~~~~~~~~~
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.rs b/src/test/ui/proc-macro/invalid-punct-ident-1.rs
index ecbb6ebf55b..fdf3ca2e261 100644
--- a/src/test/ui/proc-macro/invalid-punct-ident-1.rs
+++ b/src/test/ui/proc-macro/invalid-punct-ident-1.rs
@@ -1,17 +1,9 @@
 // aux-build:invalid-punct-ident.rs
-// rustc-env:RUST_BACKTRACE=0
-
-// FIXME https://github.com/rust-lang/rust/issues/59998
-// normalize-stderr-test "thread.*panicked.*proc_macro.*lib.rs.*\n" -> ""
-// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
-// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
-// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
-// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
-// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
-// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "query stack during panic:\n" -> ""
-// normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> ""
-// normalize-stderr-test "end of query stack\n" -> ""
+// ignore-stage1
+// only-linux
+//
+// FIXME: This should be a normal (stage1, all platforms) test in
+// src/test/ui/proc-macro once issue #59998 is fixed.
 
 #[macro_use]
 extern crate invalid_punct_ident;
diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr
index eaf41c080fa..bb0a48cb16b 100644
--- a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr
+++ b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr
@@ -1,5 +1,5 @@
 error: proc macro panicked
-  --> $DIR/invalid-punct-ident-1.rs:19:1
+  --> $DIR/invalid-punct-ident-1.rs:11:1
    |
 LL | invalid_punct!();
    | ^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/typeck/issue-98260.rs b/src/test/ui/typeck/issue-98260.rs
new file mode 100644
index 00000000000..cf48294e199
--- /dev/null
+++ b/src/test/ui/typeck/issue-98260.rs
@@ -0,0 +1,9 @@
+fn main() {}
+trait A {
+    fn a(aa: B) -> Result<_, B> {
+    //~^ ERROR: the placeholder `_` is not allowed within types on item signatures for return types [E0121]
+        Ok(())
+    }
+}
+
+enum B {}
diff --git a/src/test/ui/typeck/issue-98260.stderr b/src/test/ui/typeck/issue-98260.stderr
new file mode 100644
index 00000000000..08a1d17e244
--- /dev/null
+++ b/src/test/ui/typeck/issue-98260.stderr
@@ -0,0 +1,12 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+  --> $DIR/issue-98260.rs:3:27
+   |
+LL |     fn a(aa: B) -> Result<_, B> {
+   |                    -------^----
+   |                    |      |
+   |                    |      not allowed in type signatures
+   |                    help: replace with the correct return type: `Result<(), B>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0121`.
diff --git a/src/tools/cargo b/src/tools/cargo
-Subproject a5e08c4703f202e30cdaf80ca3e7c00baa59c49
+Subproject dbff32b27893b899ae2397f3d56d1be111041d5