Bug 1777436 - Update builders to rustc 1.62. r=firefox-build-system-reviewers,andi
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 07 Jul 2022 21:49:05 +0000
changeset 623277 35a123b18175403af38be58ea07896766e27a0a3
parent 623276 0259444617f62cb7566096973ad11a7a26f77ac0
child 623278 09bff5f912e1038df4fa26f402f7425e6209648a
push id39951
push userimoraru@mozilla.com
push dateFri, 08 Jul 2022 04:09:57 +0000
treeherdermozilla-central@9d777ac6ab3a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, andi
bugs1777436
milestone104.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1777436 - Update builders to rustc 1.62. r=firefox-build-system-reviewers,andi Differential Revision: https://phabricator.services.mozilla.com/D150733
build/build-rust/cargo-vendor-std.patch
build/build-rust/rust-vendor-std.patch
docs/writing-rust-code/update-policy.md
mozglue/static/rust/build.rs
taskcluster/ci/fetch/toolchains.yml
taskcluster/ci/toolchain/rust.yml
--- a/build/build-rust/cargo-vendor-std.patch
+++ b/build/build-rust/cargo-vendor-std.patch
@@ -4,30 +4,30 @@ component, making -Zbuild-std compatible
 This was originally landed in https://github.com/rust-lang/cargo/pull/8834
 but was backed out for causing breakage in other situations. It works fine
 for Firefox's usecase, though.
 
 Most of these changes just add/edit tests for the functionality. Only the
 change to src/cargo/core/compiler/standard_lib.rs is important.
 
 diff --git a/src/cargo/core/compiler/standard_lib.rs b/src/cargo/core/compiler/standard_lib.rs
-index 0b14df805..7bc5151a4 100644
+index e0baebd51..547b84147 100644
 --- a/src/cargo/core/compiler/standard_lib.rs
 +++ b/src/cargo/core/compiler/standard_lib.rs
-@@ -11,6 +11,7 @@ use crate::ops::{self, Packages};
- use crate::util::errors::CargoResult;
+@@ -12,6 +12,7 @@ use crate::util::errors::CargoResult;
+ use crate::Config;
  use std::collections::{HashMap, HashSet};
  use std::env;
 +use std::fs;
  use std::path::PathBuf;
  
- /// Parse the `-Zbuild-std` flag.
-@@ -39,27 +40,45 @@ pub fn resolve_std<'cfg>(
-     crates: &[String],
- ) -> CargoResult<(PackageSet<'cfg>, Resolve, ResolvedFeatures)> {
+ use super::BuildConfig;
+@@ -74,27 +75,45 @@ pub fn resolve_std<'cfg>(
+     }
+ 
      let src_path = detect_sysroot_src_path(target_data)?;
 -    let to_patch = [
 -        "rustc-std-workspace-core",
 -        "rustc-std-workspace-alloc",
 -        "rustc-std-workspace-std",
 -    ];
 -    let patches = to_patch
 -        .iter()
@@ -249,17 +249,17 @@ diff --git a/tests/testsuite/mock-std/ve
 new file mode 100644
 index 000000000..4465a08a8
 --- /dev/null
 +++ b/tests/testsuite/mock-std/vendor/rustc-std-workspace-std/Cargo.toml
 @@ -0,0 +1 @@
 +this file shouldn't be read 
 \ No newline at end of file
 diff --git a/tests/testsuite/standard_lib.rs b/tests/testsuite/standard_lib.rs
-index b0d42b38d..3bbc49db7 100644
+index 07b038b4a..6393b9ece 100644
 --- a/tests/testsuite/standard_lib.rs
 +++ b/tests/testsuite/standard_lib.rs
 @@ -27,71 +27,18 @@ fn setup() -> Option<Setup> {
          return None;
      }
  
 -    // Our mock sysroot requires a few packages from crates.io, so make sure
 -    // they're "published" to crates.io. Also edit their code a bit to make sure
--- a/build/build-rust/rust-vendor-std.patch
+++ b/build/build-rust/rust-vendor-std.patch
@@ -7,20 +7,20 @@ need to build Rust itself in a vendored/
 fetch anything interesting from crates.io, just the magic fake std/core crates
 that exist to make the build work right. Those crates *are* vendored but
 their contents are ignored in favour of the actual stdlib.
 
 For firefox's purposes, these patches still work fine, and are necessary
 to make -Zbuild-std work in a vendored environment.
 
 diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
-index 802b5c99500..438b76a472b 100644
+index 6181a611ec3..8d99c148dcf 100644
 --- a/src/bootstrap/dist.rs
 +++ b/src/bootstrap/dist.rs
