Upgrade Rust toolchain to 1.85 (#11720)

## Summary

* Upgrade the rust toolchain to 1.85.0. This does not increase the MSRV.
* Update windows trampoline to 1.86 nightly beta (previously in 1.85
nightly beta).

## Test Plan

Existing tests
This commit is contained in:
samypr100 2025-02-23 10:52:34 -05:00 committed by GitHub
parent 3c541e2368
commit 878497a014
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 51 additions and 56 deletions

View File

@ -247,7 +247,7 @@ impl Cache {
Refresh::None(_) => return Ok(Freshness::Fresh), Refresh::None(_) => return Ok(Freshness::Fresh),
Refresh::All(timestamp) => timestamp, Refresh::All(timestamp) => timestamp,
Refresh::Packages(packages, timestamp) => { Refresh::Packages(packages, timestamp) => {
if package.map_or(true, |package| packages.contains(package)) { if package.is_none_or(|package| packages.contains(package)) {
timestamp timestamp
} else { } else {
return Ok(Freshness::Fresh); return Ok(Freshness::Fresh);

View File

@ -1,6 +1,5 @@
use uv_cache::Refresh; use uv_cache::Refresh;
use uv_configuration::ConfigSettings; use uv_configuration::ConfigSettings;
use uv_distribution_types::{PipExtraIndex, PipFindLinks, PipIndex};
use uv_resolver::PrereleaseMode; use uv_resolver::PrereleaseMode;
use uv_settings::{Combine, PipOptions, ResolverInstallerOptions, ResolverOptions}; use uv_settings::{Combine, PipOptions, ResolverInstallerOptions, ResolverOptions};
@ -203,12 +202,11 @@ impl From<IndexArgs> for PipOptions {
.combine( .combine(
index.map(|index| index.into_iter().filter_map(Maybe::into_option).collect()), index.map(|index| index.into_iter().filter_map(Maybe::into_option).collect()),
), ),
index_url: index_url.and_then(Maybe::into_option).map(PipIndex::from), index_url: index_url.and_then(Maybe::into_option),
extra_index_url: extra_index_url.map(|extra_index_urls| { extra_index_url: extra_index_url.map(|extra_index_urls| {
extra_index_urls extra_index_urls
.into_iter() .into_iter()
.filter_map(Maybe::into_option) .filter_map(Maybe::into_option)
.map(PipExtraIndex::from)
.collect() .collect()
}), }),
no_index: if no_index { Some(true) } else { None }, no_index: if no_index { Some(true) } else { None },
@ -216,7 +214,6 @@ impl From<IndexArgs> for PipOptions {
find_links find_links
.into_iter() .into_iter()
.filter_map(Maybe::into_option) .filter_map(Maybe::into_option)
.map(PipFindLinks::from)
.collect() .collect()
}), }),
..PipOptions::default() ..PipOptions::default()

View File

@ -707,7 +707,7 @@ impl RegistryClient {
}; };
// Attempt to fetch via a range request. // Attempt to fetch via a range request.
if index.map_or(true, |index| capabilities.supports_range_requests(index)) { if index.is_none_or(|index| capabilities.supports_range_requests(index)) {
let req = self let req = self
.uncached_client(url) .uncached_client(url)
.head(url.clone()) .head(url.clone())

View File

@ -27,7 +27,7 @@ impl HashPolicy<'_> {
match self { match self {
HashPolicy::Generate(HashGeneration::Url) => dist.file().is_none(), HashPolicy::Generate(HashGeneration::Url) => dist.file().is_none(),
HashPolicy::Generate(HashGeneration::All) => { HashPolicy::Generate(HashGeneration::All) => {
dist.file().map_or(true, |file| file.hashes.is_empty()) dist.file().is_none_or(|file| file.hashes.is_empty())
} }
HashPolicy::Validate(_) => false, HashPolicy::Validate(_) => false,
HashPolicy::None => false, HashPolicy::None => false,

View File

@ -267,7 +267,7 @@ impl<'a> IndexLocations {
let mut seen = FxHashSet::default(); let mut seen = FxHashSet::default();
self.indexes self.indexes
.iter() .iter()
.filter(move |index| index.name.as_ref().map_or(true, |name| seen.insert(name))) .filter(move |index| index.name.as_ref().is_none_or(|name| seen.insert(name)))
.find(|index| index.default) .find(|index| index.default)
.or_else(|| Some(&DEFAULT_INDEX)) .or_else(|| Some(&DEFAULT_INDEX))
} }
@ -284,7 +284,7 @@ impl<'a> IndexLocations {
Either::Right( Either::Right(
self.indexes self.indexes
.iter() .iter()
.filter(move |index| index.name.as_ref().map_or(true, |name| seen.insert(name))) .filter(move |index| index.name.as_ref().is_none_or(|name| seen.insert(name)))
.filter(|index| !index.default && !index.explicit), .filter(|index| !index.default && !index.explicit),
) )
} }
@ -313,9 +313,9 @@ impl<'a> IndexLocations {
} else { } else {
let mut seen = FxHashSet::default(); let mut seen = FxHashSet::default();
Either::Right( Either::Right(
self.indexes.iter().filter(move |index| { self.indexes
index.name.as_ref().map_or(true, |name| seen.insert(name)) .iter()
}), .filter(move |index| index.name.as_ref().is_none_or(|name| seen.insert(name))),
) )
} }
} }
@ -356,7 +356,7 @@ impl<'a> IndexLocations {
self.indexes self.indexes
.iter() .iter()
.chain(self.flat_index.iter()) .chain(self.flat_index.iter())
.filter(move |index| index.name.as_ref().map_or(true, |name| seen.insert(name))) .filter(move |index| index.name.as_ref().is_none_or(|name| seen.insert(name)))
} { } {
if index.default { if index.default {
if default { if default {
@ -406,7 +406,7 @@ impl<'a> IndexUrls {
let mut seen = FxHashSet::default(); let mut seen = FxHashSet::default();
self.indexes self.indexes
.iter() .iter()
.filter(move |index| index.name.as_ref().map_or(true, |name| seen.insert(name))) .filter(move |index| index.name.as_ref().is_none_or(|name| seen.insert(name)))
.find(|index| index.default) .find(|index| index.default)
.or_else(|| Some(&DEFAULT_INDEX)) .or_else(|| Some(&DEFAULT_INDEX))
} }
@ -423,7 +423,7 @@ impl<'a> IndexUrls {
Either::Right( Either::Right(
self.indexes self.indexes
.iter() .iter()
.filter(move |index| index.name.as_ref().map_or(true, |name| seen.insert(name))) .filter(move |index| index.name.as_ref().is_none_or(|name| seen.insert(name)))
.filter(|index| !index.default && !index.explicit), .filter(|index| !index.default && !index.explicit),
) )
} }
@ -462,7 +462,7 @@ impl<'a> IndexUrls {
self.indexes self.indexes
.iter() .iter()
.filter(move |index| { .filter(move |index| {
index.name.as_ref().map_or(true, |name| seen.insert(name)) index.name.as_ref().is_none_or(|name| seen.insert(name))
}) })
.filter(|index| !index.default) .filter(|index| !index.default)
} }
@ -471,7 +471,7 @@ impl<'a> IndexUrls {
self.indexes self.indexes
.iter() .iter()
.filter(move |index| { .filter(move |index| {
index.name.as_ref().map_or(true, |name| seen.insert(name)) index.name.as_ref().is_none_or(|name| seen.insert(name))
}) })
.find(|index| index.default) .find(|index| index.default)
.into_iter() .into_iter()

