From b3ff4835befc318f59ece942923ce55e4b2f1aa5 Mon Sep 17 00:00:00 2001
From: Alec Goncharow <algo@cloudflare.com>
Date: Tue, 29 Mar 2022 12:43:21 -0400
Subject: [PATCH 1/5] bootstrap: loosen and expand python check bounds

---
 src/bootstrap/sanity.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
index 8c2899c1ac01e..c96e6f9a3678f 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -103,7 +103,9 @@ pub fn check(build: &mut Build) {
         .take()
         .map(|p| cmd_finder.must_have(p))
         .or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py
-        .or_else(|| Some(cmd_finder.must_have("python")));
+        .or_else(|| cmd_finder.maybe_have("python"))
+        .or_else(|| cmd_finder.maybe_have("python3"))
+        .or_else(|| cmd_finder.maybe_have("python2"));
 
     build.config.nodejs = build
         .config

From 03c5f0d2182cc36548b782599412408349b13cbb Mon Sep 17 00:00:00 2001
From: Alec Goncharow <algo@cloudflare.com>
Date: Tue, 29 Mar 2022 12:45:54 -0400
Subject: [PATCH 2/5] bootstrap: force system python3 on MacOS

---
 src/bootstrap/lib.rs  | 12 +++++++++++-
 src/bootstrap/test.rs |  9 +--------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 8f076ad914d9a..0736c4464b937 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1167,7 +1167,17 @@ impl Build {
 
     /// Path to the python interpreter to use
     fn python(&self) -> &Path {
-        self.config.python.as_ref().unwrap()
+        if self.config.build.ends_with("apple-darwin") {
+            // Force /usr/bin/python3 on macOS for LLDB tests because we're loading the
+            // LLDB plugin's compiled module which only works with the system python
+            // (namely not Homebrew-installed python)
+            Path::new("/usr/bin/python3")
+        } else {
+            self.config
+                .python
+                .as_ref()
+                .expect("python is required for running LLDB or rustdoc tests")
+        }
     }
 
     /// Temporary directory that extended error information is emitted to.
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index c8b76809abad7..00ede2140a693 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1403,14 +1403,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
 
         cmd.arg("--docck-python").arg(builder.python());
 
-        if builder.config.build.ends_with("apple-darwin") {
-            // Force /usr/bin/python3 on macOS for LLDB tests because we're loading the
-            // LLDB plugin's compiled module which only works with the system python
-            // (namely not Homebrew-installed python)
-            cmd.arg("--lldb-python").arg("/usr/bin/python3");
-        } else {
-            cmd.arg("--lldb-python").arg(builder.python());
-        }
+        cmd.arg("--lldb-python").arg(builder.python());
 
         if let Some(ref gdb) = builder.config.gdb {
             cmd.arg("--gdb").arg(gdb);

From 39e83c1e2a4653f99781a0dd1efd5ddfb3f58284 Mon Sep 17 00:00:00 2001
From: AnthonyMikh <anthony.mikh@yandex.ru>
Date: Tue, 12 Apr 2022 02:23:40 +0300
Subject: [PATCH 3/5] fix broken link in coverage tools docs

---
 .../img => rustc/src/images}/llvm-cov-show-01.png   | Bin
 src/doc/rustc/src/instrument-coverage.md            |   2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename src/doc/{unstable-book/src/compiler-flags/img => rustc/src/images}/llvm-cov-show-01.png (100%)

diff --git a/src/doc/unstable-book/src/compiler-flags/img/llvm-cov-show-01.png b/src/doc/rustc/src/images/llvm-cov-show-01.png
similarity index 100%
rename from src/doc/unstable-book/src/compiler-flags/img/llvm-cov-show-01.png
rename to src/doc/rustc/src/images/llvm-cov-show-01.png
diff --git a/src/doc/rustc/src/instrument-coverage.md b/src/doc/rustc/src/instrument-coverage.md
index b94989161ccfc..108b0ffe99b85 100644
--- a/src/doc/rustc/src/instrument-coverage.md
+++ b/src/doc/rustc/src/instrument-coverage.md
@@ -145,7 +145,7 @@ $ llvm-cov show -Xdemangler=rustfilt target/debug/examples/formatjson5 \
     -name=add_quoted_string
 ```
 
-<img alt="Screenshot of sample `llvm-cov show` result, for function add_quoted_string" src="img/llvm-cov-show-01.png" class="center"/>
+<img alt="Screenshot of sample `llvm-cov show` result, for function add_quoted_string" src="images/llvm-cov-show-01.png" class="center"/>
 <br/>
 <br/>
 

From 9ea89e1d3d10622c7a4035f82f1ad5389e69b45d Mon Sep 17 00:00:00 2001
From: wcampbell <wcampbell1995@gmail.com>
Date: Tue, 12 Apr 2022 13:29:56 -0400
Subject: [PATCH 4/5] Fix spelling in docs for can_not_overflow

---
 library/core/src/num/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs
index f45b73b053364..8b93cd39d5df3 100644
--- a/library/core/src/num/mod.rs
+++ b/library/core/src/num/mod.rs
@@ -999,7 +999,7 @@ macro_rules! impl_helper_for {
 }
 impl_helper_for! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize }
 
-/// Determins if a string of text of that length of that radix could be guaranteed to be
+/// Determines if a string of text of that length of that radix could be guaranteed to be
 /// stored in the given type T.
 /// Note that if the radix is known to the compiler, it is just the check of digits.len that
 /// is done at runtime.

From 7228e9b098a27f48a87bec067b01e2000fdccb2d Mon Sep 17 00:00:00 2001
From: Michael Howell <michael@notriddle.com>
Date: Tue, 12 Apr 2022 12:14:32 -0700
Subject: [PATCH 5/5] regression test for spurrious "help: store this in the
 heap"

Closes #82446
---
 src/test/ui/box/issue-82446.rs     | 15 +++++++++++++++
 src/test/ui/box/issue-82446.stderr | 12 ++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 src/test/ui/box/issue-82446.rs
 create mode 100644 src/test/ui/box/issue-82446.stderr

diff --git a/src/test/ui/box/issue-82446.rs b/src/test/ui/box/issue-82446.rs
new file mode 100644
index 0000000000000..2960f7fbc2121
--- /dev/null
+++ b/src/test/ui/box/issue-82446.rs
@@ -0,0 +1,15 @@
+// https://github.com/rust-lang/rust/issues/82446
+// Spurious 'help: store this in the heap' regression test
+trait MyTrait {}
+
+struct Foo {
+    val: Box<dyn MyTrait>
+}
+
+fn make_it(val: &Box<dyn MyTrait>) {
+    Foo {
+        val //~ ERROR [E0308]
+    };
+}
+
+fn main() {}
diff --git a/src/test/ui/box/issue-82446.stderr b/src/test/ui/box/issue-82446.stderr
new file mode 100644
index 0000000000000..0374737957e48
--- /dev/null
+++ b/src/test/ui/box/issue-82446.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-82446.rs:11:9
+   |
+LL |         val
+   |         ^^^ expected struct `Box`, found reference
+   |
+   = note: expected struct `Box<(dyn MyTrait + 'static)>`
+           found reference `&Box<(dyn MyTrait + 'static)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.