-@@ -847,6 +847,30 @@ fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
+@@ -824,6 +824,30 @@ fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
              builder.copy(&builder.src.join(file), &dst_src.join(file));
          }
  
 +        // libtest includes std and everything else, so vendoring it
 +        // creates exactly what's needed for `cargo -Zbuild-std` or any
 +        // other analysis of the stdlib's source. Cargo also needs help
 +        // finding the lock, so we copy it to libtest temporarily.
 +        //
@@ -42,21 +42,21 @@ index 802b5c99500..438b76a472b 100644
 +        builder.run(&mut cmd);
 +
 +        builder.remove(&temp_lock);
 +
          tarball.generate()
      }
  }
 diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
-index 88fdcfa2d43..293324c17af 100644
+index a4e35bf6d47..cd5e478bed0 100644
 --- a/src/bootstrap/lib.rs
 +++ b/src/bootstrap/lib.rs
-@@ -1179,6 +1179,27 @@ fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, DependencyType)> {
-         paths
+@@ -1418,6 +1418,27 @@ fn tempdir(&self) -> PathBuf {
+         tmp
      }
  
 +    /// Copies a file from `src` to `dst` and doesn't use links, so
 +    /// that the copy can be modified without affecting the original.
 +    pub fn really_copy(&self, src: &Path, dst: &Path) {
 +        if self.config.dry_run {
 +            return;
 +        }
--- a/docs/writing-rust-code/update-policy.md
+++ b/docs/writing-rust-code/update-policy.md
@@ -61,18 +61,18 @@ Here are the Rust versions for each Fire
 | Firefox 95 | Rust 1.56.0 | 1.53.0 | 2021 October 21 | 2021 October 28 | 2021 December 7
 | Firefox 96 | Rust 1.57.0 | 1.53.0 | 2021 December 2 | 2021 December 2 | 2022 January 11
 | Firefox 97 | Rust 1.57.0 | 1.57.0 | 2021 December 2 | 2022 January 6 | 2022 February 8
 | Firefox 98 | Rust 1.58.0 | 1.57.0 | 2022 January 13 | 2022 February 2 | 2022 March 8
 | Firefox 99 | Rust 1.59.0 | 1.57.0 | 2022 February 24 | 2022 March 3 | 2022 April 5
 | Firefox 100 | Rust 1.59.0 | 1.57.0 | 2022 February 24 | 2022 March 31 | 2022 May 3
 | Firefox 101 | Rust 1.60.0 | 1.59.0 | 2022 April 7 | 2022 April 28 | 2022 May 31
 | Firefox 102 | Rust 1.60.0 | 1.59.0 | 2022 April 7 | 2022 May 26 | 2022 June 28
+| Firefox 103 | Rust 1.61.0 | 1.59.0 | 2022 May 19 | 2022 June 23 | 2022 July 27
 | **Estimated** |
-| Firefox 103 | Rust 1.61.0 | ? | 2022 May 19 | 2022 June 23 | 2022 July 27
 | Firefox 104 | Rust 1.62.0 | ? | 2022 June 30 | 2022 July 21 | 2022 August 23
 | Firefox 105 | Rust 1.63.0 | ? | 2022 August 11 | 2022 August 18 | 2022 September 20
 | Firefox 106 | Rust 1.63.0 | ? | 2022 August 11 | 2022 September 15 | 2022 October 18
 | Firefox 107 | Rust 1.64.0 | ? | 2022 September 22 | 2022 October 13 | 2022 November 15
 
 New feature adoption schedule:
 
 | Mozilla-central can use | Starting on (Rust release + 2 weeks) |
--- a/mozglue/static/rust/build.rs
+++ b/mozglue/static/rust/build.rs
@@ -11,17 +11,17 @@ fn main() {
     build.include(mozbuild::TOPOBJDIR.join("js").join("src"));
     build.include(mozbuild::TOPOBJDIR.join("dist").join("include"));
     build.define("MOZ_HAS_MOZGLUE", None);
     build.file("wrappers.cpp");
     build.compile("wrappers");
     println!("cargo:rerun-if-changed=wrappers.cpp");
 
     let ver = version().unwrap();
-    let max_oom_hook_version = Version::parse("1.63.0-alpha").unwrap();
+    let max_oom_hook_version = Version::parse("1.64.0-alpha").unwrap();
 
     if ver < max_oom_hook_version {
         println!("cargo:rustc-cfg=feature=\"oom_with_hook\"");
     } else if std::env::var("MOZ_AUTOMATION").is_ok() {
         panic!("Builds on automation must use a version of rust for which we know how to hook OOM: want < {}, have {}",
                max_oom_hook_version, ver);
     }
 }
--- a/taskcluster/ci/fetch/toolchains.yml
+++ b/taskcluster/ci/fetch/toolchains.yml
@@ -357,32 +357,33 @@ clang-trunk:
     description: clang main branch source code
     attributes:
         cached_task: false
     fetch:
         type: git
         repo: https://github.com/llvm/llvm-project
         branch: main
 
-# This revision currently corresponds to rust nightly-2022-04-05,
-# which is the first nightly with the version 1.62.0,
+# This revision currently corresponds to rust nightly-2022-05-21,
+# which is the first nightly with the version 1.63.0 with a fix
+# for https://github.com/rust-lang/rust/issues/97205,
 # so it should be as close as possible to the behaviour of
-# stable-1.61.0.
+# stable-1.62.0.
 #
 # We use this to build from source, so the resulting non-official
-# artifacts will report their version as "1.62.0-dev", but will otherwise
+# artifacts will report their version as "1.63.0-dev", but will otherwise
 # behave like a nightly build. This means they will allow you to use
 # unstable features like -Zbuild-std and sanitizers.
-rust-1.62.0-dev:
-    description: Rust 1.62.0-dev source code
+rust-1.63.0-dev:
+    description: Rust 1.63.0-dev source code
     fetch:
         type: git
         include-dot-git: true
         repo: https://github.com/rust-lang/rust/
-        revision: 60e50fc1cfe0bb693a5f4f93eb83ef70854531e3
+        revision: e6a4afc3af2d2a53f91fc8a77bdfe94bea375b29
 
 wasi-sdk:
     description: wasi-sdk-16 source code
     fetch:
         type: git
         repo: https://github.com/WebAssembly/wasi-sdk
         revision: 7b7b8a974a31f527d71467499b0d5be3b12f2fa9
 
--- a/taskcluster/ci/toolchain/rust.yml
+++ b/taskcluster/ci/toolchain/rust.yml
@@ -35,20 +35,33 @@ linux64-rust-1.59:
             '--target', 'x86_64-unknown-linux-gnu',
             '--target', 'i686-unknown-linux-gnu',
             '--target', 'aarch64-unknown-linux-gnu',
             '--target', 'wasm32-wasi',
         ]
 
 linux64-rust-1.61:
     treeherder:
+        symbol: TL(rust-1.61)
+    run:
+        arguments: [
+            '--channel', '1.61.0',
+            '--host', 'x86_64-unknown-linux-gnu',
+            '--target', 'x86_64-unknown-linux-gnu',
+            '--target', 'i686-unknown-linux-gnu',
+            '--target', 'aarch64-unknown-linux-gnu',
+            '--target', 'wasm32-wasi',
+        ]
+
+linux64-rust-1.62:
+    treeherder:
         symbol: TL(rust)
     run:
         arguments: [
-            '--channel', '1.61.0',
+            '--channel', '1.62.0',
             '--host', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-unknown-linux-gnu',
             '--target', 'i686-unknown-linux-gnu',
             '--target', 'aarch64-unknown-linux-gnu',
             '--target', 'wasm32-wasi',
             '--compiler-builtins-hack',
         ]
         toolchain-alias: linux64-rust
@@ -68,52 +81,52 @@ linux64-rust-dev:
             '--patch', 'rust-vendor-std.patch',
             '--patch', 'src/tools/cargo:cargo-vendor-std.patch',
             '--channel', 'dev',
             '--host', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-unknown-linux-gnu',
         ]
     fetches:
         fetch:
