Skip to content

Commit aa14297

Browse files
authored
Merge branch 'rust-lang:master' into fix_cargo_tree_bindep_crosscompile
2 parents dd72f0e + cf781da commit aa14297

File tree

40 files changed

+267
-425
lines changed

40 files changed

+267
-425
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,6 @@ jobs:
173173
- run: rustup target add ${{ matrix.other }}
174174
- run: rustup component add rustc-dev llvm-tools-preview rust-docs
175175
if: startsWith(matrix.rust, 'nightly')
176-
# Install fish, zsh, and elvish only on Ubuntu systems
177-
- name: Install fish, zsh, and elvish on Ubuntu
178-
run: sudo apt update -y && sudo apt install fish zsh elvish -y
179-
if: matrix.os == 'ubuntu-latest'
180-
- name: Install fish, elvish on macOS
181-
run: brew install fish elvish
182-
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'
183176
- run: sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y
184177
if: matrix.os == 'ubuntu-latest'
185178
- run: rustup component add rustfmt || echo "rustfmt not available"
@@ -234,7 +227,6 @@ jobs:
234227
- run: rustup update --no-self-update stable && rustup default stable
235228
- run: rustup target add i686-unknown-linux-gnu
236229
- run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
237-
- run: sudo apt update -y && sudo apt install fish zsh elvish -y
238230
- run: rustup component add rustfmt || echo "rustfmt not available"
239231
- run: cargo test -p cargo
240232
env:

Cargo.lock

Lines changed: 0 additions & 94 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ cargo_metadata = "0.18.1"
3838
clap = "4.5.18"
3939
clap_complete = { version = "4.5.29", features = ["unstable-dynamic"] }
4040
color-print = "0.3.6"
41-
completest-pty = "0.5.3"
4241
core-foundation = { version = "0.10.0", features = ["mac_os_10_7_support"] }
4342
crates-io = { version = "0.40.4", path = "crates/crates-io" }
4443
criterion = { version = "0.5.1", features = ["html_reports"] }
@@ -242,7 +241,6 @@ features = [
242241
[dev-dependencies]
243242
annotate-snippets = { workspace = true, features = ["testing-colors"] }
244243
cargo-test-support.workspace = true
245-
completest-pty.workspace = true
246244
gix = { workspace = true, features = ["revision"] }
247245
same-file.workspace = true
248246
snapbox.workspace = true

src/bin/cargo/commands/update.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ pub fn cli() -> Command {
1313
.value_name("SPEC")
1414
.help_heading(heading::PACKAGE_SELECTION)
1515
.group("package-group")
16-
.help("Package to update")])
16+
.help("Package to update")
17+
.add(clap_complete::ArgValueCandidates::new(
18+
get_pkg_id_spec_candidates,
19+
))])
1720
.arg(
1821
optional_multi_opt("package", "SPEC", "Package to update")
1922
.short('p')

src/bin/cargo/main.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,20 @@ fn main() {
3131

3232
let nightly_features_allowed = matches!(&*features::channel(), "nightly" | "dev");
3333
if nightly_features_allowed {
34-
clap_complete::CompleteEnv::with_factory(|| cli::cli(&mut gctx))
35-
.var("CARGO_COMPLETE")
36-
.complete();
34+
let _span = tracing::span!(tracing::Level::TRACE, "completions").entered();
35+
let args = std::env::args_os();
36+
let current_dir = std::env::current_dir().ok();
37+
let completer =
38+
clap_complete::CompleteEnv::with_factory(|| cli::cli(&mut gctx)).var("CARGO_COMPLETE");
39+
if completer
40+
.try_complete(args, current_dir.as_deref())
41+
.unwrap_or_else(|e| {
42+
let mut shell = Shell::new();
43+
cargo::exit_with_error(e.into(), &mut shell)
44+
})
45+
{
46+
return;
47+
}
3748
}
3849

3950
let result = if let Some(lock_addr) = cargo::ops::fix_get_proxy_lock_addr() {

src/cargo/core/resolver/resolve.rs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,14 @@ pub enum ResolveVersion {
8484
/// branch specifiers.
8585
///
8686
/// * Introduced in 2020 in version 1.47.
87-
/// * New lockfiles use V3 by default starting in 1.53.
87+
/// * New lockfiles use V3 by default from in 1.53 to 1.82.
8888
V3,
8989
/// SourceId URL serialization is aware of URL encoding. For example,
9090
/// `?branch=foo bar` is now encoded as `?branch=foo+bar` and can be decoded
9191
/// back and forth correctly.
9292
///
9393
/// * Introduced in 2024 in version 1.78.
94+
/// * New lockfiles use V4 by default starting in 1.83.
9495
V4,
9596
/// Unstable. Will collect a certain amount of changes and then go.
9697
///
@@ -107,7 +108,7 @@ impl ResolveVersion {
107108
/// Update this and the description of enum variants of [`ResolveVersion`]
108109
/// when we're changing the default lockfile version.
109110
fn default() -> ResolveVersion {
110-
ResolveVersion::V3
111+
ResolveVersion::V4
111112
}
112113

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

128-
let rust_1_41 = PartialVersion {
129-
major: 1,
130-
minor: Some(41),
131-
patch: None,
132-
pre: None,
133-
build: None,
134-
}
135-
.try_into()
136-
.expect("PartialVersion 1.41");
137-
let rust_1_53 = PartialVersion {
138-
major: 1,
139-
minor: Some(53),
140-
patch: None,
141-
pre: None,
142-
build: None,
143-
}
144-
.try_into()
145-
.expect("PartialVersion 1.53");
129+
let rust = |major, minor| -> RustVersion {
130+
PartialVersion {
131+
major,
132+
minor: Some(minor),
133+
patch: None,
134+
pre: None,
135+
build: None,
136+
}
137+
.try_into()
138+
.unwrap()
139+
};
146140

147-
if rust_version >= &rust_1_53 {
141+
if rust_version >= &rust(1, 83) {
142+
ResolveVersion::V4
143+
} else if rust_version >= &rust(1, 53) {
148144
ResolveVersion::V3
149-
} else if rust_version >= &rust_1_41 {
145+
} else if rust_version >= &rust(1, 41) {
150146
ResolveVersion::V2
151147
} else {
152148
ResolveVersion::V1

src/cargo/core/source_id.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,7 @@ impl fmt::Display for SourceId {
644644
// Don't replace the URL display for git references,
645645
// because those are kind of expected to be URLs.
646646
write!(f, "{}", self.inner.url)?;
647-
// TODO(-Znext-lockfile-bump): set it to true when the default is
648-
// lockfile v4, because we want Source ID serialization to be
649-
// consistent with lockfile.
650-
if let Some(pretty) = reference.pretty_ref(false) {
647+
if let Some(pretty) = reference.pretty_ref(true) {
651648
write!(f, "?{}", pretty)?;
652649
}
653650

src/cargo/sources/git/source.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,8 @@ fn ident_shallow(id: &SourceId, is_shallow: bool) -> String {
226226
impl<'gctx> Debug for GitSource<'gctx> {
227227
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
228228
write!(f, "git repo at {}", self.remote.url())?;
229-
230-
// TODO(-Znext-lockfile-bump): set it to true when the default is
231-
// lockfile v4, because we want Source ID serialization to be
232-
// consistent with lockfile.
233229
match &self.locked_rev {
234-
Revision::Deferred(git_ref) => match git_ref.pretty_ref(false) {
230+
Revision::Deferred(git_ref) => match git_ref.pretty_ref(true) {
235231
Some(s) => write!(f, " ({})", s),
236232
None => Ok(()),
237233
},

0 commit comments

Comments
 (0)