From bfef6743ce008052e9115636b1f37749069ed710 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 8 Oct 2020 09:36:37 -0400 Subject: [PATCH 01/13] Bump to released compiler --- src/stage0.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stage0.txt b/src/stage0.txt index 0f8fb3b1c9503..2f349564797be 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,7 +12,7 @@ # source tarball for a stable release you'll likely see `1.x.0` for rustc and # `0.(x+1).0` for Cargo where they were released on `date`. -date: 2020-10-06 +date: 2020-10-08 rustc: 1.47.0 cargo: 0.48.0 @@ -40,4 +40,4 @@ cargo: 0.48.0 # looking at a beta source tarball and it's uncommented we'll shortly comment it # out. -dev: 1 +#dev: 1 From e9d0e3c6c9b16cc028ce3b0ba6703574e5a356c8 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 30 Sep 2020 13:54:12 +0200 Subject: [PATCH 02/13] bootstrap: add ./x.py run src/tools/build-manifest --- src/bootstrap/builder.rs | 2 +- src/bootstrap/dist.rs | 2 +- src/bootstrap/run.rs | 42 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 4beeb9c87c4fd..3de5797180cf2 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -477,7 +477,7 @@ impl<'a> Builder<'a> { install::Src, install::Rustc ), - Kind::Run => describe!(run::ExpandYamlAnchors,), + Kind::Run => describe!(run::ExpandYamlAnchors, run::BuildManifest,), } } diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index c846662fd5126..8cdd293239ec3 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -46,7 +46,7 @@ pub fn pkgname(builder: &Builder<'_>, component: &str) -> String { } } -fn distdir(builder: &Builder<'_>) -> PathBuf { +pub(crate) fn distdir(builder: &Builder<'_>) -> PathBuf { builder.out.join("dist") } diff --git a/src/bootstrap/run.rs b/src/bootstrap/run.rs index ba593cadbad81..80c093e713eff 100644 --- a/src/bootstrap/run.rs +++ b/src/bootstrap/run.rs @@ -1,5 +1,7 @@ use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::dist::distdir; use crate::tool::Tool; +use build_helper::output; use std::process::Command; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -41,3 +43,43 @@ fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool { } true } + +#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] +pub struct BuildManifest; + +impl Step for BuildManifest { + type Output = (); + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/tools/build-manifest") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(BuildManifest); + } + + fn run(self, builder: &Builder<'_>) { + // This gets called by `promote-release` + // (https://github.com/rust-lang/promote-release). + let mut cmd = builder.tool_cmd(Tool::BuildManifest); + let sign = builder.config.dist_sign_folder.as_ref().unwrap_or_else(|| { + panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n") + }); + let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| { + panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n") + }); + + let today = output(Command::new("date").arg("+%Y-%m-%d")); + + cmd.arg(sign); + cmd.arg(distdir(builder)); + cmd.arg(today.trim()); + cmd.arg(addr); + cmd.arg(&builder.config.channel); + cmd.arg(&builder.src); + + builder.create_dir(&distdir(builder)); + builder.run(&mut cmd); + } +} From 799c5b6ec35bd9c2495c56f810194e2dd9f375a8 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 30 Sep 2020 14:26:10 +0200 Subject: [PATCH 03/13] build-manifest: keep legacy behavior when invoking through ./x.py dist --- src/bootstrap/dist.rs | 1 + src/tools/build-manifest/README.md | 3 +-- src/tools/build-manifest/src/main.rs | 37 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 8cdd293239ec3..857e06d846de4 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -2371,6 +2371,7 @@ impl Step for HashSign { cmd.arg(addr); cmd.arg(&builder.config.channel); cmd.arg(&builder.src); + cmd.env("BUILD_MANIFEST_LEGACY", "1"); builder.create_dir(&distdir(builder)); diff --git a/src/tools/build-manifest/README.md b/src/tools/build-manifest/README.md index 4d7d9f7da1874..26e96c9fd8fda 100644 --- a/src/tools/build-manifest/README.md +++ b/src/tools/build-manifest/README.md @@ -20,8 +20,7 @@ Then, you can generate the manifest and all the packages from `path/to/dist` to `path/to/output` with: ``` -$ BUILD_MANIFEST_DISABLE_SIGNING=1 cargo +nightly run \ - path/to/dist path/to/output 1970-01-01 http://example.com \ +$ cargo +nightly run path/to/dist path/to/output 1970-01-01 http://example.com \ CHANNEL path/to/rust/repo ``` diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index e1dc9111bf326..6d965fcd5eece 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -232,26 +232,27 @@ struct Builder { input: PathBuf, output: PathBuf, - gpg_passphrase: String, digests: BTreeMap, s3_address: String, date: String, - should_sign: bool, + legacy: bool, + legacy_gpg_passphrase: String, } fn main() { - // Avoid signing packages while manually testing - // Do NOT set this envvar in CI - let should_sign = env::var("BUILD_MANIFEST_DISABLE_SIGNING").is_err(); - - // Safety check to ensure signing is always enabled on CI - // The CI environment variable is set by both Travis and AppVeyor - if !should_sign && env::var("CI").is_ok() { - println!("The 'BUILD_MANIFEST_DISABLE_SIGNING' env var can't be enabled on CI."); - println!("If you're not running this on CI, unset the 'CI' env var."); - panic!(); - } + // Up until Rust 1.48 the release process relied on build-manifest to create the SHA256 + // checksums of released files and to sign the tarballs. That was moved over to promote-release + // in time for the branching of Rust 1.48, but the old release process still had to work the + // old way. + // + // When running build-manifest through the old ./x.py dist hash-and-sign the environment + // variable will be set, enabling the legacy behavior of generating the .sha256 files and + // signing the tarballs. + // + // Once the old release process is fully decommissioned, the environment variable, all the + // related code in this tool and ./x.py dist hash-and-sign can be removed. + let legacy = env::var("BUILD_MANIFEST_LEGACY").is_ok(); let mut args = env::args().skip(1); let input = PathBuf::from(args.next().unwrap()); @@ -263,7 +264,7 @@ fn main() { // Do not ask for a passphrase while manually testing let mut passphrase = String::new(); - if should_sign { + if legacy { // `x.py` passes the passphrase via stdin. t!(io::stdin().read_to_string(&mut passphrase)); } @@ -273,12 +274,12 @@ fn main() { input, output, - gpg_passphrase: passphrase, digests: BTreeMap::new(), s3_address, date, - should_sign, + legacy, + legacy_gpg_passphrase: passphrase, } .build(); } @@ -608,7 +609,7 @@ impl Builder { } fn sign(&self, path: &Path) { - if !self.should_sign { + if !self.legacy { return; } @@ -631,7 +632,7 @@ impl Builder { .arg(path) .stdin(Stdio::piped()); let mut child = t!(cmd.spawn()); - t!(child.stdin.take().unwrap().write_all(self.gpg_passphrase.as_bytes())); + t!(child.stdin.take().unwrap().write_all(self.legacy_gpg_passphrase.as_bytes())); assert!(t!(child.wait()).success()); } From a7c8e7963f19511517e85c32ea48aa7598393467 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 30 Sep 2020 14:40:38 +0200 Subject: [PATCH 04/13] build-manifest: split the manifest struct definition in a separate file --- src/tools/build-manifest/src/main.rs | 54 +----------------------- src/tools/build-manifest/src/manifest.rs | 53 +++++++++++++++++++++++ 2 files changed, 55 insertions(+), 52 deletions(-) create mode 100644 src/tools/build-manifest/src/manifest.rs diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 6d965fcd5eece..a80f353a6e639 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -4,10 +4,11 @@ //! via `x.py dist hash-and-sign`; the cmdline arguments are set up //! by rustbuild (in `src/bootstrap/dist.rs`). +mod manifest; mod versions; +use crate::manifest::{Component, Manifest, Package, Rename, Target}; use crate::versions::{PkgType, Versions}; -use serde::Serialize; use std::collections::BTreeMap; use std::collections::HashMap; use std::env; @@ -167,57 +168,6 @@ static MINGW: &[&str] = &["i686-pc-windows-gnu", "x86_64-pc-windows-gnu"]; static NIGHTLY_ONLY_COMPONENTS: &[&str] = &["miri-preview", "rust-analyzer-preview"]; -#[derive(Serialize)] -#[serde(rename_all = "kebab-case")] -struct Manifest { - manifest_version: String, - date: String, - pkg: BTreeMap, - renames: BTreeMap, - profiles: BTreeMap>, -} - -#[derive(Serialize)] -struct Package { - version: String, - git_commit_hash: Option, - target: BTreeMap, -} - -#[derive(Serialize)] -struct Rename { - to: String, -} - -#[derive(Serialize, Default)] -struct Target { - available: bool, - url: Option, - hash: Option, - xz_url: Option, - xz_hash: Option, - components: Option>, - extensions: Option>, -} - -impl Target { - fn unavailable() -> Self { - Self::default() - } -} - -#[derive(Serialize)] -struct Component { - pkg: String, - target: String, -} - -impl Component { - fn from_str(pkg: &str, target: &str) -> Self { - Self { pkg: pkg.to_string(), target: target.to_string() } - } -} - macro_rules! t { ($e:expr) => { match $e { diff --git a/src/tools/build-manifest/src/manifest.rs b/src/tools/build-manifest/src/manifest.rs new file mode 100644 index 0000000000000..4e1890d06c159 --- /dev/null +++ b/src/tools/build-manifest/src/manifest.rs @@ -0,0 +1,53 @@ +use serde::Serialize; +use std::collections::BTreeMap; + +#[derive(Serialize)] +#[serde(rename_all = "kebab-case")] +pub(crate) struct Manifest { + pub(crate) manifest_version: String, + pub(crate) date: String, + pub(crate) pkg: BTreeMap, + pub(crate) renames: BTreeMap, + pub(crate) profiles: BTreeMap>, +} + +#[derive(Serialize)] +pub(crate) struct Package { + pub(crate) version: String, + pub(crate) git_commit_hash: Option, + pub(crate) target: BTreeMap, +} + +#[derive(Serialize)] +pub(crate) struct Rename { + pub(crate) to: String, +} + +#[derive(Serialize, Default)] +pub(crate) struct Target { + pub(crate) available: bool, + pub(crate) url: Option, + pub(crate) hash: Option, + pub(crate) xz_url: Option, + pub(crate) xz_hash: Option, + pub(crate) components: Option>, + pub(crate) extensions: Option>, +} + +impl Target { + pub(crate) fn unavailable() -> Self { + Self::default() + } +} + +#[derive(Serialize)] +pub(crate) struct Component { + pub(crate) pkg: String, + pub(crate) target: String, +} + +impl Component { + pub(crate) fn from_str(pkg: &str, target: &str) -> Self { + Self { pkg: pkg.to_string(), target: target.to_string() } + } +} From d43d717b73026c8fac0f4ccc47f9dd01e1f526b0 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 1 Oct 2020 17:02:47 +0200 Subject: [PATCH 05/13] build-manifest: move generating a target to the manifest mod --- src/tools/build-manifest/src/main.rs | 59 ++++++++---------------- src/tools/build-manifest/src/manifest.rs | 36 +++++++++++++++ 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index a80f353a6e639..89b658d901f7b 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -9,8 +9,7 @@ mod versions; use crate::manifest::{Component, Manifest, Package, Rename, Target}; use crate::versions::{PkgType, Versions}; -use std::collections::BTreeMap; -use std::collections::HashMap; +use std::collections::{BTreeMap, HashMap}; use std::env; use std::fs::{self, File}; use std::io::{self, Read, Write}; @@ -389,9 +388,12 @@ impl Builder { fn target_host_combination(&mut self, host: &str, manifest: &Manifest) -> Option { let filename = self.versions.tarball_name(&PkgType::Rust, host).unwrap(); - let digest = self.digests.remove(&filename)?; - let xz_filename = filename.replace(".tar.gz", ".tar.xz"); - let xz_digest = self.digests.remove(&xz_filename); + + let mut target = Target::from_compressed_tar(self, &filename); + if !target.available { + return None; + } + let mut components = Vec::new(); let mut extensions = Vec::new(); @@ -447,15 +449,9 @@ impl Builder { extensions.retain(&has_component); components.retain(&has_component); - Some(Target { - available: true, - url: Some(self.url(&filename)), - hash: Some(digest), - xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)), - xz_hash: xz_digest, - components: Some(components), - extensions: Some(extensions), - }) + target.components = Some(components); + target.extensions = Some(extensions); + Some(target) } fn profile( @@ -493,37 +489,19 @@ impl Builder { let targets = targets .iter() .map(|name| { - if is_present { - // The component generally exists, but it might still be missing for this target. + let target = if is_present { let filename = self .versions .tarball_name(&PkgType::from_component(pkgname), name) .unwrap(); - let digest = match self.digests.remove(&filename) { - Some(digest) => digest, - // This component does not exist for this target -- skip it. - None => return (name.to_string(), Target::unavailable()), - }; - let xz_filename = filename.replace(".tar.gz", ".tar.xz"); - let xz_digest = self.digests.remove(&xz_filename); - - ( - name.to_string(), - Target { - available: true, - url: Some(self.url(&filename)), - hash: Some(digest), - xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)), - xz_hash: xz_digest, - components: None, - extensions: None, - }, - ) + + Target::from_compressed_tar(self, &filename) } else { // If the component is not present for this build add it anyway but mark it as // unavailable -- this way rustup won't allow upgrades without --force - (name.to_string(), Target::unavailable()) - } + Target::unavailable() + }; + (name.to_string(), target) }) .collect(); @@ -537,8 +515,9 @@ impl Builder { ); } - fn url(&self, filename: &str) -> String { - format!("{}/{}/{}", self.s3_address, self.date, filename) + fn url(&self, path: &Path) -> String { + let file_name = path.file_name().unwrap().to_str().unwrap(); + format!("{}/{}/{}", self.s3_address, self.date, file_name) } fn hash(&self, path: &Path) -> String { diff --git a/src/tools/build-manifest/src/manifest.rs b/src/tools/build-manifest/src/manifest.rs index 4e1890d06c159..2a5755c1bf1da 100644 --- a/src/tools/build-manifest/src/manifest.rs +++ b/src/tools/build-manifest/src/manifest.rs @@ -1,5 +1,7 @@ +use crate::Builder; use serde::Serialize; use std::collections::BTreeMap; +use std::path::{Path, PathBuf}; #[derive(Serialize)] #[serde(rename_all = "kebab-case")] @@ -35,6 +37,40 @@ pub(crate) struct Target { } impl Target { + pub(crate) fn from_compressed_tar(builder: &Builder, base_path: &str) -> Self { + let base_path = builder.input.join(base_path); + let gz = Self::tarball_variant(&base_path, "gz"); + let xz = Self::tarball_variant(&base_path, "xz"); + + if gz.is_none() { + return Self::unavailable(); + } + + Self { + available: true, + components: None, + extensions: None, + // .gz + url: gz.as_ref().map(|path| builder.url(path)), + hash: gz.map(|path| Self::digest_of(builder, &path)), + // .xz + xz_url: xz.as_ref().map(|path| builder.url(path)), + xz_hash: xz.map(|path| Self::digest_of(builder, &path)), + } + } + + fn tarball_variant(base: &Path, ext: &str) -> Option { + let mut path = base.to_path_buf(); + path.set_extension(ext); + if path.is_file() { Some(path) } else { None } + } + + fn digest_of(builder: &Builder, path: &Path) -> String { + // TEMPORARY CODE -- DON'T REVIEW :) + let file_name = path.file_name().unwrap().to_str().unwrap(); + builder.digests.get(file_name).unwrap().clone() + } + pub(crate) fn unavailable() -> Self { Self::default() } From cfc8d814bbc88f9540e748e3be07fdc6d4e930ad Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 1 Oct 2020 17:15:12 +0200 Subject: [PATCH 06/13] build-manifest: calculate checksums lazily and in parallel This commit improves the way build-manifest calculates the checksums included in the manifest, speeding it up: * Instead of calculating all the hashes beforehand and then using the ones we need, the manifest is first generated with placeholder hashes, and then a function walks through the manifest and calculates only the needed checksums. * Calculating the checksums is now done in parallel with rayon, to better utilize all the available disk bandwidth. * Calculating the checksums now uses the sha2 crate instead of the sha256sum CLI tool: this avoids the overhead of calling another process, but more importantly uses hardware acceleration whenever available (the CLI tool doesn't support it at all). --- Cargo.lock | 72 +++++++++++++++++++++--- src/tools/build-manifest/Cargo.toml | 3 + src/tools/build-manifest/src/main.rs | 71 +++++++++++++++++++---- src/tools/build-manifest/src/manifest.rs | 47 ++++++++++++---- 4 files changed, 164 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 28bd57ef6735c..649972e61d7e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -183,7 +183,16 @@ dependencies = [ "block-padding", "byte-tools", "byteorder", - "generic-array", + "generic-array 0.12.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.4", ] [[package]] @@ -233,8 +242,11 @@ version = "0.1.0" dependencies = [ "anyhow", "flate2", + "hex 0.4.2", + "rayon", "serde", "serde_json", + "sha2", "tar", "toml", ] @@ -687,6 +699,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a21fa21941700a3cd8fcb4091f361a6a712fac632f85d9f487cc892045d55c6" +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + [[package]] name = "crates-io" version = "0.31.1" @@ -884,7 +902,16 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array", + "generic-array 0.12.3", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", ] [[package]] @@ -1166,6 +1193,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getopts" version = "0.2.21" @@ -1844,9 +1881,9 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8" dependencies = [ - "block-buffer", - "digest", - "opaque-debug", + "block-buffer 0.7.3", + "digest 0.8.1", + "opaque-debug 0.2.3", ] [[package]] @@ -2106,6 +2143,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "open" version = "1.4.0" @@ -4371,10 +4414,23 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.7.3", + "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] diff --git a/src/tools/build-manifest/Cargo.toml b/src/tools/build-manifest/Cargo.toml index 4f89c31936dda..4ae4dbfc06ede 100644 --- a/src/tools/build-manifest/Cargo.toml +++ b/src/tools/build-manifest/Cargo.toml @@ -11,3 +11,6 @@ serde_json = "1.0" anyhow = "1.0.32" flate2 = "1.0.16" tar = "0.4.29" +sha2 = "0.9.1" +rayon = "1.3.1" +hex = "0.4.2" diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 89b658d901f7b..8c8248c86b2fc 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -7,14 +7,19 @@ mod manifest; mod versions; -use crate::manifest::{Component, Manifest, Package, Rename, Target}; +use crate::manifest::{Component, FileHash, Manifest, Package, Rename, Target}; use crate::versions::{PkgType, Versions}; -use std::collections::{BTreeMap, HashMap}; +use rayon::prelude::*; +use sha2::Digest; +use std::collections::{BTreeMap, HashMap, HashSet}; use std::env; +use std::error::Error; use std::fs::{self, File}; use std::io::{self, Read, Write}; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; +use std::sync::Mutex; +use std::time::Instant; static HOSTS: &[&str] = &[ "aarch64-unknown-linux-gnu", @@ -181,7 +186,6 @@ struct Builder { input: PathBuf, output: PathBuf, - digests: BTreeMap, s3_address: String, date: String, @@ -223,7 +227,6 @@ fn main() { input, output, - digests: BTreeMap::new(), s3_address, date, @@ -236,7 +239,9 @@ fn main() { impl Builder { fn build(&mut self) { self.check_toolstate(); - self.digest_and_sign(); + if self.legacy { + self.digest_and_sign(); + } let manifest = self.build_manifest(); let rust_version = self.versions.package_version(&PkgType::Rust).unwrap(); @@ -274,10 +279,9 @@ impl Builder { /// Hash all files, compute their signatures, and collect the hashes in `self.digests`. fn digest_and_sign(&mut self) { for file in t!(self.input.read_dir()).map(|e| t!(e).path()) { - let filename = file.file_name().unwrap().to_str().unwrap(); - let digest = self.hash(&file); + file.file_name().unwrap().to_str().unwrap(); + self.hash(&file); self.sign(&file); - assert!(self.digests.insert(filename.to_string(), digest).is_none()); } } @@ -293,6 +297,9 @@ impl Builder { self.add_profiles_to(&mut manifest); self.add_renames_to(&mut manifest); manifest.pkg.insert("rust".to_string(), self.rust_package(&manifest)); + + self.fill_missing_hashes(&mut manifest); + manifest } @@ -565,6 +572,41 @@ impl Builder { assert!(t!(child.wait()).success()); } + fn fill_missing_hashes(&self, manifest: &mut Manifest) { + // First collect all files that need hashes + let mut need_hashes = HashSet::new(); + crate::manifest::visit_file_hashes(manifest, |file_hash| { + if let FileHash::Missing(path) = file_hash { + need_hashes.insert(path.clone()); + } + }); + + let collected = Mutex::new(HashMap::new()); + let collection_start = Instant::now(); + println!( + "collecting hashes for {} tarballs across {} threads", + need_hashes.len(), + rayon::current_num_threads().min(need_hashes.len()), + ); + need_hashes.par_iter().for_each(|path| match fetch_hash(path) { + Ok(hash) => { + collected.lock().unwrap().insert(path, hash); + } + Err(err) => eprintln!("error while fetching the hash for {}: {}", path.display(), err), + }); + let collected = collected.into_inner().unwrap(); + println!("collected {} hashes in {:.2?}", collected.len(), collection_start.elapsed()); + + crate::manifest::visit_file_hashes(manifest, |file_hash| { + if let FileHash::Missing(path) = file_hash { + match collected.get(path) { + Some(hash) => *file_hash = FileHash::Present(hash.clone()), + None => panic!("missing hash for file {}", path.display()), + } + } + }) + } + fn write_channel_files(&self, channel_name: &str, manifest: &Manifest) { self.write(&toml::to_string(&manifest).unwrap(), channel_name, ".toml"); self.write(&manifest.date, channel_name, "-date.txt"); @@ -578,7 +620,16 @@ impl Builder { fn write(&self, contents: &str, channel_name: &str, suffix: &str) { let dst = self.output.join(format!("channel-rust-{}{}", channel_name, suffix)); t!(fs::write(&dst, contents)); - self.hash(&dst); - self.sign(&dst); + if self.legacy { + self.hash(&dst); + self.sign(&dst); + } } } + +fn fetch_hash(path: &Path) -> Result> { + let mut file = File::open(path)?; + let mut sha256 = sha2::Sha256::default(); + std::io::copy(&mut file, &mut sha256)?; + Ok(hex::encode(sha256.finalize())) +} diff --git a/src/tools/build-manifest/src/manifest.rs b/src/tools/build-manifest/src/manifest.rs index 2a5755c1bf1da..20e62abb54cfa 100644 --- a/src/tools/build-manifest/src/manifest.rs +++ b/src/tools/build-manifest/src/manifest.rs @@ -1,5 +1,5 @@ use crate::Builder; -use serde::Serialize; +use serde::{Serialize, Serializer}; use std::collections::BTreeMap; use std::path::{Path, PathBuf}; @@ -29,9 +29,9 @@ pub(crate) struct Rename { pub(crate) struct Target { pub(crate) available: bool, pub(crate) url: Option, - pub(crate) hash: Option, + pub(crate) hash: Option, pub(crate) xz_url: Option, - pub(crate) xz_hash: Option, + pub(crate) xz_hash: Option, pub(crate) components: Option>, pub(crate) extensions: Option>, } @@ -52,10 +52,10 @@ impl Target { extensions: None, // .gz url: gz.as_ref().map(|path| builder.url(path)), - hash: gz.map(|path| Self::digest_of(builder, &path)), + hash: gz.map(FileHash::Missing), // .xz xz_url: xz.as_ref().map(|path| builder.url(path)), - xz_hash: xz.map(|path| Self::digest_of(builder, &path)), + xz_hash: xz.map(FileHash::Missing), } } @@ -65,12 +65,6 @@ impl Target { if path.is_file() { Some(path) } else { None } } - fn digest_of(builder: &Builder, path: &Path) -> String { - // TEMPORARY CODE -- DON'T REVIEW :) - let file_name = path.file_name().unwrap().to_str().unwrap(); - builder.digests.get(file_name).unwrap().clone() - } - pub(crate) fn unavailable() -> Self { Self::default() } @@ -87,3 +81,34 @@ impl Component { Self { pkg: pkg.to_string(), target: target.to_string() } } } + +#[allow(unused)] +pub(crate) enum FileHash { + Missing(PathBuf), + Present(String), +} + +impl Serialize for FileHash { + fn serialize(&self, serializer: S) -> Result { + match self { + FileHash::Missing(path) => Err(serde::ser::Error::custom(format!( + "can't serialize a missing hash for file {}", + path.display() + ))), + FileHash::Present(inner) => inner.serialize(serializer), + } + } +} + +pub(crate) fn visit_file_hashes(manifest: &mut Manifest, mut f: impl FnMut(&mut FileHash)) { + for pkg in manifest.pkg.values_mut() { + for target in pkg.target.values_mut() { + if let Some(hash) = &mut target.hash { + f(hash); + } + if let Some(hash) = &mut target.xz_hash { + f(hash); + } + } + } +} From 8c3d79dece820991e7c95ed3f35e4970d07cf6aa Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 1 Oct 2020 17:25:54 +0200 Subject: [PATCH 07/13] build-manifest: avoid collecting SHAs in parallel on legacy mode This avoids overloading the old server, and disrupting the other programs running on it. --- src/tools/build-manifest/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 8c8248c86b2fc..f13353f6f6f86 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -207,6 +207,14 @@ fn main() { // related code in this tool and ./x.py dist hash-and-sign can be removed. let legacy = env::var("BUILD_MANIFEST_LEGACY").is_ok(); + // Avoid overloading the old server in legacy mode. + if legacy { + rayon::ThreadPoolBuilder::new() + .num_threads(1) + .build_global() + .expect("failed to initialize Rayon"); + } + let mut args = env::args().skip(1); let input = PathBuf::from(args.next().unwrap()); let output = PathBuf::from(args.next().unwrap()); From 07f10557349eb94df456921d77d170f216ed9b15 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 1 Oct 2020 19:42:02 +0200 Subject: [PATCH 08/13] build-manifest: use BufReader --- src/tools/build-manifest/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index f13353f6f6f86..c7e7d88c68fa8 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -15,7 +15,7 @@ use std::collections::{BTreeMap, HashMap, HashSet}; use std::env; use std::error::Error; use std::fs::{self, File}; -use std::io::{self, Read, Write}; +use std::io::{self, BufReader, Read, Write}; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use std::sync::Mutex; @@ -636,7 +636,7 @@ impl Builder { } fn fetch_hash(path: &Path) -> Result> { - let mut file = File::open(path)?; + let mut file = BufReader::new(File::open(path)?); let mut sha256 = sha2::Sha256::default(); std::io::copy(&mut file, &mut sha256)?; Ok(hex::encode(sha256.finalize())) From 3a68d86e376745470cf850dd571d0925fbe5ab31 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 4 Oct 2020 16:10:08 -0400 Subject: [PATCH 09/13] Instruct lld that our @ files are posix-style, not Windows An upstream LLVM change changed behavior here to respect the host system quoting rules; previously the posix-style format was always used for @files. --- compiler/rustc_codegen_ssa/src/back/command.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/rustc_codegen_ssa/src/back/command.rs b/compiler/rustc_codegen_ssa/src/back/command.rs index 0208bb73abdbe..503c51d24b682 100644 --- a/compiler/rustc_codegen_ssa/src/back/command.rs +++ b/compiler/rustc_codegen_ssa/src/back/command.rs @@ -111,6 +111,12 @@ impl Command { LldFlavor::Link => "link", LldFlavor::Ld64 => "darwin", }); + if let LldFlavor::Wasm = flavor { + // LLVM expects host-specific formatting for @file + // arguments, but we always generate posix formatted files + // at this time. Indicate as such. + c.arg("--rsp-quoting=posix"); + } c } }; From af1ae0844f05e3c94b46220cba59ac2aab9c2374 Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sun, 4 Oct 2020 00:00:00 +0000 Subject: [PATCH 10/13] Fix miscompile in SimplifyBranchSame --- compiler/rustc_mir/src/transform/simplify_try.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_mir/src/transform/simplify_try.rs b/compiler/rustc_mir/src/transform/simplify_try.rs index b2c889bfd05e8..45fa3b700c616 100644 --- a/compiler/rustc_mir/src/transform/simplify_try.rs +++ b/compiler/rustc_mir/src/transform/simplify_try.rs @@ -628,7 +628,8 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> { // All successor basic blocks must be equal or contain statements that are pairwise considered equal. for ((target_and_value_l,bb_l), (target_and_value_r,bb_r)) in iter_bbs_reachable.tuple_windows() { let trivial_checks = bb_l.is_cleanup == bb_r.is_cleanup - && bb_l.terminator().kind == bb_r.terminator().kind; + && bb_l.terminator().kind == bb_r.terminator().kind + && bb_l.statements.len() == bb_r.statements.len(); let statement_check = || { bb_l.statements.iter().zip(&bb_r.statements).try_fold(StatementEquality::TrivialEqual, |acc,(l,r)| { let stmt_equality = self.statement_equality(*adt_matched_on, &l, target_and_value_l, &r, target_and_value_r); From 122ab13ce848218eeff44a6a7efaba1e97506879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Sun, 4 Oct 2020 00:00:00 +0000 Subject: [PATCH 11/13] Add regression test for SimplifyBranchSame miscompilation --- src/test/ui/mir/simplify-branch-same.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/test/ui/mir/simplify-branch-same.rs diff --git a/src/test/ui/mir/simplify-branch-same.rs b/src/test/ui/mir/simplify-branch-same.rs new file mode 100644 index 0000000000000..d631c33d61f84 --- /dev/null +++ b/src/test/ui/mir/simplify-branch-same.rs @@ -0,0 +1,21 @@ +// Regression test for SimplifyBranchSame miscompilation. +// run-pass + +macro_rules! m { + ($a:expr, $b:expr, $c:block) => { + match $a { + Lto::Fat | Lto::Thin => { $b; (); $c } + Lto::No => { $b; () } + } + } +} + +pub enum Lto { No, Thin, Fat } + +fn f(mut cookie: u32, lto: Lto) -> u32 { + let mut _a = false; + m!(lto, _a = true, {cookie = 0}); + cookie +} + +fn main() { assert_eq!(f(42, Lto::Thin), 0) } From 687c08e569748694bf8c948de9f813e8c28bd4cd Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 5 Oct 2020 21:40:20 +0200 Subject: [PATCH 12/13] Update RLS and Rustfmt --- Cargo.lock | 88 +++++++++++++++++++++++------------------------ src/tools/rls | 2 +- src/tools/rustfmt | 2 +- 3 files changed, 45 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 649972e61d7e9..19ad4f5944f84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2635,9 +2635,9 @@ dependencies = [ [[package]] name = "racer" -version = "2.1.38" +version = "2.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51dd5fd4247115b28f3e038eb8cda76a0c6f9cb473f769f41f930af8adff22d0" +checksum = "b9424b4650b9c1134d0a1b34dab82319691e1c95fa8af1658fc640deb1b6823c" dependencies = [ "bitflags", "clap", @@ -2962,9 +2962,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_arena" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2958af0d6e0458434a25cd3a96f6e19f24f71bf50b900add520dec52e212866b" +checksum = "e8e941a8fc3878a111d2bbfe78e39522d884136f0b412b12592195f26f653476" dependencies = [ "rustc-ap-rustc_data_structures", "smallvec 1.4.2", @@ -2972,9 +2972,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_ast" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c82c2510460f2133548e62399e5acd30c25ae6ece30245baab3d1e00c2fefac" +checksum = "3b58b6b035710df7f339a2bf86f6dafa876efd95439540970e24609e33598ca6" dependencies = [ "bitflags", "rustc-ap-rustc_data_structures", @@ -2989,11 +2989,11 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_ast_passes" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83977da57f81c6edd89bad47e49136680eaa33288de4abb702e95358c2a0fc6c" +checksum = "3d379a900d6a1f098490d92ab83e87487dcee2e4ec3f04c3ac4512b5117b64e2" dependencies = [ - "itertools 0.8.2", + "itertools 0.9.0", "rustc-ap-rustc_ast", "rustc-ap-rustc_ast_pretty", "rustc-ap-rustc_attr", @@ -3008,9 +3008,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_ast_pretty" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "becf4ca1638b214694c71a8752192683048ab8bd47947cc481f57bd48157eeb9" +checksum = "658d925c0da9e3c5cddc5e54f4fa8c03b41aff1fc6dc5e41837c1118ad010ac0" dependencies = [ "rustc-ap-rustc_ast", "rustc-ap-rustc_span", @@ -3020,9 +3020,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_attr" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f21ca5dadce8a40d75a2756b77eab75b4c2d827f645c622dd93ee2285599640" +checksum = "3f387037534f34c148aed753622677500e42d190a095670e7ac3fffc09811a59" dependencies = [ "rustc-ap-rustc_ast", "rustc-ap-rustc_ast_pretty", @@ -3039,9 +3039,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_data_structures" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4cd204764727fde9abf75333eb661f058bfc7242062d91019440fe1b240688b" +checksum = "14ffd17a37e00d77926a0713f191c59ff3aeb2b551a024c7cfffce14bab79be8" dependencies = [ "bitflags", "cfg-if", @@ -3049,10 +3049,9 @@ dependencies = [ "ena", "indexmap", "jobserver", - "lazy_static", "libc", "measureme", - "parking_lot 0.10.2", + "parking_lot 0.11.0", "rustc-ap-rustc_graphviz", "rustc-ap-rustc_index", "rustc-ap-rustc_macros", @@ -3070,9 +3069,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_errors" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58116f119e37f14c029f99077b347069621118e048a69df74695b98204e7c136" +checksum = "2b3263ddcfa9eb911e54a4e8088878dd9fd10e00d8b99b01033ba4a2733fe91d" dependencies = [ "annotate-snippets 0.8.0", "atty", @@ -3089,9 +3088,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_expand" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e3c4bda9b64b92805bebe7431fdb8e24fd112b35a8c6d2174827441f10a6b2" +checksum = "e1ab7e68cede8a2273fd8b8623002ce9dc832e061dfc3330e9bcc1fc2a722d73" dependencies = [ "rustc-ap-rustc_ast", "rustc-ap-rustc_ast_passes", @@ -3112,32 +3111,31 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_feature" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b612bb67d3fc49f395b03fc4ea4384a0145b05afbadab725803074ec827632b" +checksum = "eea2dc95421bc19bbd4d939399833a882c46b684283b4267ad1fcf982fc043d9" dependencies = [ - "lazy_static", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_span", ] [[package]] name = "rustc-ap-rustc_fs_util" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7630ad1a73a8434ee920676148cb5440ac57509bd20e94ec41087fb0b1d11c28" +checksum = "1e44c1804f09635f83f6cf1e04c2e92f8aeb7b4e850ac6c53d373dab02c13053" [[package]] name = "rustc-ap-rustc_graphviz" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a603fca4817062eb4fb23ff129d475bd66a69fb32f34ed4362ae950cf814b49d" +checksum = "dc491f2b9be6e928f6df6b287549b8d50c48e8eff8638345155f40fa2cfb785d" [[package]] name = "rustc-ap-rustc_index" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9850c4a5d7c341513e10802bca9588bf8f452ceea2d5cfa87b934246a52622bc" +checksum = "fa73f3fed413cdb6290738a10267da17b9ae8e02087334778b9a8c9491c5efc0" dependencies = [ "arrayvec", "rustc-ap-rustc_macros", @@ -3146,18 +3144,18 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_lexer" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d86722e5a1a615b198327d0d794cd9cbc8b9db4542276fc51fe078924de68ea" +checksum = "e993881244a92f3b44cf43c8f22ae2ca5cefe4f55a34e2b65b72ee66fe5ad077" dependencies = [ "unicode-xid", ] [[package]] name = "rustc-ap-rustc_macros" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3fc8482e44cabdda7ac9a8e224aef62ebdf95274d629dac8db3b42321025fea" +checksum = "4effe366556e1d75344764adf4d54cba7c2fad33dbd07588e96d0853831ddc7c" dependencies = [ "proc-macro2", "quote", @@ -3167,9 +3165,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_parse" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3716cdcd978a91dbd4a2788400e90e809527f841426fbeb92f882f9b8582f3ab" +checksum = "0342675835251571471d3dca9ea1576a853a8dfa1f4b0084db283c861223cb60" dependencies = [ "bitflags", "rustc-ap-rustc_ast", @@ -3187,9 +3185,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_serialize" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68046d07988b349b2e1c8bc1c9664a1d06519354aa677b9df358c5c5c058da0" +checksum = "438255ed968d73bf6573aa18d3b8d33c0a85ecdfd14160ef09ff813938e0606c" dependencies = [ "indexmap", "smallvec 1.4.2", @@ -3197,9 +3195,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_session" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85735553501a4de0c8904e37b7ccef79cc1c585a7d7f2cfa02cc38e0d149f982" +checksum = "7d61ff76dede8eb827f6805754900d1097a7046f938f950231b62b448f55bf78" dependencies = [ "bitflags", "getopts", @@ -3218,9 +3216,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_span" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c49ae8a0d3b9e27c6ffe8febeaa30f899294fff012de70625f9ee81c54fda85" +checksum = "1c267f15c3cfc82a8a441d2bf86bcccf299d1eb625822468e3d8ee6f7c5a1c89" dependencies = [ "cfg-if", "md-5", @@ -3237,9 +3235,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_target" -version = "677.0.0" +version = "679.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1765f447594740c501c7b666b87639aa7c1dae2bf8c3166d5d2dca16646fd034" +checksum = "8b1b4b266c4d44aac0f7f83b6741d8f0545b03d1ce32f3b5254f2014225cb96c" dependencies = [ "bitflags", "rustc-ap-rustc_data_structures", @@ -4256,7 +4254,7 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "1.4.21" +version = "1.4.22" dependencies = [ "annotate-snippets 0.6.1", "anyhow", diff --git a/src/tools/rls b/src/tools/rls index 4d5e9df12b6a7..9bfb47a79299d 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit 4d5e9df12b6a75d7ab48a7de060a97265ce49cee +Subproject commit 9bfb47a79299d52f45304367762c9bfc96d9ed7c diff --git a/src/tools/rustfmt b/src/tools/rustfmt index 01f2eadccc74c..97d0301011533 160000 --- a/src/tools/rustfmt +++ b/src/tools/rustfmt @@ -1 +1 @@ -Subproject commit 01f2eadccc74cf70eb11e6300ffa7e02b18b0027 +Subproject commit 97d0301011533e1c131c0edd660d77b4bd476c8b From e75c0e7e8ea2f74cca3df5c41feb07bf82bb89cc Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Mon, 5 Oct 2020 10:21:14 -0700 Subject: [PATCH 13/13] Move `EarlyOtherwiseBranch` to mir-opt-level 2 This didn't have an effect in most cases, and is not trivially sound. Let it bake at `mir-opt-level=2` for a while. --- compiler/rustc_mir/src/transform/early_otherwise_branch.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs index 7a9089d0f3675..ba64e6c1e530b 100644 --- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -29,7 +29,7 @@ pub struct EarlyOtherwiseBranch; impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { - if tcx.sess.opts.debugging_opts.mir_opt_level < 1 { + if tcx.sess.opts.debugging_opts.mir_opt_level < 2 { return; } trace!("running EarlyOtherwiseBranch on {:?}", source);