From 092bed303ec5385ae6f8d767047f9c5eee6f2a5c Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Fri, 3 Jun 2022 16:16:32 +0100 Subject: [PATCH 1/5] [SOL] build-std: pull in our compiler-builtins When -Z build-std is used, patch compiler-builtins so that our own fork is downloaded. Needed for https://github.com/solana-labs/solana/pull/23465. --- src/cargo/core/compiler/standard_lib.rs | 12 ++++++++++-- src/doc/src/reference/semver.md | 2 +- tests/build-std/main.rs | 8 +++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/cargo/core/compiler/standard_lib.rs b/src/cargo/core/compiler/standard_lib.rs index 5272c211bd7..d064c72d44d 100644 --- a/src/cargo/core/compiler/standard_lib.rs +++ b/src/cargo/core/compiler/standard_lib.rs @@ -6,7 +6,7 @@ use crate::core::compiler::{CompileKind, CompileMode, RustcTargetData, Unit}; use crate::core::profiles::{Profiles, UnitFor}; use crate::core::resolver::features::{CliFeatures, FeaturesFor, ResolvedFeatures}; use crate::core::resolver::HasDevUnits; -use crate::core::{Dependency, PackageId, PackageSet, Resolve, SourceId, Workspace}; +use crate::core::{Dependency, GitReference, PackageId, PackageSet, Resolve, SourceId, Workspace}; use crate::ops::{self, Packages}; use crate::util::errors::CargoResult; use crate::Config; @@ -78,7 +78,7 @@ pub fn resolve_std<'cfg>( "rustc-std-workspace-alloc", "rustc-std-workspace-std", ]; - let patches = to_patch + let mut patches = to_patch .iter() .map(|&name| { let source_path = SourceId::for_path(&src_path.join("library").join(name))?; @@ -86,6 +86,14 @@ pub fn resolve_std<'cfg>( Ok(dep) }) .collect::>>()?; + patches.push(Dependency::parse( + "compiler_builtins", + None, + SourceId::for_git( + &("https://github.com/solana-labs/compiler-builtins".parse()).unwrap(), + GitReference::Tag("solana-tools-v1.36".to_string()), + )?, + )?); let crates_io_url = crate::sources::CRATES_IO_INDEX.parse().unwrap(); let patch = HashMap::from([(crates_io_url, patches)]); let members = vec![ diff --git a/src/doc/src/reference/semver.md b/src/doc/src/reference/semver.md index f09250f1a9b..4a1610d0b89 100644 --- a/src/doc/src/reference/semver.md +++ b/src/doc/src/reference/semver.md @@ -1134,7 +1134,7 @@ pub enum E { fn main() { use updated_crate::E; let x = E::Variant1; - match x { // Error: `E::Variant2` not covered + match x { // Error: non-exhaustive patterns: `E::Variant2` not covered E::Variant1 => {} } } diff --git a/tests/build-std/main.rs b/tests/build-std/main.rs index 47a4bb671c0..050391fc957 100644 --- a/tests/build-std/main.rs +++ b/tests/build-std/main.rs @@ -111,7 +111,13 @@ fn basic() { // Importantly, this should not say [UPDATING] // There have been multiple bugs where every build triggers and update. .with_stderr( - "[COMPILING] foo v0.0.1 [..]\n\ + "[UPDATING] git repository `https://github.com/solana-labs/compiler-builtins`\n\ + warning: Patch `compiler_builtins v0.1.88 (https://github.com/solana-labs/compiler-builtins?tag=solana-tools-v1.36#e6395414)` was not used in the crate graph.\n\ + Check that the patched package version and available features are compatible\n\ + with the dependency requirements. If the patch has a different version from\n\ + what is locked in the Cargo.lock file, run `cargo update` to use the new\n\ + version. This may also occur with an optional dependency that is not enabled.\n\ + [COMPILING] foo v0.0.1 [..]\n\ [FINISHED] dev [..]", ) .run(); From c7ca7db0c8224584ee39ab680a9369b4dd3e197e Mon Sep 17 00:00:00 2001 From: Lucas Steuernagel Date: Tue, 6 Feb 2024 09:52:43 -0300 Subject: [PATCH 2/5] [SOL] Update compiler builtins to v1.40 --- src/cargo/core/compiler/standard_lib.rs | 2 +- tests/build-std/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cargo/core/compiler/standard_lib.rs b/src/cargo/core/compiler/standard_lib.rs index d064c72d44d..1ea6c4a6e61 100644 --- a/src/cargo/core/compiler/standard_lib.rs +++ b/src/cargo/core/compiler/standard_lib.rs @@ -91,7 +91,7 @@ pub fn resolve_std<'cfg>( None, SourceId::for_git( &("https://github.com/solana-labs/compiler-builtins".parse()).unwrap(), - GitReference::Tag("solana-tools-v1.36".to_string()), + GitReference::Tag("solana-tools-v1.40".to_string()), )?, )?); let crates_io_url = crate::sources::CRATES_IO_INDEX.parse().unwrap(); diff --git a/tests/build-std/main.rs b/tests/build-std/main.rs index 050391fc957..537ffc4bc5d 100644 --- a/tests/build-std/main.rs +++ b/tests/build-std/main.rs @@ -112,7 +112,7 @@ fn basic() { // There have been multiple bugs where every build triggers and update. .with_stderr( "[UPDATING] git repository `https://github.com/solana-labs/compiler-builtins`\n\ - warning: Patch `compiler_builtins v0.1.88 (https://github.com/solana-labs/compiler-builtins?tag=solana-tools-v1.36#e6395414)` was not used in the crate graph.\n\ + warning: Patch `compiler_builtins v0.1.103 (https://github.com/solana-labs/compiler-builtins?tag=solana-tools-v1.40#81ef46f3)` was not used in the crate graph.\n\ Check that the patched package version and available features are compatible\n\ with the dependency requirements. If the patch has a different version from\n\ what is locked in the Cargo.lock file, run `cargo update` to use the new\n\ From 7cda419519373107ef101a7a5c31f9fae78a4b72 Mon Sep 17 00:00:00 2001 From: Lucas Steuernagel Date: Thu, 8 Feb 2024 14:02:55 -0300 Subject: [PATCH 3/5] [SOL] Remove nightly and beta tests --- .github/workflows/main.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b805522381..e74c813ffa3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -119,30 +119,30 @@ jobs: os: ubuntu-latest rust: stable other: i686-unknown-linux-gnu - - name: Linux x86_64 beta - os: ubuntu-latest - rust: beta - other: i686-unknown-linux-gnu - - name: Linux x86_64 nightly - os: ubuntu-latest - rust: nightly - other: i686-unknown-linux-gnu +# - name: Linux x86_64 beta +# os: ubuntu-latest +# rust: beta +# other: i686-unknown-linux-gnu +# - name: Linux x86_64 nightly +# os: ubuntu-latest +# rust: nightly +# other: i686-unknown-linux-gnu - name: macOS x86_64 stable os: macos-latest rust: stable other: x86_64-apple-ios - - name: macOS x86_64 nightly - os: macos-latest - rust: nightly - other: x86_64-apple-ios +# - name: macOS x86_64 nightly +# os: macos-latest +# rust: nightly +# other: x86_64-apple-ios - name: Windows x86_64 MSVC stable os: windows-latest rust: stable-msvc other: i686-pc-windows-msvc - - name: Windows x86_64 gnu nightly # runs out of space while trying to link the test suite - os: windows-latest - rust: nightly-gnu - other: i686-pc-windows-gnu +# - name: Windows x86_64 gnu nightly # runs out of space while trying to link the test suite +# os: windows-latest +# rust: nightly-gnu +# other: i686-pc-windows-gnu name: Tests ${{ matrix.name }} steps: - uses: actions/checkout@v4 @@ -216,7 +216,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: rustup update nightly && rustup default nightly + - run: rustup update stable && rustup default stable - run: rustup component add rust-src - run: cargo build - run: cargo test -p cargo --test build-std From b6351f1bc2d99263696dba6f89ec82f68dac2603 Mon Sep 17 00:00:00 2001 From: Lucas Steuernagel <38472950+LucasSte@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:59:10 -0300 Subject: [PATCH 4/5] [SOL] Test only with the release version --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e74c813ffa3..9e89a08d01e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,7 +94,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - run: rustup update stable && rustup default stable + - run: rustup toolchain install 1.75.0 && rustup default 1.75.0 - name: Install cargo-semver-checks run: | mkdir installed-bins @@ -117,7 +117,7 @@ jobs: include: - name: Linux x86_64 stable os: ubuntu-latest - rust: stable + rust: 1.75.0 other: i686-unknown-linux-gnu # - name: Linux x86_64 beta # os: ubuntu-latest @@ -129,7 +129,7 @@ jobs: # other: i686-unknown-linux-gnu - name: macOS x86_64 stable os: macos-latest - rust: stable + rust: 1.75.0 other: x86_64-apple-ios # - name: macOS x86_64 nightly # os: macos-latest @@ -137,7 +137,7 @@ jobs: # other: x86_64-apple-ios - name: Windows x86_64 MSVC stable os: windows-latest - rust: stable-msvc + rust: 1.75.0-msvc other: i686-pc-windows-msvc # - name: Windows x86_64 gnu nightly # runs out of space while trying to link the test suite # os: windows-latest @@ -204,7 +204,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable + - run: rustup toolchain install 1.75.0 && rustup default 1.75.0 - run: rustup target add i686-unknown-linux-gnu - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y - run: rustup component add rustfmt || echo "rustfmt not available" @@ -254,4 +254,4 @@ jobs: steps: - uses: actions/checkout@v4 - uses: taiki-e/install-action@cargo-hack - - run: cargo hack check --all-targets --rust-version --workspace --ignore-private + - run: cargo hack check --all-targets --workspace --ignore-private From 8cb4946dd4abf5539cdf5e94a2c6ffb9b2b80356 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 12 Feb 2024 15:34:23 -0700 Subject: [PATCH 5/5] [SOL] Check release bump against the Solana release --- crates/xtask-bump-check/src/xtask.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/xtask-bump-check/src/xtask.rs b/crates/xtask-bump-check/src/xtask.rs index b99ac8b3249..26a086dfa7f 100644 --- a/crates/xtask-bump-check/src/xtask.rs +++ b/crates/xtask-bump-check/src/xtask.rs @@ -158,6 +158,9 @@ fn bump_check(args: &clap::ArgMatches, config: &cargo::util::Config) -> CargoRes config.shell().status("Running", &cmd)?; cmd.exec()?; + // This test does not work for Solana because we are running + // it against a too old version of cargo. + #[cfg(target_os = "solana")] if let Some(referenced_commit) = referenced_commit.as_ref() { let mut cmd = ProcessBuilder::new("cargo"); cmd.arg("semver-checks") @@ -272,8 +275,8 @@ fn beta_and_stable_branch(repo: &git2::Repository) -> CargoResult<[git2::Branch< for branch in repo.branches(Some(git2::BranchType::Remote))? { let (branch, _) = branch?; let name = branch.name()?.unwrap(); - let Some((_, version)) = name.split_once("/rust-") else { - tracing::trace!("branch `{name}` is not in the format of `/rust-`"); + let Some((_, version)) = name.split_once("/solana-") else { + tracing::trace!("branch `{name}` is not in the format of `/solana-`"); continue; }; let Ok(version) = version.parse::() else {