Update Rust toolchain to 1.91 and MSRV to 1.89 (#16531)

## Summary

Updates Rust Toolchain to
[1.91](https://blog.rust-lang.org/2025/10/30/Rust-1.91.0/) and bumps
MSRV to [1.89](https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/) per
versioning policy. New clippy rule [implicit
clone](https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone)
resulted in some minor changes (some with improvements).

Updates trampoline to `nightly-2025-06-23` which is roughly 1.89~. The
trampoline binaries do not need to be regenerated as there should be no
changes.
This commit is contained in:
samypr100 2025-10-30 23:34:59 -04:00 committed by GitHub
parent 7cf1646a44
commit 7978122837
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 44 additions and 49 deletions

View File

@ -12,7 +12,7 @@ resolver = "2"
[workspace.package]
edition = "2024"
rust-version = "1.88"
rust-version = "1.89"
homepage = "https://pypi.org/project/uv/"
documentation = "https://pypi.org/project/uv/"
repository = "https://github.com/astral-sh/uv"

View File

@ -337,7 +337,7 @@ impl PyProjectToml {
PortableGlobParser::Pep639
.parse(license_glob)
.map_err(|err| Error::PortableGlob {
field: license_glob.to_string(),
field: license_glob.to_owned(),
source: err,
})?;
license_globs_parsed.push(pep639_glob);

View File

@ -169,7 +169,7 @@ fn generate_set(output: &mut String, set: Set, parents: &mut Vec<Set>) {
generate_set(
output,
Set::Named {
name: set_name.to_string(),
name: set_name.to_owned(),
set: *sub_set,
},
parents,

View File

@ -99,13 +99,13 @@ async fn generate() -> Result<String> {
replacements
.entry(sysconfig_cc_entry)
.or_default()
.insert(from_cc.to_string(), "cc".to_string());
.insert(from_cc.to_owned(), "cc".to_string());
}
if let Some(ref from_cc) = targets_config.target_cc {
replacements
.entry(sysconfig_cc_entry)
.or_default()
.insert(from_cc.to_string(), "cc".to_string());
.insert(from_cc.to_owned(), "cc".to_string());
}
}
for sysconfig_cxx_entry in ["CXX", "LDCXXSHARED"] {
@ -113,13 +113,13 @@ async fn generate() -> Result<String> {
replacements
.entry(sysconfig_cxx_entry)
.or_default()
.insert(from_cxx.to_string(), "c++".to_string());
.insert(from_cxx.to_owned(), "c++".to_string());
}
if let Some(ref from_cxx) = targets_config.target_cxx {
replacements
.entry(sysconfig_cxx_entry)
.or_default()
.insert(from_cxx.to_string(), "c++".to_string());
.insert(from_cxx.to_owned(), "c++".to_string());
}
}
}

View File

@ -204,7 +204,7 @@ impl<'a, Context: BuildContext> Preparer<'a, Context> {
}
Ok(cached.clone())
}
Err(err) => Err(Error::Thread(err.to_string())),
Err(err) => Err(Error::Thread(err.to_owned())),
}
}
}

View File