-            - rust-1.62.0-dev
+            - rust-1.63.0-dev
         toolchain:
             - linux64-clang-toolchain
             - linux64-binutils
 
 
-linux64-rust-cross-1.61:
+linux64-rust-cross-1.62:
     description: "rust repack with macos and windows cross support"
     treeherder:
         symbol: TL(rust-cross)
     run:
         arguments: [
-            '--channel', '1.61.0',
+            '--channel', '1.62.0',
             '--host', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-unknown-linux-gnu',
             '--target', 'i686-unknown-linux-gnu',
             '--target', 'x86_64-apple-darwin',
             '--target', 'aarch64-apple-darwin',
             '--target', 'x86_64-pc-windows-msvc',
             '--target', 'i686-pc-windows-msvc',
             '--target', 'aarch64-pc-windows-msvc',
             '--target', 'armv7-linux-androideabi',
             '--target', 'thumbv7neon-linux-androideabi',
             '--target', 'aarch64-linux-android',
             '--target', 'i686-linux-android',
             '--target', 'x86_64-linux-android',
         ]
         toolchain-alias: linux64-rust-cross
 
-linux64-rust-static-1.61:
+linux64-rust-static-1.62:
     description: "rust repack with static linking support"
     treeherder:
         symbol: TL(rust-static)
     run:
         arguments: [
-            '--channel', '1.61.0',
+            '--channel', '1.62.0',
             '--host', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-unknown-linux-musl',
             '--target', 'i686-unknown-linux-gnu',
             '--target', 'i686-unknown-linux-musl',
         ]
         toolchain-alias: linux64-rust-static
 
