From b53d839b239d8fcf4cddfbd565ce5a8836217d5c Mon Sep 17 00:00:00 2001
From: Taiki Endo <te316e89@gmail.com>
Date: Sun, 19 May 2019 12:31:08 +0900
Subject: [PATCH 1/4] Move arbitrary_self_types's tests into ui/self

---
 src/test/ui/{ => self}/arbitrary-self-types-not-object-safe.rs   | 0
 .../ui/{ => self}/arbitrary-self-types-not-object-safe.stderr    | 0
 .../self}/arbitrary_self_types_pointers_and_wrappers.rs          | 1 +
 .../self/arbitrary_self_types_raw_pointer_struct.rs              | 0
 .../self/arbitrary_self_types_raw_pointer_trait.rs               | 0
 src/test/{run-pass => ui}/self/arbitrary_self_types_silly.rs     | 0
 .../self}/arbitrary_self_types_stdlib_pointers.rs                | 1 +
 src/test/{run-pass => ui}/self/arbitrary_self_types_struct.rs    | 0
 src/test/{run-pass => ui}/self/arbitrary_self_types_trait.rs     | 0
 .../{run-pass => ui}/self/arbitrary_self_types_unsized_struct.rs | 0
 10 files changed, 2 insertions(+)
 rename src/test/ui/{ => self}/arbitrary-self-types-not-object-safe.rs (100%)
 rename src/test/ui/{ => self}/arbitrary-self-types-not-object-safe.stderr (100%)
 rename src/test/{run-pass => ui/self}/arbitrary_self_types_pointers_and_wrappers.rs (99%)
 rename src/test/{run-pass => ui}/self/arbitrary_self_types_raw_pointer_struct.rs (100%)
 rename src/test/{run-pass => ui}/self/arbitrary_self_types_raw_pointer_trait.rs (100%)
 rename src/test/{run-pass => ui}/self/arbitrary_self_types_silly.rs (100%)
 rename src/test/{run-pass => ui/self}/arbitrary_self_types_stdlib_pointers.rs (99%)
 rename src/test/{run-pass => ui}/self/arbitrary_self_types_struct.rs (100%)
 rename src/test/{run-pass => ui}/self/arbitrary_self_types_trait.rs (100%)
 rename src/test/{run-pass => ui}/self/arbitrary_self_types_unsized_struct.rs (100%)

diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.rs b/src/test/ui/self/arbitrary-self-types-not-object-safe.rs
similarity index 100%
rename from src/test/ui/arbitrary-self-types-not-object-safe.rs
rename to src/test/ui/self/arbitrary-self-types-not-object-safe.rs
diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr
similarity index 100%
rename from src/test/ui/arbitrary-self-types-not-object-safe.stderr
rename to src/test/ui/self/arbitrary-self-types-not-object-safe.stderr
diff --git a/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs b/src/test/ui/self/arbitrary_self_types_pointers_and_wrappers.rs
similarity index 99%
rename from src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs
rename to src/test/ui/self/arbitrary_self_types_pointers_and_wrappers.rs
index 6904c29111ee3..65fec3becacee 100644
--- a/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs
+++ b/src/test/ui/self/arbitrary_self_types_pointers_and_wrappers.rs
@@ -1,3 +1,4 @@
+// run-pass
 #![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)]
 #![feature(rustc_attrs)]
 
diff --git a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs b/src/test/ui/self/arbitrary_self_types_raw_pointer_struct.rs
similarity index 100%
rename from src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs
rename to src/test/ui/self/arbitrary_self_types_raw_pointer_struct.rs
diff --git a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs b/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs
similarity index 100%
rename from src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs
rename to src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs
diff --git a/src/test/run-pass/self/arbitrary_self_types_silly.rs b/src/test/ui/self/arbitrary_self_types_silly.rs
similarity index 100%
rename from src/test/run-pass/self/arbitrary_self_types_silly.rs
rename to src/test/ui/self/arbitrary_self_types_silly.rs
diff --git a/src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs b/src/test/ui/self/arbitrary_self_types_stdlib_pointers.rs
similarity index 99%
rename from src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs
rename to src/test/ui/self/arbitrary_self_types_stdlib_pointers.rs
index 9f6a647a07b31..29563fbbd8676 100644
--- a/src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs
+++ b/src/test/ui/self/arbitrary_self_types_stdlib_pointers.rs
@@ -1,3 +1,4 @@
+// run-pass
 #![feature(arbitrary_self_types)]
 #![feature(rustc_attrs)]
 
