dev-lang/rust: upgrade to Rust 1.48.0

This CL is created by rust_uprev tool automatically.
BUG=chromium:1151315
TEST=Use CQ to test the new Rust version

Change-Id: I697c3766435a5c2c1e60d18fe5a56e3600aea1d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2634263
Reviewed-by: Bob Haarman <inglorion@chromium.org>
Tested-by: Bob Haarman <inglorion@chromium.org>
diff --git a/dev-lang/rust-bootstrap/Manifest b/dev-lang/rust-bootstrap/Manifest
index 9bacf7c..321137d 100644
--- a/dev-lang/rust-bootstrap/Manifest
+++ b/dev-lang/rust-bootstrap/Manifest
@@ -1,5 +1,5 @@
 DIST mrustc-0.9.tar.gz 905308 BLAKE2B 4e8829bce1d6a26028a4d8fb8373988e41989aaef4bdd21b3fcca1aee6f72d301b510ae4458502fc1be06c35601362ac5e23aeedfd0c099dd0d5414015f55c2a SHA512 7cefc6c1a4a6757b1b6351332fa2a71ea1eda0060d2d884f9e821fb17856f3ac26bdba7bde13e2c18bba9e243e5a599316e148479c3384d7899bc5223e9d5589
-DIST rust-bootstrap-1.45.2.tbz2 446514184 BLAKE2B 3b2f39e7d7328b32ff05cd21b6c36368abc1fc68d4600fe59585a1a3c2129e97b178345287e85256a01910e3d275d7b86bd8bff8aa7be30cdb42770608c55de7 SHA512 0f523c9b2704ddd1cb161a54ea8bf7436da690013684dd7a0bf164cfbad19c942540b90f936682038d8d96065afe68838279803ce75a76c85e0b26c5fd392cfd
+DIST rust-bootstrap-1.46.0.tbz2 262950544 BLAKE2B 65d408d9cc206b04e0a72518f58be522eda2bf9527ba22a9acb1978c38fc572dacae8454a05df12d966f140874044bd7f30e7803e9a718df0050f67c6e5804f7 SHA512 78b1171e197d23c8ba7710aefc2420a91c79cf1c2b7ae27b5fe111a44829a899e8d8cc2c4ca203ce8340f1cf7f1b010249096390ac203d8253ae9ceff41f5db0
 DIST rustc-1.29.0-src.tar.gz 106092915 BLAKE2B 520bbbc49b130229e24a130cb7626184c9c06dfa07b50366d602e76e0005db2f996e7fc0da23de19e67783286caffaf4cb4ef830179f8e42efda1fed1542b248 SHA512 3c6b79cce5a42553bc4360591c6e6b42b36f035243b8cb688a0d4b08c10793e59d257bf9e781c9345c92f765a63a9e161e3e3346f02ddc733e4b401cb5aeb302
 DIST rustc-1.30.0-src.tar.gz 149490609 BLAKE2B 7b9403e40573b7bef82b850ed63a80fb75fed8839761de6da3a518584d2175ec681fb22b47b9a4bcd6fb7069c75e21821fc8fe1e9458f9e5c25ed7a56a553517 SHA512 a4737727818397a26974449e9e7ddc09ae7430a08102ae05729317b19675fa89ad82a8f5bc5b7c913d894866a30dfe3c539c80e29c2b0ade6ecde06db8216981
 DIST rustc-1.31.1-src.tar.gz 151163848 BLAKE2B 4d5712a4c85b49167577ecf5191792d9f437780c2c5dfecdb2582c5e49cfec8f6e6a92664e96a7fd552003eec9c2d6a9042ca1d17d9ba7dd00c6f5bfd74098a0 SHA512 76ca238c40694abab4982f4b788a0da34bbb3d8a6e4adb50b0b9138876407ac2cb4fc39cde057b8fa32729c543c5977d392167e96b82f76a01af31eaafe463cf
@@ -18,3 +18,4 @@
 DIST rustc-1.44.1-src.tar.gz 136760887 BLAKE2B 0aa9a7cccefc3283c8ee51d214390de01083d97daaaf218013c6f4bcfcdeb25157e6f6afa5365d3db4121022c5cc3bec98c26f656025697da390ba5151cf26e8 SHA512 f6b719a2a63aa96a192a098f58ff1042251cee96a1ff742ecb09d5b88fe5be79bc7023f118e0a6c0d46aa1c819ff77274ab669668f8e53efa4eb5e3041227928
 DIST rustc-1.45.2-src.tar.gz 141671717 BLAKE2B 703d8208fef22acfd232626ad2ea661408745e604a8844eb5a6971e34bf065cd8eb52da43f7a193ae1a4788e6617801f64884b3f0f6c2ca1e4ab1533b4c6d460 SHA512 5996f899d3677dd73487561d95b0bee6d6e33f7087f40806fa8176d685de9e6d42974344c855402a9fc634c0e91e0df6e33fcb3194b3e4296e1a1cb49defb98e
 DIST rustc-1.46.0-src.tar.gz 149449054 BLAKE2B de01c934b795c01955e665fb9be815bfd75471921c3839f89954e8e91c335dc988a943025cdedde26b988e898d944776848e3869c06de78e34da8f1cb825400e SHA512 5c50f449930473577b1ffb5791e6a688394821b368873f788a7d6c984055500a01897523930b763a454982f31d0a2fd4e87dfe5c416dd83ec9c844017e92b98e
+DIST rustc-1.47.0-src.tar.gz 151861620 BLAKE2B 8fef2e63ac98b44f4a74ad68c7225851d7f382aca573f9e0cab89131eea38c1f1b38c8cc267856cd2fe401621af8f7cc53fa24281365a535b0d70b32463adcb0 SHA512 a6df9e2d599806eeddbfb35f7dea976781533f63d369a765b8a304221281c9f9e642ff952978f69eaaa0b28740ab5ea566b35ce481097c37fd5117bfec1f43dd
diff --git a/dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-8ddb05-invalid-output-constraint.patch b/dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-8ddb05-invalid-output-constraint.patch
similarity index 100%
rename from dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-8ddb05-invalid-output-constraint.patch
rename to dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-8ddb05-invalid-output-constraint.patch
diff --git a/dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-cc.patch b/dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-cc.patch
similarity index 100%
rename from dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-cc.patch
rename to dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-cc.patch
diff --git a/dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-compilation-fixes.patch b/dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-compilation-fixes.patch
similarity index 100%
rename from dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-compilation-fixes.patch
rename to dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-compilation-fixes.patch
diff --git a/dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-libc++.patch b/dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-libc++.patch
similarity index 100%
rename from dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-libc++.patch
rename to dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-libc++.patch
diff --git a/dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-libgit2-sys-pkg-config.patch b/dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-libgit2-sys-pkg-config.patch
similarity index 100%
rename from dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-libgit2-sys-pkg-config.patch
rename to dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-libgit2-sys-pkg-config.patch
diff --git a/dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-no-curl.patch b/dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-no-curl.patch
similarity index 100%
rename from dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-no-curl.patch
rename to dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-no-curl.patch
diff --git a/dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-printf.patch b/dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-printf.patch
similarity index 100%
rename from dev-lang/rust-bootstrap/files/rust-bootstrap-1.46.0-printf.patch
rename to dev-lang/rust-bootstrap/files/rust-bootstrap-1.47.0-printf.patch
diff --git a/dev-lang/rust-bootstrap/rust-bootstrap-1.46.0.ebuild b/dev-lang/rust-bootstrap/rust-bootstrap-1.47.0.ebuild
similarity index 99%
rename from dev-lang/rust-bootstrap/rust-bootstrap-1.46.0.ebuild
rename to dev-lang/rust-bootstrap/rust-bootstrap-1.47.0.ebuild
index 11c02ba..5467f91 100644
--- a/dev-lang/rust-bootstrap/rust-bootstrap-1.46.0.ebuild
+++ b/dev-lang/rust-bootstrap/rust-bootstrap-1.47.0.ebuild
@@ -51,6 +51,7 @@
 	1.43.1
 	1.44.1
 	1.45.2