@@ -138,25 +151,38 @@ linux64-rust-macos-1.61:
     run:
         arguments: [
             '--channel', '1.61.0',
             '--host', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-apple-darwin',
             '--target', 'aarch64-apple-darwin',
         ]
+
+linux64-rust-macos-1.62:
+    description: "rust repack with macos-cross support"
+    treeherder:
+        symbol: TL(rust-macos-1.62)
+    run:
+        arguments: [
+            '--channel', '1.62.0',
+            '--host', 'x86_64-unknown-linux-gnu',
+            '--target', 'x86_64-unknown-linux-gnu',
+            '--target', 'x86_64-apple-darwin',
+            '--target', 'aarch64-apple-darwin',
+        ]
         toolchain-alias: linux64-rust-macos
 
-linux64-rust-android-1.61:
+linux64-rust-android-1.62:
     description: "rust repack with android-cross support"
     treeherder:
         symbol: TL(rust-android)
     run:
         arguments: [
-            '--channel', '1.61.0',
+            '--channel', '1.62.0',
             '--host', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-unknown-linux-gnu',
             '--target', 'armv7-linux-androideabi',
             '--target', 'thumbv7neon-linux-androideabi',
             '--target', 'aarch64-linux-android',
             '--target', 'i686-linux-android',
             '--target', 'x86_64-linux-android',
             '--compiler-builtins-hack',
@@ -178,20 +204,33 @@ linux64-rust-windows-1.57:
             '--target', 'x86_64-pc-windows-msvc',
             '--target', 'i686-pc-windows-msvc',
         ]
         toolchain-alias: linux64-rust-windows-toolchain
 
 linux64-rust-windows-1.61:
     description: "rust repack with windows-cross support"
     treeherder:
+        symbol: TL(rust-win-1.61)
+    run:
+        arguments: [
+            '--channel', '1.61.0',
+            '--host', 'x86_64-unknown-linux-gnu',
+            '--target', 'x86_64-unknown-linux-gnu',
+            '--target', 'x86_64-pc-windows-msvc',
+            '--target', 'i686-pc-windows-msvc',
+        ]
+
+linux64-rust-windows-1.62:
+    description: "rust repack with windows-cross support"
+    treeherder:
         symbol: TL(rust-win)
     run:
         arguments: [
-            '--channel', '1.61.0',
+            '--channel', '1.62.0',
             '--host', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-unknown-linux-gnu',
             '--target', 'x86_64-pc-windows-msvc',
             '--target', 'i686-pc-windows-msvc',
         ]
         toolchain-alias: linux64-rust-windows
 
 win64-rust-1.57:
@@ -202,45 +241,45 @@ win64-rust-1.57:
             '--channel', '1.57.0',
             '--host', 'x86_64-pc-windows-msvc',
             '--target', 'x86_64-pc-windows-msvc',
             '--target', 'i686-pc-windows-msvc',
             '--target', 'aarch64-pc-windows-msvc',
         ]
         toolchain-alias: win64-rust-toolchain
 
-win64-rust-1.61:
+win64-rust-1.62:
     treeherder:
         symbol: TW64(rust)
     run:
         arguments: [
-            '--channel', '1.61.0',
+            '--channel', '1.62.0',
             '--host', 'x86_64-pc-windows-msvc',
             '--target', 'x86_64-pc-windows-msvc',
             '--target', 'i686-pc-windows-msvc',
             '--target', 'aarch64-pc-windows-msvc',
         ]
         toolchain-alias: win64-rust
 
-macosx64-rust-1.61:
+macosx64-rust-1.62:
     treeherder:
         symbol: TM(rust)
     run:
         arguments: [
-            '--channel', '1.61.0',
+            '--channel', '1.62.0',
             '--host', 'x86_64-apple-darwin',
             '--target', 'x86_64-apple-darwin',
         ]
         toolchain-alias: macosx64-rust
 
-mingw32-rust-1.61:
+mingw32-rust-1.62:
     treeherder:
         symbol: TMW(rust)
     run:
         arguments: [
-            '--channel', '1.61.0',
+            '--channel', '1.62.0',
             '--host', 'x86_64-unknown-linux-gnu',
             '--target', 'i686-unknown-linux-gnu',
             '--target', 'i686-pc-windows-gnu',
             '--target', 'x86_64-pc-windows-gnu',
             '--target', 'x86_64-unknown-linux-gnu',
         ]
         toolchain-alias: mingw32-rust