diff --git a/src/test/run-pass/self/arbitrary_self_types_struct.rs b/src/test/ui/self/arbitrary_self_types_struct.rs
similarity index 100%
rename from src/test/run-pass/self/arbitrary_self_types_struct.rs
rename to src/test/ui/self/arbitrary_self_types_struct.rs
diff --git a/src/test/run-pass/self/arbitrary_self_types_trait.rs b/src/test/ui/self/arbitrary_self_types_trait.rs
similarity index 100%
rename from src/test/run-pass/self/arbitrary_self_types_trait.rs
rename to src/test/ui/self/arbitrary_self_types_trait.rs
diff --git a/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs b/src/test/ui/self/arbitrary_self_types_unsized_struct.rs
similarity index 100%
rename from src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs
rename to src/test/ui/self/arbitrary_self_types_unsized_struct.rs

From 3e73ca6e336650eb0cb8429b3932d63d71c2a476 Mon Sep 17 00:00:00 2001
From: Taiki Endo <te316e89@gmail.com>
Date: Sun, 19 May 2019 22:17:12 +0900
Subject: [PATCH 2/4] Move run-pass/self/* to ui/self

---
 .../{run-pass => ui}/self/auxiliary/explicit_self_xcrate.rs     | 0
 src/test/{run-pass => ui}/self/builtin-superkinds-self-type.rs  | 0
 src/test/{run-pass => ui}/self/by-value-self-in-mut-slot.rs     | 0
 src/test/{run-pass => ui}/self/explicit-self-closures.rs        | 2 +-
 src/test/{run-pass => ui}/self/explicit-self-generic.rs         | 0
 src/test/{run-pass => ui}/self/explicit-self-objects-uniq.rs    | 0
 src/test/{run-pass => ui}/self/explicit-self.rs                 | 0
 src/test/{run-pass => ui}/self/explicit_self_xcrate_exe.rs      | 0
 src/test/{run-pass => ui}/self/move-self.rs                     | 0
 .../self/object-safety-sized-self-by-value-self.rs              | 0
 .../self/object-safety-sized-self-generic-method.rs             | 0
 .../self/object-safety-sized-self-return-Self.rs                | 0
 src/test/{run-pass/self/self-impl.rs => ui/self/self-impl-2.rs} | 0
 .../{run-pass => ui}/self/self-in-mut-slot-default-method.rs    | 0
 .../{run-pass => ui}/self/self-in-mut-slot-immediate-value.rs   | 0
 src/test/{run-pass => ui}/self/self-in-typedefs.rs              | 2 +-
 src/test/{run-pass => ui}/self/self-re-assign.rs                | 0
 src/test/{run-pass => ui}/self/self-shadowing-import.rs         | 0
 src/test/{run-pass => ui}/self/self-type-param.rs               | 2 +-
 src/test/{run-pass => ui}/self/string-self-append.rs            | 0
 src/test/{run-pass => ui}/self/ufcs-explicit-self.rs            | 0
 src/test/{run-pass => ui}/self/uniq-self-in-mut-slot.rs         | 0
 src/test/{run-pass => ui}/self/where-for-self.rs                | 0
 23 files changed, 3 insertions(+), 3 deletions(-)
 rename src/test/{run-pass => ui}/self/auxiliary/explicit_self_xcrate.rs (100%)
 rename src/test/{run-pass => ui}/self/builtin-superkinds-self-type.rs (100%)
 rename src/test/{run-pass => ui}/self/by-value-self-in-mut-slot.rs (100%)
 rename src/test/{run-pass => ui}/self/explicit-self-closures.rs (94%)
 rename src/test/{run-pass => ui}/self/explicit-self-generic.rs (100%)
 rename src/test/{run-pass => ui}/self/explicit-self-objects-uniq.rs (100%)
 rename src/test/{run-pass => ui}/self/explicit-self.rs (100%)
 rename src/test/{run-pass => ui}/self/explicit_self_xcrate_exe.rs (100%)
 rename src/test/{run-pass => ui}/self/move-self.rs (100%)
 rename src/test/{run-pass => ui}/self/object-safety-sized-self-by-value-self.rs (100%)
 rename src/test/{run-pass => ui}/self/object-safety-sized-self-generic-method.rs (100%)
 rename src/test/{run-pass => ui}/self/object-safety-sized-self-return-Self.rs (100%)
 rename src/test/{run-pass/self/self-impl.rs => ui/self/self-impl-2.rs} (100%)
 rename src/test/{run-pass => ui}/self/self-in-mut-slot-default-method.rs (100%)
 rename src/test/{run-pass => ui}/self/self-in-mut-slot-immediate-value.rs (100%)
 rename src/test/{run-pass => ui}/self/self-in-typedefs.rs (96%)
 rename src/test/{run-pass => ui}/self/self-re-assign.rs (100%)
 rename src/test/{run-pass => ui}/self/self-shadowing-import.rs (100%)
 rename src/test/{run-pass => ui}/self/self-type-param.rs (93%)
 rename src/test/{run-pass => ui}/self/string-self-append.rs (100%)
 rename src/test/{run-pass => ui}/self/ufcs-explicit-self.rs (100%)
 rename src/test/{run-pass => ui}/self/uniq-self-in-mut-slot.rs (100%)
 rename src/test/{run-pass => ui}/self/where-for-self.rs (100%)

diff --git a/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs b/src/test/ui/self/auxiliary/explicit_self_xcrate.rs
similarity index 100%
rename from src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs
rename to src/test/ui/self/auxiliary/explicit_self_xcrate.rs
diff --git a/src/test/run-pass/self/builtin-superkinds-self-type.rs b/src/test/ui/self/builtin-superkinds-self-type.rs
similarity index 100%
rename from src/test/run-pass/self/builtin-superkinds-self-type.rs
rename to src/test/ui/self/builtin-superkinds-self-type.rs
diff --git a/src/test/run-pass/self/by-value-self-in-mut-slot.rs b/src/test/ui/self/by-value-self-in-mut-slot.rs
similarity index 100%
rename from src/test/run-pass/self/by-value-self-in-mut-slot.rs
rename to src/test/ui/self/by-value-self-in-mut-slot.rs
diff --git a/src/test/run-pass/self/explicit-self-closures.rs b/src/test/ui/self/explicit-self-closures.rs
similarity index 94%
rename from src/test/run-pass/self/explicit-self-closures.rs
rename to src/test/ui/self/explicit-self-closures.rs
index 61be98fe3d3cd..1217823da116e 100644
--- a/src/test/run-pass/self/explicit-self-closures.rs
+++ b/src/test/ui/self/explicit-self-closures.rs
@@ -1,4 +1,4 @@
-// run-pass
+// compile-pass
 #![allow(dead_code)]
 // Test to make sure that explicit self params work inside closures
 
diff --git a/src/test/run-pass/self/explicit-self-generic.rs b/src/test/ui/self/explicit-self-generic.rs
similarity index 100%
rename from src/test/run-pass/self/explicit-self-generic.rs
rename to src/test/ui/self/explicit-self-generic.rs
diff --git a/src/test/run-pass/self/explicit-self-objects-uniq.rs b/src/test/ui/self/explicit-self-objects-uniq.rs
similarity index 100%
rename from src/test/run-pass/self/explicit-self-objects-uniq.rs
rename to src/test/ui/self/explicit-self-objects-uniq.rs
diff --git a/src/test/run-pass/self/explicit-self.rs b/src/test/ui/self/explicit-self.rs
similarity index 100%
rename from src/test/run-pass/self/explicit-self.rs
rename to src/test/ui/self/explicit-self.rs
diff --git a/src/test/run-pass/self/explicit_self_xcrate_exe.rs b/src/test/ui/self/explicit_self_xcrate_exe.rs
similarity index 100%
rename from src/test/run-pass/self/explicit_self_xcrate_exe.rs
rename to src/test/ui/self/explicit_self_xcrate_exe.rs
diff --git a/src/test/run-pass/self/move-self.rs b/src/test/ui/self/move-self.rs
similarity index 100%
rename from src/test/run-pass/self/move-self.rs
rename to src/test/ui/self/move-self.rs
diff --git a/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs b/src/test/ui/self/object-safety-sized-self-by-value-self.rs
similarity index 100%
rename from src/test/run-pass/self/object-safety-sized-self-by-value-self.rs
rename to src/test/ui/self/object-safety-sized-self-by-value-self.rs
diff --git a/src/test/run-pass/self/object-safety-sized-self-generic-method.rs b/src/test/ui/self/object-safety-sized-self-generic-method.rs
similarity index 100%
rename from src/test/run-pass/self/object-safety-sized-self-generic-method.rs
rename to src/test/ui/self/object-safety-sized-self-generic-method.rs
diff --git a/src/test/run-pass/self/object-safety-sized-self-return-Self.rs b/src/test/ui/self/object-safety-sized-self-return-Self.rs
similarity index 100%
rename from src/test/run-pass/self/object-safety-sized-self-return-Self.rs
rename to src/test/ui/self/object-safety-sized-self-return-Self.rs
diff --git a/src/test/run-pass/self/self-impl.rs b/src/test/ui/self/self-impl-2.rs
similarity index 100%
rename from src/test/run-pass/self/self-impl.rs
rename to src/test/ui/self/self-impl-2.rs
diff --git a/src/test/run-pass/self/self-in-mut-slot-default-method.rs b/src/test/ui/self/self-in-mut-slot-default-method.rs
similarity index 100%
rename from src/test/run-pass/self/self-in-mut-slot-default-method.rs
rename to src/test/ui/self/self-in-mut-slot-default-method.rs
diff --git a/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs b/src/test/ui/self/self-in-mut-slot-immediate-value.rs
similarity index 100%
rename from src/test/run-pass/self/self-in-mut-slot-immediate-value.rs
rename to src/test/ui/self/self-in-mut-slot-immediate-value.rs
diff --git a/src/test/run-pass/self/self-in-typedefs.rs b/src/test/ui/self/self-in-typedefs.rs
similarity index 96%
rename from src/test/run-pass/self/self-in-typedefs.rs
rename to src/test/ui/self/self-in-typedefs.rs
index 9c0906013fafc..e4fe7324ef3a6 100644
--- a/src/test/run-pass/self/self-in-typedefs.rs
+++ b/src/test/ui/self/self-in-typedefs.rs
@@ -1,4 +1,4 @@
-// run-pass
+// compile-pass
 
 #![feature(untagged_unions)]
 
diff --git a/src/test/run-pass/self/self-re-assign.rs b/src/test/ui/self/self-re-assign.rs
similarity index 100%
rename from src/test/run-pass/self/self-re-assign.rs
rename to src/test/ui/self/self-re-assign.rs
diff --git a/src/test/run-pass/self/self-shadowing-import.rs b/src/test/ui/self/self-shadowing-import.rs
similarity index 100%
rename from src/test/run-pass/self/self-shadowing-import.rs
rename to src/test/ui/self/self-shadowing-import.rs
diff --git a/src/test/run-pass/self/self-type-param.rs b/src/test/ui/self/self-type-param.rs
similarity index 93%
rename from src/test/run-pass/self/self-type-param.rs
rename to src/test/ui/self/self-type-param.rs
index 6deae5f2d12f4..57e01caa692de 100644
--- a/src/test/run-pass/self/self-type-param.rs
+++ b/src/test/ui/self/self-type-param.rs
@@ -1,4 +1,4 @@
-// run-pass
+// compile-pass
 #![allow(dead_code)]
 // pretty-expanded FIXME #23616
 
diff --git a/src/test/run-pass/self/string-self-append.rs b/src/test/ui/self/string-self-append.rs
similarity index 100%
rename from src/test/run-pass/self/string-self-append.rs
rename to src/test/ui/self/string-self-append.rs
diff --git a/src/test/run-pass/self/ufcs-explicit-self.rs b/src/test/ui/self/ufcs-explicit-self.rs
similarity index 100%
rename from src/test/run-pass/self/ufcs-explicit-self.rs
rename to src/test/ui/self/ufcs-explicit-self.rs
diff --git a/src/test/run-pass/self/uniq-self-in-mut-slot.rs b/src/test/ui/self/uniq-self-in-mut-slot.rs
similarity index 100%
rename from src/test/run-pass/self/uniq-self-in-mut-slot.rs
rename to src/test/ui/self/uniq-self-in-mut-slot.rs
diff --git a/src/test/run-pass/self/where-for-self.rs b/src/test/ui/self/where-for-self.rs
similarity index 100%
rename from src/test/run-pass/self/where-for-self.rs
rename to src/test/ui/self/where-for-self.rs

From 69c632699c3190c2004b6725873d0ea39c59bf83 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Mon, 20 May 2019 11:00:34 -0700
Subject: [PATCH 3/4] Bump compiler-builtins to 0.1.15

This commit bumps the `compiler-builtins` dependency to 0.1.15 which
expects to have the source for `compiler-rt` provided externally if the
`c` feature is enabled. This then plumbs through the necessary support
in the build system to ensure that if the `llvm-project` directory is
checked out and present that we enable the `c` feature of
`compiler-builtins` and compile in all the C intrinsics.
---
 Cargo.lock               | 34 +++++++++++++++++-----------------
 src/bootstrap/compile.rs | 29 ++++++++++++++++++++++++++++-
 src/build_helper/lib.rs  |  6 +++---
 src/libstd/Cargo.toml    |  6 +++---
 4 files changed, 51 insertions(+), 24 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index db9f0069ced0c..b651faac90281 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -25,7 +25,7 @@ dependencies = [
 name = "alloc"
 version = "0.0.0"
 dependencies = [
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -123,7 +123,7 @@ version = "0.1.27"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-core 1.0.0",
 ]
@@ -462,7 +462,7 @@ dependencies = [
 
 [[package]]
 name = "compiler_builtins"
-version = "0.1.14"
+version = "0.1.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -744,7 +744,7 @@ name = "dlmalloc"
 version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-core 1.0.0",
 ]
@@ -910,7 +910,7 @@ name = "fortanix-sgx-abi"
 version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-core 1.0.0",
 ]
 
@@ -1071,7 +1071,7 @@ name = "hashbrown"
 version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-alloc 1.0.0",
  "rustc-std-workspace-core 1.0.0",
 ]
@@ -1772,7 +1772,7 @@ dependencies = [
 name = "panic_abort"
 version = "0.0.0"
 dependencies = [
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -1782,7 +1782,7 @@ name = "panic_unwind"
 version = "0.0.0"
 dependencies = [
  "alloc 0.0.0",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
  "unwind 0.0.0",
@@ -1967,7 +1967,7 @@ name = "profiler_builtins"
 version = "0.0.0"
 dependencies = [
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -2492,7 +2492,7 @@ name = "rustc-demangle"
 version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-core 1.0.0",
 ]
 
@@ -2620,7 +2620,7 @@ dependencies = [
  "alloc 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -2850,7 +2850,7 @@ dependencies = [
  "alloc 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -2912,7 +2912,7 @@ dependencies = [
  "alloc 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -3029,7 +3029,7 @@ dependencies = [
  "alloc 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -3298,7 +3298,7 @@ dependencies = [
  "alloc 0.0.0",
  "backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3889,7 +3889,7 @@ name = "unwind"
 version = "0.0.0"
 dependencies = [
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -4087,7 +4087,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
 "checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007"
 "checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2"
-"checksum compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "e3f235c329e5cb9fa3d2ca2cc36256ba9a7f23fa76e0f4db6f68c23b73b2ac69"
+"checksum compiler_builtins 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "e899b947d7e71c3d35c0b6194d64025b84946640510e215090c815b20828964e"
 "checksum compiletest_rs 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "f40ecc9332b68270998995c00f8051ee856121764a0d3230e64c9efd059d27b6"
 "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
 "checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index e1cdd226fd6e5..2da5e1c5902c1 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -161,7 +161,33 @@ pub fn std_cargo(builder: &Builder<'_>,
         cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
     }
 
+    // Determine if we're going to compile in optimized C intrinsics to
+    // the `compiler-builtins` crate. These intrinsics live in LLVM's
+    // `compiler-rt` repository, but our `src/llvm-project` submodule isn't
+    // always checked out, so we need to conditionally look for this. (e.g. if
+    // an external LLVM is used we skip the LLVM submodule checkout).
+    //
+    // Note that this shouldn't affect the correctness of `compiler-builtins`,
+    // but only its speed. Some intrinsics in C haven't been translated to Rust
+    // yet but that's pretty rare. Other intrinsics have optimized
+    // implementations in C which have only had slower versions ported to Rust,
+    // so we favor the C version where we can, but it's not critical.
+    //
+    // If `compiler-rt` is available ensure that the `c` feature of the
+    // `compiler-builtins` crate is enabled and it's configured to learn where
+    // `compiler-rt` is located.
+    let compiler_builtins_root = builder.src.join("src/llvm-project/compiler-rt");
+    let compiler_builtins_c_feature = if compiler_builtins_root.exists() {
+        cargo.env("RUST_COMPILER_RT_ROOT", &compiler_builtins_root);
+        " compiler-builtins-c".to_string()
+    } else {
+        String::new()
+    };
+
     if builder.no_std(target) == Some(true) {
+        let mut features = "compiler-builtins-mem".to_string();
+        features.push_str(&compiler_builtins_c_feature);
+
         // for no-std targets we only compile a few no_std crates
         cargo
             .args(&["-p", "alloc"])
@@ -170,7 +196,8 @@ pub fn std_cargo(builder: &Builder<'_>,
             .arg("--features")
             .arg("compiler-builtins-mem compiler-builtins-c");
     } else {
-        let features = builder.std_features();
+        let mut features = builder.std_features();
+        features.push_str(&compiler_builtins_c_feature);
 
         if compiler.stage != 0 && builder.config.sanitizers {
             // This variable is used by the sanitizer runtime crates, e.g.
diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs
index 60911d917899f..8b00c1d81b08c 100644
--- a/src/build_helper/lib.rs
+++ b/src/build_helper/lib.rs
@@ -288,9 +288,9 @@ pub fn sanitizer_lib_boilerplate(sanitizer_name: &str)
     } else {
         format!("static={}", link_name)
     };
-    // The source for `compiler-rt` comes from the `compiler-builtins` crate, so
-    // load our env var set by cargo to find the source code.
-    let dir = env::var_os("DEP_COMPILER_RT_COMPILER_RT").unwrap();
+    // This env var is provided by rustbuild to tell us where `compiler-rt`
+    // lives.
+    let dir = env::var_os("RUST_COMPILER_RT_ROOT").unwrap();
     let lib = native_lib_boilerplate(
         dir.as_ref(),
         sanitizer_name,
diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml
index 55e8b39974e09..c4c1170e539ae 100644
--- a/src/libstd/Cargo.toml
+++ b/src/libstd/Cargo.toml
@@ -19,7 +19,7 @@ panic_unwind = { path = "../libpanic_unwind", optional = true }
 panic_abort = { path = "../libpanic_abort" }
 core = { path = "../libcore" }
 libc = { version = "0.2.51", default-features = false, features = ['rustc-dep-of-std'] }
-compiler_builtins = { version = "0.1.14" }
+compiler_builtins = { version = "0.1.15" }
 profiler_builtins = { path = "../libprofiler_builtins", optional = true }
 unwind = { path = "../libunwind" }
 hashbrown = { version = "0.3.0", features = ['rustc-dep-of-std'] }
@@ -49,12 +49,12 @@ fortanix-sgx-abi = { version = "0.3.2", features = ['rustc-dep-of-std'] }
 cc = "1.0"
 
 [features]
-default = ["compiler_builtins_c", "std_detect_file_io", "std_detect_dlsym_getauxval"]
+default = ["std_detect_file_io", "std_detect_dlsym_getauxval"]
 
 backtrace = ["backtrace-sys"]
 panic-unwind = ["panic_unwind"]
 profiler = ["profiler_builtins"]
-compiler_builtins_c = ["alloc/compiler-builtins-c"]
+compiler-builtins-c = ["alloc/compiler-builtins-c"]
 llvm-libunwind = ["unwind/llvm-libunwind"]
 
 # Make panics and failed asserts immediately abort without formatting any message

From a775d11fff5f604c09c5ec06c2a82cb8fbef285f Mon Sep 17 00:00:00 2001
From: "William D. Jones" <thor0505@comcast.net>
Date: Mon, 20 May 2019 15:27:11 -0400
Subject: [PATCH 4/4] Fix MSP430 AsmPrinter and assembler syntax mismatch.

---
 src/llvm-project | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/llvm-project b/src/llvm-project
index eb38a1888d1d2..2c5656ae59385 160000
--- a/src/llvm-project
+++ b/src/llvm-project
@@ -1 +1 @@
-Subproject commit eb38a1888d1d29b2d2c6b31428a5201cd8fba0ff
+Subproject commit 2c5656ae593851d0b2336a727cc14b77a06b8ac0