Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cargo version #6

Merged
merged 5 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -117,32 +117,32 @@ jobs:
include:
- name: Linux x86_64 stable
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
rust: 1.75.0
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
rust: 1.75.0
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
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
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
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
7 changes: 5 additions & 2 deletions crates/xtask-bump-check/src/xtask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 `<remote>/rust-<semver>`");
let Some((_, version)) = name.split_once("/solana-") else {
tracing::trace!("branch `{name}` is not in the format of `<remote>/solana-<semver>`");
continue;
};
let Ok(version) = version.parse::<semver::Version>() else {
Expand Down
12 changes: 10 additions & 2 deletions src/cargo/core/compiler/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -78,14 +78,22 @@ 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))?;
let dep = Dependency::parse(name, None, source_path)?;
Ok(dep)
})
.collect::<CargoResult<Vec<_>>>()?;
patches.push(Dependency::parse(
"compiler_builtins",
None,
SourceId::for_git(
&("https://github.com/solana-labs/compiler-builtins".parse()).unwrap(),
GitReference::Tag("solana-tools-v1.40".to_string()),
)?,
)?);
let crates_io_url = crate::sources::CRATES_IO_INDEX.parse().unwrap();
let patch = HashMap::from([(crates_io_url, patches)]);
let members = vec![
Expand Down
2 changes: 1 addition & 1 deletion src/doc/src/reference/semver.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {}
}
}
Expand Down
8 changes: 7 additions & 1 deletion tests/build-std/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.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\
version. This may also occur with an optional dependency that is not enabled.\n\
[COMPILING] foo v0.0.1 [..]\n\
[FINISHED] dev [..]",
)
.run();
Expand Down