Skip to content

Commit

Permalink
Merge branch 'rust-lang:master' into fix_cargo_tree_bindep_crosscompile
Browse files Browse the repository at this point in the history
  • Loading branch information
elchukc authored Sep 25, 2024
2 parents dd72f0e + cf781da commit aa14297
Show file tree
Hide file tree
Showing 40 changed files with 267 additions and 425 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ jobs:
- run: rustup target add ${{ matrix.other }}
- run: rustup component add rustc-dev llvm-tools-preview rust-docs
if: startsWith(matrix.rust, 'nightly')
# Install fish, zsh, and elvish only on Ubuntu systems
- name: Install fish, zsh, and elvish on Ubuntu
run: sudo apt update -y && sudo apt install fish zsh elvish -y
if: matrix.os == 'ubuntu-latest'
- name: Install fish, elvish on macOS
run: brew install fish elvish
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'
- run: sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y
if: matrix.os == 'ubuntu-latest'
- run: rustup component add rustfmt || echo "rustfmt not available"
Expand Down Expand Up @@ -234,7 +227,6 @@ jobs:
- run: rustup update --no-self-update stable && rustup default stable
- 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: sudo apt update -y && sudo apt install fish zsh elvish -y
- run: rustup component add rustfmt || echo "rustfmt not available"
- run: cargo test -p cargo
env:
Expand Down
94 changes: 0 additions & 94 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ cargo_metadata = "0.18.1"
clap = "4.5.18"
clap_complete = { version = "4.5.29", features = ["unstable-dynamic"] }
color-print = "0.3.6"
completest-pty = "0.5.3"
core-foundation = { version = "0.10.0", features = ["mac_os_10_7_support"] }
crates-io = { version = "0.40.4", path = "crates/crates-io" }
criterion = { version = "0.5.1", features = ["html_reports"] }
Expand Down Expand Up @@ -242,7 +241,6 @@ features = [
[dev-dependencies]
annotate-snippets = { workspace = true, features = ["testing-colors"] }
cargo-test-support.workspace = true
completest-pty.workspace = true
gix = { workspace = true, features = ["revision"] }
same-file.workspace = true
snapbox.workspace = true
Expand Down
5 changes: 4 additions & 1 deletion src/bin/cargo/commands/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ pub fn cli() -> Command {
.value_name("SPEC")
.help_heading(heading::PACKAGE_SELECTION)
.group("package-group")
.help("Package to update")])
.help("Package to update")
.add(clap_complete::ArgValueCandidates::new(
get_pkg_id_spec_candidates,
))])
.arg(
optional_multi_opt("package", "SPEC", "Package to update")
.short('p')
Expand Down
17 changes: 14 additions & 3 deletions src/bin/cargo/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,20 @@ fn main() {

let nightly_features_allowed = matches!(&*features::channel(), "nightly" | "dev");
if nightly_features_allowed {
clap_complete::CompleteEnv::with_factory(|| cli::cli(&mut gctx))
.var("CARGO_COMPLETE")
.complete();
let _span = tracing::span!(tracing::Level::TRACE, "completions").entered();
let args = std::env::args_os();
let current_dir = std::env::current_dir().ok();
let completer =
clap_complete::CompleteEnv::with_factory(|| cli::cli(&mut gctx)).var("CARGO_COMPLETE");
if completer
.try_complete(args, current_dir.as_deref())
.unwrap_or_else(|e| {
let mut shell = Shell::new();
cargo::exit_with_error(e.into(), &mut shell)
})
{
return;
}
}

let result = if let Some(lock_addr) = cargo::ops::fix_get_proxy_lock_addr() {
Expand Down
40 changes: 18 additions & 22 deletions src/cargo/core/resolver/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ pub enum ResolveVersion {
/// branch specifiers.
///
/// * Introduced in 2020 in version 1.47.
/// * New lockfiles use V3 by default starting in 1.53.
/// * New lockfiles use V3 by default from in 1.53 to 1.82.
V3,
/// SourceId URL serialization is aware of URL encoding. For example,
/// `?branch=foo bar` is now encoded as `?branch=foo+bar` and can be decoded
/// back and forth correctly.
///
/// * Introduced in 2024 in version 1.78.
/// * New lockfiles use V4 by default starting in 1.83.
V4,
/// Unstable. Will collect a certain amount of changes and then go.
///
Expand All @@ -107,7 +108,7 @@ impl ResolveVersion {
/// Update this and the description of enum variants of [`ResolveVersion`]
/// when we're changing the default lockfile version.
fn default() -> ResolveVersion {
ResolveVersion::V3
ResolveVersion::V4
}

/// The maximum version of lockfile made into the stable channel.
Expand All @@ -125,28 +126,23 @@ impl ResolveVersion {
return ResolveVersion::default();
};

let rust_1_41 = PartialVersion {
major: 1,
minor: Some(41),
patch: None,
pre: None,
build: None,
}
.try_into()
.expect("PartialVersion 1.41");
let rust_1_53 = PartialVersion {
major: 1,
minor: Some(53),
patch: None,
pre: None,
build: None,
}
.try_into()
.expect("PartialVersion 1.53");
let rust = |major, minor| -> RustVersion {
PartialVersion {
major,
minor: Some(minor),
patch: None,
pre: None,
build: None,
}
.try_into()
.unwrap()
};

if rust_version >= &rust_1_53 {
if rust_version >= &rust(1, 83) {
ResolveVersion::V4
} else if rust_version >= &rust(1, 53) {
ResolveVersion::V3
} else if rust_version >= &rust_1_41 {
} else if rust_version >= &rust(1, 41) {
ResolveVersion::V2
} else {
ResolveVersion::V1
Expand Down
5 changes: 1 addition & 4 deletions src/cargo/core/source_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,7 @@ impl fmt::Display for SourceId {
// Don't replace the URL display for git references,
// because those are kind of expected to be URLs.
write!(f, "{}", self.inner.url)?;
// TODO(-Znext-lockfile-bump): set it to true when the default is
// lockfile v4, because we want Source ID serialization to be
// consistent with lockfile.
if let Some(pretty) = reference.pretty_ref(false) {
if let Some(pretty) = reference.pretty_ref(true) {
write!(f, "?{}", pretty)?;
}

Expand Down
6 changes: 1 addition & 5 deletions src/cargo/sources/git/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,8 @@ fn ident_shallow(id: &SourceId, is_shallow: bool) -> String {
impl<'gctx> Debug for GitSource<'gctx> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "git repo at {}", self.remote.url())?;

// TODO(-Znext-lockfile-bump): set it to true when the default is
// lockfile v4, because we want Source ID serialization to be
// consistent with lockfile.
match &self.locked_rev {
Revision::Deferred(git_ref) => match git_ref.pretty_ref(false) {
Revision::Deferred(git_ref) => match git_ref.pretty_ref(true) {
Some(s) => write!(f, " ({})", s),
None => Ok(()),
},
Expand Down
Loading

0 comments on commit aa14297

Please sign in to comment.