From 8506ceb40ef29f1479de1e2e09062e0249d8aed4 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 12 May 2020 11:16:16 +0100 Subject: [PATCH 1/6] Upgrade cargo-xbuild to include LTO fix --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1679b1104..211e88de6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -320,9 +320,9 @@ dependencies = [ [[package]] name = "cargo-xbuild" -version = "0.5.28" +version = "0.5.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cf1fcfab5ef1b3aeacb5bc16c248ecc4ef9e3e81ed96087e3801b81b305ca0" +checksum = "c6c11ec6bf11f95578c3698b9dab2d605df796e32886d65431b87a434691b8c5" dependencies = [ "cargo_metadata", "error-chain", diff --git a/Cargo.toml b/Cargo.toml index fe4d4e62e..ac9fe28dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ codec = { package = "parity-scale-codec", version = "1.2" } which = "3.1.0" colored = "1.9" toml = "0.5.4" -cargo-xbuild = "0.5.26" +cargo-xbuild = "0.5.31" rustc_version = "0.2.3" serde_json = "1.0" tempfile = "3.1.0" From 7026e7b61a5509ef6a274e8f0a1480cb3df65371 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 12 May 2020 11:19:27 +0100 Subject: [PATCH 2/6] Bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 211e88de6..583740a09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -288,7 +288,7 @@ checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" [[package]] name = "cargo-contract" -version = "0.6.0" +version = "0.6.1" dependencies = [ "anyhow", "assert_matches", diff --git a/Cargo.toml b/Cargo.toml index ac9fe28dd..603a7be47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-contract" -version = "0.6.0" +version = "0.6.1" authors = ["Parity Technologies "] build = "build.rs" edition = "2018" From c13fc6ea44e22c07a277b26031f1555a3fced72a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 12 May 2020 11:23:24 +0100 Subject: [PATCH 3/6] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f98c3e79d..dbd16d105 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# Version 0.6.1 (2020-05-12) + +- Upgrade xbuild to include LTO fix [#52](https://github.com/paritytech/cargo-contract/pull/52) + # Version 0.6.0 (2020-03-25) - First release to crates.io From f07d422ce83de5266e06ce087eae7534e72ba214 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 12 May 2020 16:00:17 +0100 Subject: [PATCH 4/6] Disable lto for metadata generation, enable for contract build --- src/cmd/build.rs | 4 +++- src/cmd/metadata.rs | 4 +++- src/workspace.rs | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 0537b19af..ea25295eb 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -138,7 +138,9 @@ fn build_cargo_project(crate_metadata: &CrateMetadata, verbosity: Option Result<&mut Self> { + let profile = self.toml.entry("profile") + .or_insert(value::Value::Table(Default::default())); + let release = profile + .as_table_mut() + .ok_or(anyhow::anyhow!("profile should be a table"))? + .entry("release") + .or_insert(value::Value::Table(Default::default())); + let lto = release + .as_table_mut() + .ok_or(anyhow::anyhow!("release should be a table"))? + .entry("lto") + .or_insert(enabled.into()); + *lto = enabled.into(); + Ok(self) + } + /// Remove a value from the `[lib] crate-types = []` section /// /// If the value does not exist, does nothing. From 23705df0a6dba92a2f3a6093139c6702adfb9ba4 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 12 May 2020 16:04:05 +0100 Subject: [PATCH 5/6] Fmt --- src/workspace.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/workspace.rs b/src/workspace.rs index d81316441..1aa708659 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -137,7 +137,9 @@ impl Manifest { /// Set `[profile.release]` lto flag pub fn with_profile_release_lto(&mut self, enabled: bool) -> Result<&mut Self> { - let profile = self.toml.entry("profile") + let profile = self + .toml + .entry("profile") .or_insert(value::Value::Table(Default::default())); let release = profile .as_table_mut() From fdd96b6bba34434f9fc721f2544bd0a53bd8f8b2 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 12 May 2020 16:07:15 +0100 Subject: [PATCH 6/6] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbd16d105..13fc238a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Version 0.6.1 (2020-05-12) -- Upgrade xbuild to include LTO fix [#52](https://github.com/paritytech/cargo-contract/pull/52) +- Fix LTO regressions in nightly toolchain [#52](https://github.com/paritytech/cargo-contract/pull/52) # Version 0.6.0 (2020-03-25)