Bump MSRV to 1.85 and Edition 2024 (#13516)

## Summary

Builds on https://github.com/astral-sh/uv/pull/11724.

Closes https://github.com/astral-sh/uv/issues/13476.
This commit is contained in:
Charlie Marsh 2025-05-18 19:38:43 -04:00 committed by GitHub
parent cc6e766232
commit c5032aee80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
240 changed files with 726 additions and 737 deletions

View file

@ -1,4 +1,4 @@
use uv_cache::{ArchiveId, Cache, ARCHIVE_VERSION};
use uv_cache::{ARCHIVE_VERSION, ArchiveId, Cache};
use uv_distribution_filename::WheelFilename;
use uv_distribution_types::Hashed;
use uv_pypi_types::{HashDigest, HashDigests};

View file

@ -10,7 +10,7 @@ use tempfile::TempDir;
use tokio::io::{AsyncRead, AsyncSeekExt, ReadBuf};
use tokio::sync::Semaphore;
use tokio_util::compat::FuturesAsyncReadCompatExt;
use tracing::{info_span, instrument, warn, Instrument};
use tracing::{Instrument, info_span, instrument, warn};
use url::Url;
use uv_cache::{ArchiveId, CacheBucket, CacheEntry, WheelCache};
@ -97,7 +97,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
),
)
} else {
io::Error::new(io::ErrorKind::Other, err)
io::Error::other(err)
}
}
@ -647,7 +647,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
archive
} else {
self.client
.managed(|client| async {
.managed(async |client| {
client
.cached_client()
.skip_cache_with_retry(self.request(url)?, &http_entry, download)
@ -814,7 +814,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
archive
} else {
self.client
.managed(|client| async {
.managed(async |client| {
client
.cached_client()
.skip_cache_with_retry(self.request(url)?, &http_entry, download)

View file

@ -8,9 +8,9 @@ use uv_distribution_types::{
use uv_platform_tags::Tags;
use uv_types::HashStrategy;
use crate::index::cached_wheel::CachedWheel;
use crate::source::{HttpRevisionPointer, LocalRevisionPointer, HTTP_REVISION, LOCAL_REVISION};
use crate::Error;
use crate::index::cached_wheel::CachedWheel;
use crate::source::{HTTP_REVISION, HttpRevisionPointer, LOCAL_REVISION, LocalRevisionPointer};
/// A local index of built distributions for a specific source distribution.
#[derive(Debug)]

View file

@ -12,7 +12,7 @@ use uv_platform_tags::Tags;
use uv_types::HashStrategy;
use crate::index::cached_wheel::CachedWheel;
use crate::source::{HttpRevisionPointer, LocalRevisionPointer, HTTP_REVISION, LOCAL_REVISION};
use crate::source::{HTTP_REVISION, HttpRevisionPointer, LOCAL_REVISION, LocalRevisionPointer};
/// An entry in the [`RegistryWheelIndex`].
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@ -64,7 +64,7 @@ impl<'a> RegistryWheelIndex<'a> {
/// Get an entry in the index.
fn get_impl(&mut self, name: &'a PackageName) -> &[IndexEntry] {
let versions = match self.index.entry(name) {
(match self.index.entry(name) {
Entry::Occupied(entry) => entry.into_mut(),
Entry::Vacant(entry) => entry.insert(Self::index(
name,
@ -74,8 +74,7 @@ impl<'a> RegistryWheelIndex<'a> {
self.hasher,
self.build_configuration,
)),
};
versions
}) as _
}
/// Add a package to the index by reading from the cache.

View file

@ -13,10 +13,10 @@ use uv_distribution_types::{
use uv_git_types::{GitReference, GitUrl, GitUrlParseError};
use uv_normalize::{ExtraName, GroupName, PackageName};
use uv_pep440::VersionSpecifiers;
use uv_pep508::{looks_like_git_repository, MarkerTree, VerbatimUrl, VersionOrUrl};
use uv_pep508::{MarkerTree, VerbatimUrl, VersionOrUrl, looks_like_git_repository};
use uv_pypi_types::{ConflictItem, ParsedUrlError, VerbatimParsedUrl};
use uv_workspace::pyproject::{PyProjectToml, Source, Sources};
use uv_workspace::Workspace;
use uv_workspace::pyproject::{PyProjectToml, Source, Sources};
use crate::metadata::GitWorkspaceMember;
@ -285,8 +285,7 @@ impl LoweredRequirement {
// relative to main workspace: `../current_workspace/packages/current_project`
let url = VerbatimUrl::from_absolute_path(member.root())?;
let install_path = url.to_file_path().map_err(|()| {
LoweringError::RelativeTo(io::Error::new(
io::ErrorKind::Other,
LoweringError::RelativeTo(io::Error::other(
"Invalid path in file URL",
))
})?;
@ -689,12 +688,9 @@ fn path_source(
RequirementOrigin::Workspace => workspace_root,
};
let url = VerbatimUrl::from_path(path, base)?.with_given(path.to_string_lossy());
let install_path = url.to_file_path().map_err(|()| {
LoweringError::RelativeTo(io::Error::new(
io::ErrorKind::Other,
"Invalid path in file URL",
))
})?;
let install_path = url
.to_file_path()
.map_err(|()| LoweringError::RelativeTo(io::Error::other("Invalid path in file URL")))?;
let is_dir = if let Ok(metadata) = install_path.metadata() {
metadata.is_dir()

View file

@ -6,14 +6,14 @@ use rustc_hash::FxHashSet;
use uv_configuration::SourceStrategy;
use uv_distribution_types::{IndexLocations, Requirement};
use uv_normalize::{ExtraName, GroupName, PackageName, DEV_DEPENDENCIES};
use uv_normalize::{DEV_DEPENDENCIES, ExtraName, GroupName, PackageName};
use uv_pep508::MarkerTree;
use uv_workspace::dependency_groups::FlatDependencyGroups;
use uv_workspace::pyproject::{Sources, ToolUvSources};
use uv_workspace::{DiscoveryOptions, MemberDiscovery, ProjectWorkspace, WorkspaceCache};
use crate::metadata::{GitWorkspaceMember, LoweredRequirement, MetadataError};
use crate::Metadata;
use crate::metadata::{GitWorkspaceMember, LoweredRequirement, MetadataError};
#[derive(Debug, Clone)]
pub struct RequiresDist {
@ -466,8 +466,8 @@ mod test {
use uv_workspace::pyproject::PyProjectToml;
use uv_workspace::{DiscoveryOptions, ProjectWorkspace, WorkspaceCache};
use crate::metadata::requires_dist::FlatRequiresDist;
use crate::RequiresDist;
use crate::metadata::requires_dist::FlatRequiresDist;
async fn requires_dist_from_pyproject_toml(contents: &str) -> anyhow::Result<RequiresDist> {
let pyproject_toml = PyProjectToml::from_string(contents.to_string())?;

View file

@ -18,7 +18,7 @@ use fs_err::tokio as fs;
use futures::{FutureExt, TryStreamExt};
use reqwest::{Response, StatusCode};
use tokio_util::compat::FuturesAsyncReadCompatExt;
use tracing::{debug, info_span, instrument, warn, Instrument};
use tracing::{Instrument, debug, info_span, instrument, warn};
use url::Url;
use zip::ZipArchive;
@ -39,7 +39,7 @@ use uv_fs::{rename_with_retry, write_atomic};
use uv_git_types::{GitHubRepository, GitOid};
use uv_metadata::read_archive_metadata;
use uv_normalize::PackageName;
use uv_pep440::{release_specifiers_to_ranges, Version};
use uv_pep440::{Version, release_specifiers_to_ranges};
use uv_platform_tags::Tags;
use uv_pypi_types::{HashAlgorithm, HashDigest, HashDigests, PyProjectToml, ResolutionMetadata};
use uv_types::{BuildContext, BuildStack, SourceBuildTrait};
@ -736,7 +736,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
Ok(revision)
} else {
client
.managed(|client| async move {
.managed(async |client| {
client
.cached_client()
.skip_cache_with_retry(
@ -1925,7 +1925,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
debug!("Attempting to fetch `pyproject.toml` from: {url}");
let content = client
.managed(|client| async {
.managed(async |client| {
let response = client
.uncached_client(git.repository())
.get(&url)
@ -2073,7 +2073,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
.instrument(info_span!("download", source_dist = %source))
};
client
.managed(|client| async move {
.managed(async |client| {
client
.cached_client()
.skip_cache_with_retry(
@ -2107,7 +2107,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
.map_err(Error::CacheWrite)?;
let reader = response
.bytes_stream()
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))
.map_err(std::io::Error::other)
.into_async_read();
// Create a hasher for each hash algorithm.