View File

@ -356,7 +356,7 @@ impl LoweredRequirement {
let source = source let source = source
.iter() .iter()
.filter(|source| { .filter(|source| {
source.extra().map_or(true, |target| { source.extra().is_none_or(|target| {
requirement requirement
.marker .marker
.top_level_extra_name() .top_level_extra_name()
@ -613,7 +613,7 @@ fn url_source(
let verbatim_url = VerbatimUrl::from_url(verbatim_url); let verbatim_url = VerbatimUrl::from_url(verbatim_url);
Ok(RequirementSource::Url { Ok(RequirementSource::Url {
location: url, location: url,
subdirectory: subdirectory.map(PathBuf::from), subdirectory,
ext, ext,
url: verbatim_url, url: verbatim_url,
}) })

View File

@ -61,8 +61,8 @@ impl BuiltWheelMetadata {
/// Returns `true` if the wheel matches the given package name and version. /// Returns `true` if the wheel matches the given package name and version.
pub(crate) fn matches(&self, name: Option<&PackageName>, version: Option<&Version>) -> bool { pub(crate) fn matches(&self, name: Option<&PackageName>, version: Option<&Version>) -> bool {
name.map_or(true, |name| self.filename.name == *name) name.is_none_or(|name| self.filename.name == *name)
&& version.map_or(true, |version| self.filename.version == *version) && version.is_none_or(|version| self.filename.version == *version)
} }
} }

View File

@ -2765,8 +2765,8 @@ impl CachedMetadata {
/// Returns `true` if the metadata matches the given package name and version. /// Returns `true` if the metadata matches the given package name and version.
fn matches(&self, name: Option<&PackageName>, version: Option<&Version>) -> bool { fn matches(&self, name: Option<&PackageName>, version: Option<&Version>) -> bool {
name.map_or(true, |name| self.0.name == *name) name.is_none_or(|name| self.0.name == *name)
&& version.map_or(true, |version| self.0.version == *version) && version.is_none_or(|version| self.0.version == *version)
} }
} }

View File

@ -12,7 +12,7 @@ use tracing::{debug, instrument};
use url::Url; use url::Url;
use uv_cache_key::{cache_digest, RepositoryUrl}; use uv_cache_key::{cache_digest, RepositoryUrl};
use uv_git_types::{GitOid, GitUrl}; use uv_git_types::GitUrl;
use crate::git::GitRemote; use crate::git::GitRemote;
use crate::GIT_STORE; use crate::GIT_STORE;
@ -107,7 +107,7 @@ impl GitSource {
&db_path, &db_path,
db, db,
self.git.reference(), self.git.reference(),
locked_rev.map(GitOid::from), locked_rev,
&self.client, &self.client,
self.disable_ssl, self.disable_ssl,
)?; )?;

View File

@ -435,7 +435,7 @@ pub fn looks_like_git_repository(url: &Url) -> bool {
Some("github.com" | "gitlab.com" | "bitbucket.org") Some("github.com" | "gitlab.com" | "bitbucket.org")
) && Path::new(url.path()) ) && Path::new(url.path())
.extension() .extension()
.map_or(true, |ext| ext.eq_ignore_ascii_case("git")) .is_none_or(|ext| ext.eq_ignore_ascii_case("git"))
&& url && url
.path_segments() .path_segments()
.is_some_and(|segments| segments.count() == 2) .is_some_and(|segments| segments.count() == 2)

View File

@ -1037,7 +1037,7 @@ pub(crate) fn find_python_installation(
let mut first_error = None; let mut first_error = None;
for result in installations { for result in installations {
// Iterate until the first critical error or happy result // Iterate until the first critical error or happy result
if !result.as_ref().err().map_or(true, Error::is_critical) { if !result.as_ref().err().is_none_or(Error::is_critical) {
// Track the first non-critical error // Track the first non-critical error
if first_error.is_none() { if first_error.is_none() {
if let Err(err) = result { if let Err(err) = result {
@ -2214,7 +2214,7 @@ impl VersionRequest {
Self::MajorMinorPrerelease(self_major, self_minor, self_prerelease, _) => { Self::MajorMinorPrerelease(self_major, self_minor, self_prerelease, _) => {
// Pre-releases of Python versions are always for the zero patch version // Pre-releases of Python versions are always for the zero patch version
(*self_major, *self_minor, 0) == (major, minor, patch) (*self_major, *self_minor, 0) == (major, minor, patch)
&& prerelease.map_or(true, |pre| *self_prerelease == pre) && prerelease.is_none_or(|pre| *self_prerelease == pre)
} }
} }
} }

View File

@ -56,9 +56,7 @@ impl<'a, Context: BuildContext> ExtrasResolver<'a, Context> {
} = self; } = self;
requirements requirements
.map(|requirement| async { .map(|requirement| async {
Self::resolve_requirement(requirement, hasher, index, &database) Self::resolve_requirement(requirement, hasher, index, &database).await
.await
.map(Requirement::from)
}) })
.collect::<FuturesOrdered<_>>() .collect::<FuturesOrdered<_>>()
.try_collect() .try_collect()

View File

@ -68,7 +68,7 @@ impl Indexes {
entry entry
.conflict .conflict
.as_ref() .as_ref()
.map_or(true, |conflict| env.included_by_group(conflict.as_ref())) .is_none_or(|conflict| env.included_by_group(conflict.as_ref()))
}) })
.map(|entry| &entry.index) .map(|entry| &entry.index)
.collect() .collect()

View File

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

View File

@ -1,2 +1,2 @@
[toolchain] [toolchain]
channel = "nightly-2025-01-03" channel = "nightly-2025-02-16"

View File

@ -17,7 +17,7 @@ impl BuildIsolation<'_> {
Self::Isolated => true, Self::Isolated => true,
Self::Shared(_) => false, Self::Shared(_) => false,
Self::SharedPackage(_, packages) => { Self::SharedPackage(_, packages) => {
package.map_or(true, |package| !packages.iter().any(|p| p == package)) package.is_none_or(|package| !packages.iter().any(|p| p == package))
} }
} }
} }

View File

@ -1187,7 +1187,7 @@ fn find_dependencies(
let mut to_replace = Vec::new(); let mut to_replace = Vec::new();
for (i, dep) in deps.iter().enumerate() { for (i, dep) in deps.iter().enumerate() {
if let Some(req) = dep.as_str().and_then(try_parse_requirement) { if let Some(req) = dep.as_str().and_then(try_parse_requirement) {
if marker.map_or(true, |m| *m == req.marker) && *name == req.name { if marker.is_none_or(|m| *m == req.marker) && *name == req.name {
to_replace.push((i, req)); to_replace.push((i, req));
} }
} }

View File

@ -654,7 +654,7 @@ impl ScriptInterpreter {
match PythonEnvironment::from_root(&root, cache) { match PythonEnvironment::from_root(&root, cache) {
Ok(venv) => { Ok(venv) => {
if python_request.as_ref().map_or(true, |request| { if python_request.as_ref().is_none_or(|request| {
if request.satisfied(venv.interpreter(), cache) { if request.satisfied(venv.interpreter(), cache) {
debug!( debug!(
"The script environment's Python version satisfies `{}`", "The script environment's Python version satisfies `{}`",
@ -796,7 +796,7 @@ impl ProjectInterpreter {
let venv = workspace.venv(active); let venv = workspace.venv(active);
match PythonEnvironment::from_root(&venv, cache) { match PythonEnvironment::from_root(&venv, cache) {
Ok(venv) => { Ok(venv) => {
if python_request.as_ref().map_or(true, |request| { if python_request.as_ref().is_none_or(|request| {
if request.satisfied(venv.interpreter(), cache) { if request.satisfied(venv.interpreter(), cache) {
debug!( debug!(
"The virtual environment's Python version satisfies `{}`", "The virtual environment's Python version satisfies `{}`",

View File

@ -119,7 +119,7 @@ pub(crate) async fn list(
result result
.as_ref() .as_ref()
.err() .err()
.map_or(true, DiscoveryError::is_critical) .is_none_or(DiscoveryError::is_critical)
}) })
.collect::<Result<Vec<Result<PythonInstallation, PythonNotFound>>, DiscoveryError>>()? .collect::<Result<Vec<Result<PythonInstallation, PythonNotFound>>, DiscoveryError>>()?
.into_iter() .into_iter()

View File

@ -681,7 +681,7 @@ async fn get_or_create_environment(
let existing_environment = installed_tools let existing_environment = installed_tools
.get_environment(&requirement.name, cache)? .get_environment(&requirement.name, cache)?
.filter(|environment| { .filter(|environment| {
python_request.as_ref().map_or(true, |python_request| { python_request.as_ref().is_none_or(|python_request| {
python_request.satisfied(environment.interpreter(), cache) python_request.satisfied(environment.interpreter(), cache)
}) })
}); });

View File

@ -1,2 +1,2 @@
[toolchain] [toolchain]
channel = "1.84" channel = "1.85"