+	1.46.0
 )
 # When not using fullbootstrap, use this version as a starting point.
 PREBUILT_VERSION="${RUSTC_FULL_BOOTSTRAP_SEQUENCE[-1]}"
diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
index e146dca..24a05f2 100644
--- a/dev-lang/rust/Manifest
+++ b/dev-lang/rust/Manifest
@@ -1,8 +1,2 @@
-DIST cargo-0.46.1-x86_64-unknown-linux-gnu.tar.gz 7235571 BLAKE2B 6d0b64055dd7aa846b7581ab35f4071d30f2bf6e5be838bce4e31e9d42cf89c09ff118277eb6feadad5a168fe7b0460201ccc47fbc4f10bab272d761272bff83 SHA512 edddda8921e4bdcc7a27250f9e6f20f884ec6af9089f6b0f72d7793136d42e430b777e34b285e42d25b70c4374ec8b3db74baadba1283123c0a73a8b42c93e8d
-DIST cargo-0.47.0-x86_64-unknown-linux-gnu.tar.gz 7236297 BLAKE2B a1f11eb5433cd50fcc06df7e8bd54ac2d630f4e1032acd0509d07be48f9174333a9a4f74dbb8d88e41389bc3c787073a7d40e37deaf1a2595a4155bd8ee153cc SHA512 182aad22ac4115839c4356e12997effd6dd67958637e85a6be431d359658a1d702e1083ca49605610592cbd7bd7069dddcaf37ba9afb23baac3a51156ce9ebe4
-DIST rust-std-1.45.2-x86_64-unknown-linux-gnu.tar.gz 26069244 BLAKE2B ae1344ac16f8f9edf8a2e20cf5ea9187c4db79575b6f42b887bfb382f4f5a21e09874a4d322c69a533aff4cb25097e0e19b339d2e1059274d73564714c6e8a77 SHA512 2d0ad09a0c0d1052e59ba29bdc9c0e3e5de0ba38099ecb838923fc75ac124b36066e4c5b9e45f2f373678f38cdd8367eb41d6058186be0b2d8387806e3c1c293
-DIST rust-std-1.46.0-x86_64-unknown-linux-gnu.tar.gz 26310833 BLAKE2B ffcb43b4e1372603c24307461dd7ed5fe9fc06a9f55397350dcbb93c1e838d8855c209e07a205424170bd77795db1d14f20c45d11861e7150cad8f55ac82d901 SHA512 0291f64bb01ca02dbfa8e25c23ff1c90ffc431e8455244e366bc1e88ce3db9ff5de452f744692b5bb3e9c34c50308fe11997737566f378ec3c09ac4345889c8a
-DIST rustc-1.45.2-x86_64-unknown-linux-gnu.tar.gz 73910606 BLAKE2B 4214f11668aca46e4262e459bea75bd95c770c3188ef48e756af03ee6d7a9d0e711a4f0d63de766b9bc8ab3e9e503d75a13f119d28ea7d714c63bdf89d5a7808 SHA512 34e96e7da38e1eec503507a26d4d75d38ef4a6d9dad03afe771d9fd7a79c8dfe430a503101ca311476d2aa260dbd7e984c631fb55ecc6004422962593d57fea6
-DIST rustc-1.46.0-src.tar.gz 149449054 BLAKE2B de01c934b795c01955e665fb9be815bfd75471921c3839f89954e8e91c335dc988a943025cdedde26b988e898d944776848e3869c06de78e34da8f1cb825400e SHA512 5c50f449930473577b1ffb5791e6a688394821b368873f788a7d6c984055500a01897523930b763a454982f31d0a2fd4e87dfe5c416dd83ec9c844017e92b98e
-DIST rustc-1.46.0-x86_64-unknown-linux-gnu.tar.gz 76990308 BLAKE2B 6680f68c27d4ec8d961b3187fa47289129a1598b3f0ca1bdd40c0fde114ae65c596ea0f1a29f3d76317ce0ad4d45da9ef45de5cc6cc9feb10b3be4e08907601d SHA512 fb214be2f1008955d5722eb85189d733574326e4d43e3d701d3f58235a6ce82fdcfd6aa7f5d7101003ebf29589a8854cba280051298b7c63e19a08f459567ce3
 DIST rustc-1.47.0-src.tar.gz 151861620 BLAKE2B 8fef2e63ac98b44f4a74ad68c7225851d7f382aca573f9e0cab89131eea38c1f1b38c8cc267856cd2fe401621af8f7cc53fa24281365a535b0d70b32463adcb0 SHA512 a6df9e2d599806eeddbfb35f7dea976781533f63d369a765b8a304221281c9f9e642ff952978f69eaaa0b28740ab5ea566b35ce481097c37fd5117bfec1f43dd