@ -186,7 +186,7 @@ pub fn find_flat_dist_info(
.starts_with(filename.name.as_str())
{
return Err(Error::MissingDistInfoPackageName(
dist_info_prefix.to_string(),
dist_info_prefix,
filename.name.to_string(),
));
}

View File

@ -1135,7 +1135,7 @@ impl ManagedPythonDownload {
let mut extracted = match uv_extract::strip_component(temp_dir.path()) {
Ok(top_level) => top_level,
Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.keep(),
Err(err) => return Err(Error::ExtractError(filename.to_string(), err)),
Err(err) => return Err(Error::ExtractError(filename, err)),
};
// If the distribution is a `full` archive, the Python installation is in the `install` directory.
@ -1266,12 +1266,12 @@ impl ManagedPythonDownload {
let mut reader = ProgressReader::new(&mut hasher, progress_key, reporter);
uv_extract::stream::archive(&mut reader, ext, target)
.await
.map_err(|err| Error::ExtractError(filename.to_string(), err))?;
.map_err(|err| Error::ExtractError(filename.to_owned(), err))?;
reporter.on_request_complete(direction, progress_key);
} else {
uv_extract::stream::archive(&mut hasher, ext, target)
.await
.map_err(|err| Error::ExtractError(filename.to_string(), err))?;
.map_err(|err| Error::ExtractError(filename.to_owned(), err))?;
}
hasher.finish().await.map_err(Error::HashExhaustion)?;

View File

@ -578,7 +578,7 @@ fn display_tree_inner(
lines: &mut Vec<String>,
depth: usize,
) {
let prefix = " ".repeat(depth).to_string();
let prefix = " ".repeat(depth);
match error {
DerivationTree::Derived(derived) => {
display_tree_inner(&derived.cause1, lines, depth + 1);

View File

@ -903,7 +903,7 @@ impl<'lock> PylockToml {
let mut doc = toml_edit::DocumentMut::new();
doc.insert("lock-version", value(self.lock_version.to_string()));
doc.insert("created-by", value(self.created_by.to_string()));
doc.insert("created-by", value(self.created_by.as_str()));
if let Some(ref requires_python) = self.requires_python {
doc.insert("requires-python", value(requires_python.to_string()));
}

View File

@ -3782,19 +3782,15 @@ impl TryFrom<SourceWire> for Source {
Git { git } => {
let url = DisplaySafeUrl::parse(&git)
.map_err(|err| SourceParseError::InvalidUrl {
given: git.to_string(),
given: git.clone(),
err,
})
.map_err(LockErrorKind::InvalidGitSourceUrl)?;
let git_source = GitSource::from_url(&url)
.map_err(|err| match err {
GitSourceError::InvalidSha => SourceParseError::InvalidSha {
given: git.to_string(),
},
GitSourceError::MissingSha => SourceParseError::MissingSha {
given: git.to_string(),
},
GitSourceError::InvalidSha => SourceParseError::InvalidSha { given: git },
GitSourceError::MissingSha => SourceParseError::MissingSha { given: git },
})
.map_err(LockErrorKind::InvalidGitSourceUrl)?;
@ -4279,11 +4275,11 @@ impl From<SourceDistWire> for SourceDist {
impl From<GitReference> for GitSourceKind {
fn from(value: GitReference) -> Self {
match value {
GitReference::Branch(branch) => Self::Branch(branch.to_string()),
GitReference::Tag(tag) => Self::Tag(tag.to_string()),
GitReference::BranchOrTag(rev) => Self::Rev(rev.to_string()),
GitReference::BranchOrTagOrCommit(rev) => Self::Rev(rev.to_string()),
GitReference::NamedRef(rev) => Self::Rev(rev.to_string()),
GitReference::Branch(branch) => Self::Branch(branch),
GitReference::Tag(tag) => Self::Tag(tag),
GitReference::BranchOrTag(rev) => Self::Rev(rev),
GitReference::BranchOrTagOrCommit(rev) => Self::Rev(rev),
GitReference::NamedRef(rev) => Self::Rev(rev),
GitReference::DefaultBranch => Self::DefaultBranch,
}
}

View File

@ -13,19 +13,19 @@ LLD and add the `rustup` targets:
```shell
sudo apt install llvm clang lld
cargo install cargo-xwin
rustup toolchain install nightly-2025-03-28
rustup component add rust-src --toolchain nightly-2025-03-28-x86_64-unknown-linux-gnu
rustup target add --toolchain nightly-2025-03-28 i686-pc-windows-msvc
rustup target add --toolchain nightly-2025-03-28 x86_64-pc-windows-msvc
rustup target add --toolchain nightly-2025-03-28 aarch64-pc-windows-msvc
rustup toolchain install nightly-2025-06-23
rustup component add rust-src --toolchain nightly-2025-06-23-x86_64-unknown-linux-gnu
rustup target add --toolchain nightly-2025-06-23 i686-pc-windows-msvc
rustup target add --toolchain nightly-2025-06-23 x86_64-pc-windows-msvc
rustup target add --toolchain nightly-2025-06-23 aarch64-pc-windows-msvc
```
Then, build the trampolines for all supported architectures:
```shell
cargo +nightly-2025-03-28 xwin build --xwin-arch x86 --release --target i686-pc-windows-msvc
cargo +nightly-2025-03-28 xwin build --release --target x86_64-pc-windows-msvc
cargo +nightly-2025-03-28 xwin build --release --target aarch64-pc-windows-msvc
cargo +nightly-2025-06-23 xwin build --xwin-arch x86 --release --target i686-pc-windows-msvc
cargo +nightly-2025-06-23 xwin build --release --target x86_64-pc-windows-msvc
cargo +nightly-2025-06-23 xwin build --release --target aarch64-pc-windows-msvc
```
### Cross-compiling from macOS
@ -36,19 +36,19 @@ LLVM and add the `rustup` targets:
```shell
brew install llvm
cargo install cargo-xwin
rustup toolchain install nightly-2025-03-28
rustup component add rust-src --toolchain nightly-2025-03-28-aarch64-apple-darwin
rustup target add --toolchain nightly-2025-03-28 i686-pc-windows-msvc
rustup target add --toolchain nightly-2025-03-28 x86_64-pc-windows-msvc
rustup target add --toolchain nightly-2025-03-28 aarch64-pc-windows-msvc
rustup toolchain install nightly-2025-06-23
rustup component add rust-src --toolchain nightly-2025-06-23-aarch64-apple-darwin
rustup target add --toolchain nightly-2025-06-23 i686-pc-windows-msvc
rustup target add --toolchain nightly-2025-06-23 x86_64-pc-windows-msvc
rustup target add --toolchain nightly-2025-06-23 aarch64-pc-windows-msvc
```
Then, build the trampolines for all supported architectures:
```shell
cargo +nightly-2025-03-28 xwin build --release --target i686-pc-windows-msvc
cargo +nightly-2025-03-28 xwin build --release --target x86_64-pc-windows-msvc
cargo +nightly-2025-03-28 xwin build --release --target aarch64-pc-windows-msvc
cargo +nightly-2025-06-23 xwin build --release --target i686-pc-windows-msvc
cargo +nightly-2025-06-23 xwin build --release --target x86_64-pc-windows-msvc
cargo +nightly-2025-06-23 xwin build --release --target aarch64-pc-windows-msvc
```
### Updating the prebuilt executables

View File

@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2025-03-28"
channel = "nightly-2025-06-23"

View File

@ -981,10 +981,10 @@ impl Workspace {
.to_string_lossy()
.to_string();
for member_root in glob(&absolute_glob)
.map_err(|err| WorkspaceError::Pattern(absolute_glob.to_string(), err))?
.map_err(|err| WorkspaceError::Pattern(absolute_glob.clone(), err))?
{
let member_root = member_root
.map_err(|err| WorkspaceError::GlobWalk(absolute_glob.to_string(), err))?;
.map_err(|err| WorkspaceError::GlobWalk(absolute_glob.clone(), err))?;
if !seen.insert(member_root.clone()) {
continue;
}

View File

@ -985,8 +985,7 @@ fn pyproject_build_system(package: &PackageName, build_backend: ProjectBuildBack
requires = ["uv_build>={min_version},<{max_version}"]
build-backend = "uv_build"
"#}
}
.to_string(),
},
// Pure-python backends
ProjectBuildBackend::Hatch => indoc::indoc! {r#"
[build-system]

View File

@ -653,7 +653,7 @@ impl TestContext {
filters.extend(
Self::path_patterns(executable)
.into_iter()
.map(|pattern| (pattern.to_string(), format!("[PYTHON-{version}]"))),
.map(|pattern| (pattern, format!("[PYTHON-{version}]"))),
);
// And for the symlink we created in the test the Python path

View File

@ -1,2 +1,2 @@
[toolchain]
channel = "1.90"
channel = "1.91"