+DIST rustc-1.48.0-src.tar.gz 154487032 BLAKE2B 64a40068036516c887daabf75c31ca6fbca214c5e5b77cc9eb9b5242337309679906e2c8a3b06e52afb5a6df7b1670bc8c6b9e79f9239564131124cf3fe53596 SHA512 e28e5f0813cfd94fb92399a2d64aa19bdf0933b5fc768ea10da2a5b787c94bac6a5efb98b2c3702da3d1c46c6766b157df3727e5845b4b83a237b44ec45b27ba
diff --git a/dev-lang/rust/files/rust-1.46.0-Revert-CMake-Unconditionally-add-.h-and-.td-files-to.patch b/dev-lang/rust/files/rust-1.46.0-Revert-CMake-Unconditionally-add-.h-and-.td-files-to.patch
deleted file mode 100644
index 5f6c3a5..0000000
--- a/dev-lang/rust/files/rust-1.46.0-Revert-CMake-Unconditionally-add-.h-and-.td-files-to.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 0d2bca57088e9024760c5b0629e7b2df021a4020 Mon Sep 17 00:00:00 2001
-From: Zach Reizner <zachr@google.com>
-Date: Wed, 23 Jan 2019 14:48:27 -0800
-Subject: [PATCH] Revert "[CMake] Unconditionally add .h and .td files to
- target sources"
-
-This reverts commit 6fb010f388bb2cb2f00fe039123092308ac4865d.
-
-Reason for revert: LLVM includes /usr/include/demangle.h which is not installed.
-
-BUG=chromium:924647
-TEST=cros tryjob chromiumos-sdk-tryjob
----
- src/llvm/cmake/modules/LLVMProcessSources.cmake | 17 +++++++++--------
- 1 file changed, 9 insertions(+), 8 deletions(-)
-
-diff --git a/src/llvm/cmake/modules/LLVMProcessSources.cmake b/src/llvm/cmake/modules/LLVMProcessSources.cmake
-index 7cbd2863500..f65f31d797c 100644
---- a/src/llvm-project/llvm/cmake/modules/LLVMProcessSources.cmake
-+++ b/src/llvm-project/llvm/cmake/modules/LLVMProcessSources.cmake
-@@ -52,15 +52,16 @@ function(llvm_process_sources OUT_VAR)
-   cmake_parse_arguments(ARG "" "" "ADDITIONAL_HEADERS;ADDITIONAL_HEADER_DIRS" ${ARGN})
-   set(sources ${ARG_UNPARSED_ARGUMENTS})
-   llvm_check_source_file_list( ${sources} )
--  
--  # This adds .td and .h files to the Visual Studio solution:
--  add_td_sources(sources)
--  find_all_header_files(hdrs "${ARG_ADDITIONAL_HEADER_DIRS}")
--  if (hdrs)
--    set_source_files_properties(${hdrs} PROPERTIES HEADER_FILE_ONLY ON)
-+  if( LLVM_ENABLE_IDE )
-+    # This adds .td and .h files to the Visual Studio solution:
-+    add_td_sources(sources)
-+    find_all_header_files(hdrs "${ARG_ADDITIONAL_HEADER_DIRS}")
-+    if (hdrs)
-+      set_source_files_properties(${hdrs} PROPERTIES HEADER_FILE_ONLY ON)
-+    endif()
-+    set_source_files_properties(${ARG_ADDITIONAL_HEADERS} PROPERTIES HEADER_FILE_ONLY ON)
-+    list(APPEND sources ${ARG_ADDITIONAL_HEADERS} ${hdrs})
-   endif()
--  set_source_files_properties(${ARG_ADDITIONAL_HEADERS} PROPERTIES HEADER_FILE_ONLY ON)
--  list(APPEND sources ${ARG_ADDITIONAL_HEADERS} ${hdrs})
- 
-   set( ${OUT_VAR} ${sources} PARENT_SCOPE )
- endfunction(llvm_process_sources)
--- 
-2.20.1.321.g9e740568ce-goog
diff --git a/dev-lang/rust/files/rust-1.46.0-sanitizer-supported.patch b/dev-lang/rust/files/rust-1.46.0-sanitizer-supported.patch
deleted file mode 100644
index 72c11606..0000000
--- a/dev-lang/rust/files/rust-1.46.0-sanitizer-supported.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
-index e8ec575ea37..94afa2349f7 100644
---- a/src/bootstrap/native.rs
-+++ b/src/bootstrap/native.rs
-@@ -760,7 +760,7 @@ fn supported_sanitizers(
-         }
-         "x86_64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]),
-         "x86_64-fuchsia" => common_libs("fuchsia", "x86_64", &["asan"]),
--        "x86_64-unknown-linux-gnu" => {
-+        "x86_64-unknown-linux-gnu" | "x86_64-cros-linux-gnu" | "x86_64-pc-linux-gnu" => {
-             common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
-         }
-         _ => Vec::new(),
diff --git a/dev-lang/rust/files/rust-1.48.0-Handle-sparse-git-repo-without-erroring.patch b/dev-lang/rust/files/rust-1.48.0-Handle-sparse-git-repo-without-erroring.patch
new file mode 100644
index 0000000..fe536c9
--- /dev/null
+++ b/dev-lang/rust/files/rust-1.48.0-Handle-sparse-git-repo-without-erroring.patch
@@ -0,0 +1,62 @@
+Cherry-pick of https://github.com/rust-lang/cargo/pull/8775, so that
+cargo works with git worktrees.
+
+diff --git a/src/tools/cargo/src/cargo/sources/path.rs b/src/tools/cargo/src/cargo/sources/path.rs
+index 64b0f77ed..f7dcfee7b 100644
+--- a/src/tools/cargo/src/cargo/sources/path.rs
++++ b/src/tools/cargo/src/cargo/sources/path.rs
+@@ -191,12 +191,25 @@ impl<'cfg> PathSource<'cfg> {
+         let index = repo
+             .index()
+             .chain_err(|| format!("failed to open git index at {}", repo.path().display()))?;
+-        let repo_root = repo.workdir().ok_or_else(|| {
+-            anyhow::format_err!(
++        let repo_root = if let Some(root) = repo.workdir() {
++            root
++        } else if !repo.is_bare() {
++            // Sparse-checkouts (and possibly other git
++            // configurations) make libgit2 confused but there's still
++            // an actual non-bare repo here.
++            if let Some(r) = repo.path().parent() {
++                r
++            } else {
++                return Err(anyhow::format_err!(
++                    "repo path missing .git subfolder even when non-bare",
++                ));
++            }
++        } else {
++            return Err(anyhow::format_err!(
+                 "did not expect repo at {} to be bare",
+                 repo.path().display()
+-            )
+-        })?;
++            ));
++        };
+         let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
+             Ok(p) => p,
+             Err(e) => {
+@@ -225,9 +238,21 @@ impl<'cfg> PathSource<'cfg> {
+     ) -> CargoResult<Vec<PathBuf>> {
+         warn!("list_files_git {}", pkg.package_id());
+         let index = repo.index()?;
+-        let root = repo
+-            .workdir()
+-            .ok_or_else(|| anyhow::format_err!("can't list files on a bare repository"))?;
++        let root = if let Some(root) = repo.workdir() {
++            root
++        } else if !repo.is_bare() {
++            // Sparse-checkouts (and possibly other git
++            // configurations) make libgit2 confused but there's still
++            // an actual non-bare repo here.
++            if let Some(r) = repo.path().parent() {
++                r
++            } else {
++                return Err(anyhow::format_err!("malformed non-bare repository root",));
++            }
++        } else {
++            return Err(anyhow::format_err!("can't list files on a bare repository",));
++        };
++
+         let pkg_path = pkg.root();
+
+         let mut ret = Vec::<PathBuf>::new();
diff --git a/dev-lang/rust/files/rust-1.48.0-Revert-CMake-Unconditionally-add-.h-and-.td-files-to.patch b/dev-lang/rust/files/rust-1.48.0-Revert-CMake-Unconditionally-add-.h-and-.td-files-to.patch
new file mode 100644
index 0000000..da9e10b
--- /dev/null
+++ b/dev-lang/rust/files/rust-1.48.0-Revert-CMake-Unconditionally-add-.h-and-.td-files-to.patch
@@ -0,0 +1,25 @@
+diff --git a/llvm/cmake/modules/LLVMProcessSources.cmake b/llvm/cmake/modules/LLVMProcessSources.cmake
+index ba8dca313c8..b99430c0f30 100644
+--- a/src/llvm-project/llvm/cmake/modules/LLVMProcessSources.cmake
++++ b/src/llvm-project/llvm/cmake/modules/LLVMProcessSources.cmake
+@@ -63,11 +63,15 @@ function(llvm_process_sources OUT_VAR)
+     llvm_check_source_file_list(${sources})
+   endif()
+ 
+-  # This adds .td and .h files to the Visual Studio solution:
+-  add_td_sources(sources)
+-  find_all_header_files(hdrs "${ARG_ADDITIONAL_HEADER_DIRS}")
+-  if (hdrs)
+-    set_source_files_properties(${hdrs} PROPERTIES HEADER_FILE_ONLY ON)
++  if( LLVM_ENABLE_IDE )
++    # This adds .td and .h files to the Visual Studio solution:
++    add_td_sources(sources)
++    find_all_header_files(hdrs "${ARG_ADDITIONAL_HEADER_DIRS}")
++    if (hdrs)
++      set_source_files_properties(${hdrs} PROPERTIES HEADER_FILE_ONLY ON)
++    endif()
++    set_source_files_properties(${ARG_ADDITIONAL_HEADERS} PROPERTIES HEADER_FILE_ONLY ON)
++    list(APPEND sources ${ARG_ADDITIONAL_HEADERS} ${hdrs})
+   endif()
+   set_source_files_properties(${ARG_ADDITIONAL_HEADERS} PROPERTIES HEADER_FILE_ONLY ON)
+   list(APPEND sources ${ARG_ADDITIONAL_HEADERS} ${hdrs})
diff --git a/dev-lang/rust/files/rust-1.46.0-add-cros-targets.patch b/dev-lang/rust/files/rust-1.48.0-add-cros-targets.patch
similarity index 91%
rename from dev-lang/rust/files/rust-1.46.0-add-cros-targets.patch
rename to dev-lang/rust/files/rust-1.48.0-add-cros-targets.patch
index 49e67f4..e8749f7 100644
--- a/dev-lang/rust/files/rust-1.46.0-add-cros-targets.patch
+++ b/dev-lang/rust/files/rust-1.48.0-add-cros-targets.patch
@@ -6,10 +6,10 @@
 target triple vendors (e.g. "cros" or "pc") to the "unknown" variant, so we
 add copies of the relevant cros targets here as well.
 
-diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs
+diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
 index 67f45d3d230..51e0eef6630 100644
---- a/src/librustc_target/spec/mod.rs
-+++ b/src/librustc_target/spec/mod.rs
+--- a/compiler/rustc_target/src/spec/mod.rs
++++ b/compiler/rustc_target/src/spec/mod.rs
 @@ -335,6 +335,8 @@ macro_rules! supported_targets {
  supported_targets! {
      ("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
diff --git a/dev-lang/rust/files/rust-1.46.0-cc.patch b/dev-lang/rust/files/rust-1.48.0-cc.patch
similarity index 91%
rename from dev-lang/rust/files/rust-1.46.0-cc.patch
rename to dev-lang/rust/files/rust-1.48.0-cc.patch
index b2651c1..122bda0 100644
--- a/dev-lang/rust/files/rust-1.46.0-cc.patch
+++ b/dev-lang/rust/files/rust-1.48.0-cc.patch
@@ -1,10 +1,10 @@
 If the CC environment variable is set, use its value instead of hardcoding "cc".
 This fixes crbug.com/1090829.
 
-diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs
+diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
 index 8725bfa..5984569 100644
---- a/src/librustc_codegen_ssa/back/link.rs
-+++ b/src/librustc_codegen_ssa/back/link.rs
+--- a/compiler/rustc_codegen_ssa/src/back/link.rs
++++ b/compiler/rustc_codegen_ssa/src/back/link.rs
 @@ -752,12 +752,12 @@ fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
              (Some(linker), Some(flavor)) => Some((linker, flavor)),
              // only the linker flavor is known; use the default linker for the selected flavor
diff --git a/dev-lang/rust/files/rust-1.46.0-enable-sanitizers.patch b/dev-lang/rust/files/rust-1.48.0-enable-sanitizers.patch
similarity index 61%
rename from dev-lang/rust/files/rust-1.46.0-enable-sanitizers.patch
rename to dev-lang/rust/files/rust-1.48.0-enable-sanitizers.patch
index 4cf9729..5e8df92 100644
--- a/dev-lang/rust/files/rust-1.46.0-enable-sanitizers.patch
+++ b/dev-lang/rust/files/rust-1.48.0-enable-sanitizers.patch
@@ -1,7 +1,16 @@
-diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs
-index 89b548a9c5a..a0e9c2db7ef 100644
---- a/src/librustc_codegen_llvm/attributes.rs
-+++ b/src/librustc_codegen_llvm/attributes.rs
+Sanitizer runtimes are currently behind the `-Z` flag, which is only available
+on nightly builds of the compiler.  We would like to enable fuzzing on chrome
+os anyway so move the sanitizer option under `-C` instead since we don't build
+the toolchain in nightly mode.
+
+The changes this patch makes are:
+ - changing debugging_opts.sanitizer to cg.sanitizer.
+ - add the appropriate options to options.rs.
+
+diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs
+index 73c3481..aa5ddb2 100644
+--- a/compiler/rustc_codegen_llvm/src/attributes.rs
++++ b/compiler/rustc_codegen_llvm/src/attributes.rs
 @@ -46,7 +46,7 @@ fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) {
  /// Apply LLVM sanitize attributes.
  #[inline]
@@ -26,23 +35,27 @@
          return;
      }
  
-diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs
-index eed068e2933..3946be6ab57 100644
---- a/src/librustc_codegen_ssa/back/link.rs
-+++ b/src/librustc_codegen_ssa/back/link.rs
-@@ -781,7 +781,7 @@ fn link_sanitizers(sess: &Session, crate_type: CrateType, linker: &mut dyn Linke
-     if crate_type != CrateType::Executable {
+diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
+index 010fd4e..5d5bab8 100644
+--- a/compiler/rustc_codegen_ssa/src/back/link.rs
++++ b/compiler/rustc_codegen_ssa/src/back/link.rs
+@@ -785,7 +785,7 @@ fn link_sanitizers(sess: &Session, crate_type: CrateType, linker: &mut dyn Linke
          return;
      }
+ 
 -    let sanitizer = sess.opts.debugging_opts.sanitizer;
 +    let sanitizer = sess.opts.cg.sanitizer;
      if sanitizer.contains(SanitizerSet::ADDRESS) {
          link_sanitizer_runtime(sess, linker, "asan");
      }
-@@ -818,7 +818,9 @@ fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) {
+@@ -821,9 +821,13 @@ fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) {
+         }
          "aarch64-fuchsia"
          | "aarch64-unknown-linux-gnu"
++        | "aarch64-cros-linux-gnu"
++        | "armv7a-cros-linux-gnueabihf"
          | "x86_64-fuchsia"
+         | "x86_64-unknown-freebsd"
 -        | "x86_64-unknown-linux-gnu" => {
 +        | "x86_64-unknown-linux-gnu"
 +        | "x86_64-cros-linux-gnu"
@@ -50,7 +63,7 @@
              let filename = format!("librustc{}_rt.{}.a", channel, name);
              let path = default_tlib.join(&filename);
              linker.link_whole_rlib(&path);
-@@ -1589,11 +1591,8 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
+@@ -1532,11 +1536,8 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
  
      // NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER
      if sess.target.target.options.is_like_fuchsia && crate_type == CrateType::Executable {
@@ -64,11 +77,11 @@
          cmd.arg(format!("--dynamic-linker={}ld.so.1", prefix));
      }
  
-diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs
-index 2efbfcb9950..ea97a78b263 100644
---- a/src/librustc_codegen_ssa/back/symbol_export.rs
-+++ b/src/librustc_codegen_ssa/back/symbol_export.rs
-@@ -204,7 +204,7 @@ fn exported_symbols_provider_local(
+diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
+index 51cc1ad..e57a885 100644
+--- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
++++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
+@@ -203,7 +203,7 @@ fn exported_symbols_provider_local(
          }));
      }
  
@@ -77,11 +90,11 @@
          // Similar to profiling, preserve weak msan symbol during LTO.
          const MSAN_WEAK_SYMBOLS: [&str; 2] = ["__msan_track_origins", "__msan_keep_going"];
  
-diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs
-index 23e0b9344ec..47a6dd0492f 100644
---- a/src/librustc_codegen_ssa/back/write.rs
-+++ b/src/librustc_codegen_ssa/back/write.rs
-@@ -195,7 +195,7 @@ impl ModuleConfig {
+diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
+index 0edf0fc..9b1503e 100644
+--- a/compiler/rustc_codegen_ssa/src/back/write.rs
++++ b/compiler/rustc_codegen_ssa/src/back/write.rs
+@@ -194,7 +194,7 @@ impl ModuleConfig {
              ),
              pgo_use: if_regular!(sess.opts.cg.profile_use.clone(), None),
  
@@ -90,24 +103,27 @@
              sanitizer_recover: if_regular!(
                  sess.opts.debugging_opts.sanitizer_recover,
                  SanitizerSet::empty()
-diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs
-index c03be2a8fcd..61041da1b2c 100644
---- a/src/librustc_mir/transform/inline.rs
-+++ b/src/librustc_mir/transform/inline.rs
-@@ -238,7 +238,7 @@ impl Inliner<'tcx> {
- 
-         // Avoid inlining functions marked as no_sanitize if sanitizer is enabled,
-         // since instrumentation might be enabled and performed on the caller.
--        if self.tcx.sess.opts.debugging_opts.sanitizer.intersects(codegen_fn_attrs.no_sanitize) {
-+        if self.tcx.sess.opts.cg.sanitizer.intersects(codegen_fn_attrs.no_sanitize) {
-             return false;
+diff --git a/compiler/rustc_mir/src/transform/inline.rs b/compiler/rustc_mir/src/transform/inline.rs
+index 4e7cacc..63925a5 100644
+--- a/compiler/rustc_mir/src/transform/inline.rs
++++ b/compiler/rustc_mir/src/transform/inline.rs
+@@ -252,9 +252,9 @@ impl Inliner<'tcx> {
          }
  
-diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs
-index c5a866817cb..a9f8c810be9 100644
---- a/src/librustc_session/config.rs
-+++ b/src/librustc_session/config.rs
-@@ -748,7 +748,7 @@ pub fn default_configuration(sess: &Session) -> CrateConfig {
+         let self_no_sanitize =
+-            self.codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.debugging_opts.sanitizer;
++            self.codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.cg.sanitizer;
+         let callee_no_sanitize =
+-            codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.debugging_opts.sanitizer;
++            codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.cg.sanitizer;
+         if self_no_sanitize != callee_no_sanitize {
+             debug!("`callee has incompatible no_sanitize attribute - not inlining");
+             return false;
+diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
+index ab96b03..420724b 100644
+--- a/compiler/rustc_session/src/config.rs
++++ b/compiler/rustc_session/src/config.rs
+@@ -798,7 +798,7 @@ pub fn default_configuration(sess: &Session) -> CrateConfig {
          }
      }
  
@@ -116,11 +132,11 @@
          let symbol = Symbol::intern(&s.to_string());
          ret.insert((sym::sanitize, Some(symbol)));
      }
-diff --git a/src/librustc_session/options.rs b/src/librustc_session/options.rs
-index 2ad7d09cbf4..9613a4bb8cd 100644
---- a/src/librustc_session/options.rs
-+++ b/src/librustc_session/options.rs
-@@ -762,6 +762,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
+diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
+index b705ab6..c8d9cd6 100644
+--- a/compiler/rustc_session/src/options.rs
++++ b/compiler/rustc_session/src/options.rs
+@@ -801,6 +801,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
          "print remarks for these optimization passes (space separated, or \"all\")"),
      rpath: bool = (false, parse_bool, [UNTRACKED],
          "set rpath values in libs/exes (default: no)"),
@@ -129,7 +145,7 @@
      save_temps: bool = (false, parse_bool, [UNTRACKED],
          "save all temporary output files during compilation (default: no)"),
      soft_float: bool = (false, parse_bool, [TRACKED],
-@@ -979,8 +981,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
+@@ -1042,8 +1044,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
      // soon.
      run_dsymutil: bool = (true, parse_bool, [TRACKED],
          "if on Mac, run `dsymutil` and delete intermediate object files (default: yes)"),
@@ -138,11 +154,11 @@
      sanitizer_memory_track_origins: usize = (0, parse_sanitizer_memory_track_origins, [TRACKED],
          "enable origins tracking in MemorySanitizer"),
      sanitizer_recover: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED],
-diff --git a/src/librustc_session/session.rs b/src/librustc_session/session.rs
-index fcd5dab94a6..f43b83b00b1 100644
---- a/src/librustc_session/session.rs
-+++ b/src/librustc_session/session.rs
-@@ -652,7 +652,7 @@ impl Session {
+diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
+index ff5e615..0d61838 100644
+--- a/compiler/rustc_session/src/session.rs
++++ b/compiler/rustc_session/src/session.rs
+@@ -688,7 +688,7 @@ impl Session {
          let more_names = self.opts.output_types.contains_key(&OutputType::LlvmAssembly)
              || self.opts.output_types.contains_key(&OutputType::Bitcode)
              // AddressSanitizer and MemorySanitizer use alloca name when reporting an issue.
@@ -151,48 +167,60 @@
  
          self.opts.debugging_opts.fewer_names || !more_names
      }
-@@ -1018,7 +1018,7 @@ impl Session {
+@@ -1050,7 +1050,7 @@ impl Session {
          self.opts.optimize != config::OptLevel::No
          // AddressSanitizer uses lifetimes to detect use after scope bugs.
          // MemorySanitizer uses lifetimes to detect use of uninitialized stack variables.
 -        || self.opts.debugging_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY)
 +        || self.opts.cg.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY)
      }
- }
  
-@@ -1363,16 +1363,32 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
+     pub fn link_dead_code(&self) -> bool {
+@@ -1496,24 +1496,46 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
+     const ASAN_SUPPORTED_TARGETS: &[&str] = &[
+         "aarch64-fuchsia",
+         "aarch64-unknown-linux-gnu",
++        "aarch64-cros-linux-gnu",
++        "armv7a-cros-linux-gnueabihf",
          "x86_64-apple-darwin",
          "x86_64-fuchsia",
+         "x86_64-unknown-freebsd",
          "x86_64-unknown-linux-gnu",
 +        "x86_64-cros-linux-gnu",
 +        "x86_64-pc-linux-gnu",
-+    ];
-+    const LSAN_SUPPORTED_TARGETS: &[&str] = &[
-+        "aarch64-unknown-linux-gnu",
-+        "x86_64-apple-darwin",
-+        "x86_64-unknown-linux-gnu",
-+        "x86_64-cros-linux-gnu",
-+        "x86_64-pc-linux-gnu",
-+    ];
-+    const MSAN_SUPPORTED_TARGETS: &[&str] = &[
-+        "aarch64-unknown-linux-gnu",
-+        "x86_64-unknown-linux-gnu",
-+        "x86_64-cros-linux-gnu",
-+        "x86_64-pc-linux-gnu",
-+    ];
-+    const TSAN_SUPPORTED_TARGETS: &[&str] = &[
-+        "aarch64-unknown-linux-gnu",
-+        "x86_64-apple-darwin",
-+        "x86_64-unknown-linux-gnu",
-+        "x86_64-cros-linux-gnu",
-+        "x86_64-pc-linux-gnu",
      ];
 -    const LSAN_SUPPORTED_TARGETS: &[&str] =
 -        &["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
 -    const MSAN_SUPPORTED_TARGETS: &[&str] =
--        &["aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu"];
--    const TSAN_SUPPORTED_TARGETS: &[&str] =
--        &["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
+-        &["aarch64-unknown-linux-gnu", "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu"];
++    const LSAN_SUPPORTED_TARGETS: &[&str] = &[
++        "aarch64-unknown-linux-gnu",
++        "aarch64-cros-linux-gnu",
++        "armv7a-cros-linux-gnueabihf",
++        "x86_64-apple-darwin",
++        "x86_64-cros-linux-gnu",
++        "x86_64-pc-linux-gnu",
++        "x86_64-unknown-linux-gnu",
++    ];
++    const MSAN_SUPPORTED_TARGETS: &[&str] = &[
++        "aarch64-unknown-linux-gnu",
++        "aarch64-cros-linux-gnu",
++        "armv7a-cros-linux-gnueabihf",
++        "x86_64-cros-linux-gnu",
++        "x86_64-pc-linux-gnu",
++        "x86_64-unknown-freebsd",
++        "x86_64-unknown-linux-gnu",
++    ];
+     const TSAN_SUPPORTED_TARGETS: &[&str] = &[
+         "aarch64-unknown-linux-gnu",
++        "aarch64-cros-linux-gnu",
++        "armv7a-cros-linux-gnueabihf",
+         "x86_64-apple-darwin",
++        "x86_64-cros-linux-gnu",
++        "x86_64-pc-linux-gnu",
+         "x86_64-unknown-freebsd",
+         "x86_64-unknown-linux-gnu",
+     ];
  
      // Sanitizers can only be used on some tested platforms.
 -    for s in sess.opts.debugging_opts.sanitizer {
@@ -200,7 +228,7 @@
          let supported_targets = match s {
              SanitizerSet::ADDRESS => ASAN_SUPPORTED_TARGETS,
              SanitizerSet::LEAK => LSAN_SUPPORTED_TARGETS,
-@@ -1387,10 +1403,10 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
+@@ -1528,10 +1549,10 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
                  supported_targets.join(", ")
              ));
          }
diff --git a/dev-lang/rust/files/rust-1.46.0-fix-rpath.patch b/dev-lang/rust/files/rust-1.48.0-fix-rpath.patch
similarity index 100%
rename from dev-lang/rust/files/rust-1.46.0-fix-rpath.patch
rename to dev-lang/rust/files/rust-1.48.0-fix-rpath.patch
diff --git a/dev-lang/rust/files/rust-1.46.0-ld-argv0.patch b/dev-lang/rust/files/rust-1.48.0-ld-argv0.patch
similarity index 93%
rename from dev-lang/rust/files/rust-1.46.0-ld-argv0.patch
rename to dev-lang/rust/files/rust-1.48.0-ld-argv0.patch
index d967dba..ac9005b 100644
--- a/dev-lang/rust/files/rust-1.46.0-ld-argv0.patch
+++ b/dev-lang/rust/files/rust-1.48.0-ld-argv0.patch
@@ -3,10 +3,10 @@
 that situation in `current_exe()`, we _should_ have `LD_ARGV0_REL` in an env
 var. This is the path to the _original_ binary, relative to ld.so.
 
-diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
+diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs
 index a9cd509..92dd6b9 100644
---- a/src/libstd/sys/unix/os.rs
-+++ b/src/libstd/sys/unix/os.rs
+--- a/library/std/src/sys/unix/os.rs
++++ b/library/std/src/sys/unix/os.rs
 @@ -327,12 +327,45 @@ pub fn current_exe() -> io::Result<PathBuf> {
  
  #[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
diff --git a/dev-lang/rust/files/rust-1.46.0-no-test-on-build.patch b/dev-lang/rust/files/rust-1.48.0-no-test-on-build.patch
similarity index 100%
rename from dev-lang/rust/files/rust-1.46.0-no-test-on-build.patch
rename to dev-lang/rust/files/rust-1.48.0-no-test-on-build.patch
diff --git a/dev-lang/rust/files/rust-1.48.0-no-weak-symbols.patch b/dev-lang/rust/files/rust-1.48.0-no-weak-symbols.patch
new file mode 100644
index 0000000..82b6176
--- /dev/null
+++ b/dev-lang/rust/files/rust-1.48.0-no-weak-symbols.patch
@@ -0,0 +1,80 @@
+This is a slightly-modified cherrypick from llvm. Without this, we see undefined
+symbols in the CQ for amd64-generic ASAN builds. Specifically, we're missing
+__start_asan_globals and __stop_asan_globals.
+
+commit cf5df40c4cf1a53a02ab1d56a488642e3dda8f6d
+Author: Leonard Chan <leonardchan@google.com>
+Date:   Fri Jul 17 15:29:50 2020 -0700
+
+    Revert "[AddressSanitizer] Don't use weak linkage for __{start,stop}_asan_globals"
+    
+    This reverts commit d76e62fdb7a93d9a33f642b6b528f2562cc3c3f4.
+    
+    Reverting since this can lead to linker errors:
+    
+    ```
+    ld.lld: error: undefined hidden symbol: __start_asan_globals
+    ```
+    
+    when using --gc-sections. The linker can discard __start_asan_globals
+    once there are no more `asan_globals` sections left, which can lead to
+    this error if we have external linkages to them.
+
+diff --git a/src/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/src/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+index ee09a4d9db7..7516a64c6a3 100644
+--- a/src/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
++++ b/src/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+@@ -2103,23 +2103,10 @@ void ModuleAddressSanitizer::InstrumentGlobalsELF(
+     SetComdatForGlobalMetadata(G, Metadata, UniqueModuleId);
+   }
+ 
+-  // This should never be called when there are no globals, by the logic that
+-  // computes the UniqueModuleId string, which is "" when there are no globals.
+-  // It's important that this path is only used when there are actually some
+-  // globals, because that means that there will certainly be a live
+-  // `asan_globals` input section at link time and thus `__start_asan_globals`
+-  // and `__stop_asan_globals` symbols will definitely be defined at link time.
+-  // This means there's no need for the references to them to be weak, which
+-  // enables better code generation because ExternalWeakLinkage implies
+-  // isInterposable() and thus requires GOT indirection for PIC.  Since these
+-  // are known-defined hidden/dso_local symbols, direct PIC accesses without
+-  // dynamic relocation are always sufficient.
+-  assert(!MetadataGlobals.empty());
+-  assert(!UniqueModuleId.empty());
+-
+   // Update llvm.compiler.used, adding the new metadata globals. This is
+   // needed so that during LTO these variables stay alive.
+-  appendToCompilerUsed(M, MetadataGlobals);
++  if (!MetadataGlobals.empty())
++    appendToCompilerUsed(M, MetadataGlobals);
+ 
+   // RegisteredFlag serves two purposes. First, we can pass it to dladdr()
+   // to look up the loaded image that contains it. Second, we can store in it
+@@ -2132,18 +2119,15 @@ void ModuleAddressSanitizer::InstrumentGlobalsELF(
+       ConstantInt::get(IntptrTy, 0), kAsanGlobalsRegisteredFlagName);
+   RegisteredFlag->setVisibility(GlobalVariable::HiddenVisibility);
+ 
+-  // Create start and stop symbols.  These are known to be defined by
+-  // the linker, see comment above.
+-  auto MakeStartStopGV = [&](const char *Prefix) {
+-    GlobalVariable *StartStop =
+-        new GlobalVariable(M, IntptrTy, false, GlobalVariable::ExternalLinkage,
+-                           nullptr, Prefix + getGlobalMetadataSection());
+-    StartStop->setVisibility(GlobalVariable::HiddenVisibility);
+-    assert(StartStop->isImplicitDSOLocal());
+-    return StartStop;
+-  };
+-  GlobalVariable *StartELFMetadata = MakeStartStopGV("__start_");
+-  GlobalVariable *StopELFMetadata = MakeStartStopGV("__stop_");
++  // Create start and stop symbols.
++  GlobalVariable *StartELFMetadata = new GlobalVariable(
++      M, IntptrTy, false, GlobalVariable::ExternalWeakLinkage, nullptr,
++      "__start_" + getGlobalMetadataSection());
++  StartELFMetadata->setVisibility(GlobalVariable::HiddenVisibility);
++  GlobalVariable *StopELFMetadata = new GlobalVariable(
++      M, IntptrTy, false, GlobalVariable::ExternalWeakLinkage, nullptr,
++      "__stop_" + getGlobalMetadataSection());
++  StopELFMetadata->setVisibility(GlobalVariable::HiddenVisibility);
+ 
+   // Create a call to register the globals with the runtime.
+   IRB.CreateCall(AsanRegisterElfGlobals,
diff --git a/dev-lang/rust/files/rust-1.46.0-revert-libunwind-build.patch b/dev-lang/rust/files/rust-1.48.0-revert-libunwind-build.patch
similarity index 85%
rename from dev-lang/rust/files/rust-1.46.0-revert-libunwind-build.patch
rename to dev-lang/rust/files/rust-1.48.0-revert-libunwind-build.patch
index f6a9b6d..b338cb9 100644
--- a/dev-lang/rust/files/rust-1.46.0-revert-libunwind-build.patch
+++ b/dev-lang/rust/files/rust-1.48.0-revert-libunwind-build.patch
@@ -6,10 +6,10 @@
 I'm not sure what exact problem #72746 is supposed to fix, but it's probably incomplete as it breaks the build of 1.46.0 with llvm-libunwind enabled
 
 
-diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs
+diff --git a/library/unwind/build.rs b/library/unwind/build.rs
 index 31d235cf679..d4bcd2ed4e8 100644
---- a/src/libunwind/build.rs
-+++ b/src/libunwind/build.rs
+--- a/library/unwind/build.rs
++++ b/library/unwind/build.rs
 @@ -116,8 +116,6 @@ mod llvm_libunwind {
              cfg.flag("-fstrict-aliasing");
              cfg.flag("-funwind-tables");
diff --git a/dev-lang/rust/files/rust-1.48.0-sanitizer-supported.patch b/dev-lang/rust/files/rust-1.48.0-sanitizer-supported.patch
new file mode 100644
index 0000000..b544821
--- /dev/null
+++ b/dev-lang/rust/files/rust-1.48.0-sanitizer-supported.patch
@@ -0,0 +1,31 @@
+Ensure that sanitizer runtimes are built for all our supported x86_64
+platforms.
+
+Now that we patch in our own custom -cros and -pc targets instead
+of falling back to -unknown, we need to add builds for those
+targets as well to allow the linker to find the correct versions
+of the librustc_[almt]san static libraries.
+
+diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
+index 97d9dbdd63f..d81c5e60608 100644
+--- a/src/bootstrap/native.rs
++++ b/src/bootstrap/native.rs
+@@ -790,13 +790,16 @@ fn supported_sanitizers(
+ 
+     match &*target.triple {
+         "aarch64-fuchsia" => common_libs("fuchsia", "aarch64", &["asan"]),
+-        "aarch64-unknown-linux-gnu" => {
++        "aarch64-unknown-linux-gnu" | "aarch64-cros-linux-gnu" => {
+             common_libs("linux", "aarch64", &["asan", "lsan", "msan", "tsan"])
+         }
++        "armv7a-cros-linux-gnueabihf" => {
++            common_libs("linux", "armhf", &["asan"])
++        }
+         "x86_64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]),
+         "x86_64-fuchsia" => common_libs("fuchsia", "x86_64", &["asan"]),
+         "x86_64-unknown-freebsd" => common_libs("freebsd", "x86_64", &["asan", "msan", "tsan"]),
+-        "x86_64-unknown-linux-gnu" => {
++        "x86_64-unknown-linux-gnu" | "x86_64-cros-linux-gnu" | "x86_64-pc-linux-gnu" => {
+             common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
+         }
+         _ => Vec::new(),
diff --git a/dev-lang/rust/rust-1.46.0-r1.ebuild b/dev-lang/rust/rust-1.48.0.ebuild
similarity index 77%
rename from dev-lang/rust/rust-1.46.0-r1.ebuild
rename to dev-lang/rust/rust-1.48.0.ebuild
index d5048f2..34323cf 100644
--- a/dev-lang/rust/rust-1.46.0-r1.ebuild
+++ b/dev-lang/rust/rust-1.48.0.ebuild
@@ -1,10 +1,10 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
+EAPI=7
 
 PYTHON_COMPAT=( python2_7 )
-inherit python-any-r1 versionator toolchain-funcs
+inherit python-any-r1 toolchain-funcs
 
 if [[ ${PV} = *beta* ]]; then
 	betaver=${PV//*beta}
@@ -14,7 +14,7 @@
 	SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.gz"
 	KEYWORDS=""
 else
-	ABI_VER="$(get_version_component_range 1-2)"
+	ABI_VER="$(ver_cut 1-2)"
 	SLOT="stable/${ABI_VER}"
 	MY_P="rustc-${PV}"
 	SRC="${MY_P}-src.tar.gz"
@@ -22,19 +22,12 @@
 fi
 
 
-STAGE0_VERSION="1.45.2"
-STAGE0_VERSION_CARGO="0.46.1"
-STAGE0_DATE="2020-08-03"
-RUST_STAGE0_amd64="rustc-${STAGE0_VERSION}-x86_64-unknown-linux-gnu"
+BOOTSTRAP_VERSION="1.47.0"
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="http://www.rust-lang.org/"
 
-SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.gz
-	https://static.rust-lang.org/dist/${STAGE0_DATE}/rust-std-${STAGE0_VERSION}-x86_64-unknown-linux-gnu.tar.gz
-	https://static.rust-lang.org/dist/${RUST_STAGE0_amd64}.tar.gz
-	https://static.rust-lang.org/dist/cargo-${STAGE0_VERSION_CARGO}-x86_64-unknown-linux-gnu.tar.gz
-"
+SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.gz"
 
 LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
 
@@ -46,6 +39,7 @@
 	>=dev-lang/perl-5.0
 "
 
+BDEPEND="=dev-lang/rust-bootstrap-${BOOTSTRAP_VERSION}"
 RDEPEND="!dev-util/cargo"
 
 PATCHES=(
@@ -58,13 +52,16 @@
 	"${FILESDIR}/${P}-cc.patch"
 	"${FILESDIR}/${P}-revert-libunwind-build.patch"
 	"${FILESDIR}/${P}-ld-argv0.patch"
+	"${FILESDIR}/${P}-no-weak-symbols.patch"
+	"${FILESDIR}/${P}-Handle-sparse-git-repo-without-erroring.patch"
 )
 
 S="${WORKDIR}/${MY_P}-src"
 
-# This is the list of target triples as they appear in the cros_sdk. If this list gets changed,
-# ensure that each of these values has a corresponding librustc_target/spec file created below
-# and a line referring to it in 0001-add-cros-targets.patch.
+# This is the list of target triples as they appear in the cros_sdk. If this
+# list gets changed, ensure that each of these values has a corresponding
+# compiler/rustc_target/src/spec file created below and a line referring to it
+# in 0001-add-cros-targets.patch.
 RUSTC_TARGET_TRIPLES=(
 	x86_64-pc-linux-gnu
 	x86_64-cros-linux-gnu
@@ -93,23 +90,17 @@
 }
 
 src_prepare() {
-	local stagename="RUST_STAGE0_${ARCH}"
-	local stage0="${!stagename}"
-
-	cp -r "${WORKDIR}"/rust-std-${STAGE0_VERSION}-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu \
-		"${WORKDIR}"/${stage0}/rustc/lib/rustlib || die
-
 	# Copy "unknown" vendor targets to create cros_sdk target triple
 	# variants as referred to in 0001-add-cros-targets.patch and RUSTC_TARGET_TRIPLES.
 	# armv7a is treated specially because the cros toolchain differs in
 	# more than just the vendor part of the target triple. The arch is
 	# armv7a in cros versus armv7.
-	pushd src/librustc_target/spec || die
+	pushd compiler/rustc_target/src/spec || die
 	sed -e 's:"unknown":"pc":g' x86_64_unknown_linux_gnu.rs >x86_64_pc_linux_gnu.rs || die
 	sed -e 's:"unknown":"cros":g' x86_64_unknown_linux_gnu.rs >x86_64_cros_linux_gnu.rs || die
 	sed -e 's:"unknown":"cros":g' armv7_unknown_linux_gnueabihf.rs >armv7a_cros_linux_gnueabihf.rs || die
 	sed -e 's:"unknown":"cros":g' aarch64_unknown_linux_gnu.rs >aarch64_cros_linux_gnu.rs || die
-	popd
+	popd || die
 
 	# The miri tool is built because of 'extended = true' in cros-config.toml,
 	# but the build is busted. See the upstream issue: [https://github.com/rust-
@@ -117,7 +108,7 @@
 	# script eradicates the command that builds it during the bootstrap script.
 	pushd src/bootstrap || die
 	sed -i 's@tool::Miri,@@g' builder.rs
-	popd
+	popd || die
 
 	# Tsk. Tsk. The rust makefile for LLVM's compiler-rt uses -ffreestanding
 	# but one of the files includes <stdlib.h> causing occasional problems
@@ -126,23 +117,18 @@
 	sed -e 's:#include <stdlib.h>:void abort(void);:g' \
 		-i "${ECONF_SOURCE:-.}"/src/llvm-project/compiler-rt/lib/builtins/int_util.c || die
 
-	epatch "${PATCHES[@]}"
-
-	# For the librustc_llvm module, the build will link with -nodefaultlibs and manually choose the
+	# For the rustc_llvm module, the build will link with -nodefaultlibs and manually choose the
 	# std C++ library. For x86_64 Linux, the build script always chooses libstdc++ which will not
 	# work if LLVM was built with USE="default-libcxx". This snippet changes that choice to libc++
 	# in the case that clang++ defaults to libc++.
 	if "${CXX}" -### -x c++ - < /dev/null 2>&1 | grep -q -e '-lc++'; then
-		sed -i 's:"stdc++":"c++":g' src/librustc_llvm/build.rs || die
+		sed -i 's:"stdc++":"c++":g' compiler/rustc_llvm/build.rs || die
 	fi
 
 	default
 }
 
 src_configure() {
-	local stagename="RUST_STAGE0_${ARCH}"
-	local stage0="${!stagename}"
-
 	local targets=""
 	local tt
 	for tt in "${RUSTC_TARGET_TRIPLES[@]}" "${RUSTC_BARE_TARGET_TRIPLES[@]}" ; do
@@ -153,8 +139,8 @@
 	cat > "${config}" <<EOF
 [build]
 target = [${targets}]
-cargo = "${WORKDIR}/cargo-${STAGE0_VERSION_CARGO}-x86_64-unknown-linux-gnu/cargo/bin/cargo"
-rustc = "${WORKDIR}/${stage0}/rustc/bin/rustc"
+cargo = "/opt/rust-bootstrap-${BOOTSTRAP_VERSION}/bin/cargo"
+rustc = "/opt/rust-bootstrap-${BOOTSTRAP_VERSION}/bin/rustc"
 docs = false
 submodules = false
 python = "${EPYTHON}"
@@ -191,7 +177,12 @@
 }
 
 src_compile() {
-	${EPYTHON} x.py build --config cros-config.toml || die
+	${EPYTHON} x.py build --stage 2 --config cros-config.toml || die
+
+	# Remove the src/rust symlink which will be dangling after sources are
+	# removed, and the containing src directory.
+	rm "${S}/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/src/rust" || die
+	rmdir "${S}/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/src" || die
 }
 
 src_install() {
diff --git a/profiles/targets/chromeos/package.provided b/profiles/targets/chromeos/package.provided
index 006f97e..12c1a13 100644
--- a/profiles/targets/chromeos/package.provided
+++ b/profiles/targets/chromeos/package.provided
@@ -134,8 +134,8 @@
 dev-util/boost-build-1.65.0
 
 # We don't need the toolchain itself in the target board.
-dev-lang/rust-1.46.0
 dev-lang/rust-1.47.0
+dev-lang/rust-1.48.0
 
 # We sometimes need ruby for building, but don't yet care about targets.
 dev-lang/ruby-1.9.4
diff --git a/virtual/rust/rust-1.46.0.ebuild b/virtual/rust/rust-1.48.0.ebuild
similarity index 100%
rename from virtual/rust/rust-1.46.0.ebuild
rename to virtual/rust/rust-1.48.0.ebuild