Skip to content

Commit 24859bd

Browse files
Upgrade to Rust 1.80.0 (#5472)
1 parent 3ea5e16 commit 24859bd

File tree

38 files changed

+163
-196
lines changed

38 files changed

+163
-196
lines changed

Cargo.lock

-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resolver = "2"
99

1010
[workspace.package]
1111
edition = "2021"
12-
rust-version = "1.77"
12+
rust-version = "1.80"
1313
homepage = "https://pypi.org/project/uv/"
1414
documentation = "https://pypi.org/project/uv/"
1515
repository = "https://github.com/astral-sh/uv"
@@ -102,7 +102,6 @@ md-5 = { version = "0.10.6" }
102102
memchr = { version = "2.7.4" }
103103
miette = { version = "7.2.0" }
104104
nanoid = { version = "0.4.0" }
105-
once_cell = { version = "1.19.0" }
106105
owo-colors = { version = "4.0.0" }
107106
path-absolutize = { version = "3.1.1" }
108107
path-slash = { version = "0.2.1" }

crates/bench/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ anyhow = { workspace = true }
4848
chrono = { workspace = true }
4949
codspeed-criterion-compat = { version = "2.6.0", default-features = false, optional = true }
5050
criterion = { version = "0.5.1", default-features = false, features = ["async_tokio"] }
51-
once_cell = { workspace = true }
5251
tokio = { workspace = true }
5352

5453
[features]

crates/bench/benches/uv.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ criterion_group!(uv, resolve_warm_airflow, resolve_warm_jupyter);
7171
criterion_main!(uv);
7272

7373
mod resolver {
74+
use std::sync::LazyLock;
75+
7476
use anyhow::Result;
7577
use chrono::NaiveDate;
76-
use once_cell::sync::Lazy;
7778

7879
use distribution_types::IndexLocations;
7980
use install_wheel_rs::linker::LinkMode;
@@ -94,7 +95,7 @@ mod resolver {
9495
};
9596
use uv_types::{BuildIsolation, EmptyInstalledPackages, HashStrategy, InFlight};
9697

97-
static MARKERS: Lazy<MarkerEnvironment> = Lazy::new(|| {
98+
static MARKERS: LazyLock<MarkerEnvironment> = LazyLock::new(|| {
9899
MarkerEnvironment::try_from(MarkerEnvironmentBuilder {
99100
implementation_name: "cpython",
100101
implementation_version: "3.11.5",
@@ -118,8 +119,8 @@ mod resolver {
118119
Arch::Aarch64,
119120
);
120121

121-
static TAGS: Lazy<Tags> =
122-
Lazy::new(|| Tags::from_env(&PLATFORM, (3, 11), "cpython", (3, 11), false).unwrap());
122+
static TAGS: LazyLock<Tags> =
123+
LazyLock::new(|| Tags::from_env(&PLATFORM, (3, 11), "cpython", (3, 11), false).unwrap());
123124

124125
pub(crate) async fn resolve(
125126
manifest: Manifest,

crates/bench/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ pub mod criterion {
22
//! This module re-exports the criterion API but picks the right backend depending on whether
33
//! the benchmarks are built to run locally or with codspeed
44
5-
#[cfg(not(codspeed))]
5+
#[cfg(not(feature = "codspeed"))]
66
pub use criterion::*;
77

8-
#[cfg(codspeed)]
8+
#[cfg(feature = "codspeed")]
99
pub use codspeed_criterion_compat::*;
1010
}

crates/distribution-types/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ uv-normalize = { workspace = true }
2626
anyhow = { workspace = true }
2727
fs-err = { workspace = true }
2828
itertools = { workspace = true }
29-
once_cell = { workspace = true }
3029
rkyv = { workspace = true }
3130
schemars = { workspace = true, optional = true }
3231
serde = { workspace = true, features = ["derive"] }

crates/distribution-types/src/index_url.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1+
use itertools::Either;
12
use std::borrow::Cow;
23
use std::fmt::{Display, Formatter};
34
use std::ops::Deref;
45
use std::path::Path;
56
use std::str::FromStr;
6-
7-
use itertools::Either;
8-
use once_cell::sync::Lazy;
7+
use std::sync::LazyLock;
98
use thiserror::Error;
109
use url::{ParseError, Url};
1110

1211
use pep508_rs::{VerbatimUrl, VerbatimUrlError};
1312

1413
use crate::Verbatim;
1514

16-
static PYPI_URL: Lazy<Url> = Lazy::new(|| Url::parse("https://pypi.org/simple").unwrap());
15+
static PYPI_URL: LazyLock<Url> = LazyLock::new(|| Url::parse("https://pypi.org/simple").unwrap());
1716

18-
static DEFAULT_INDEX_URL: Lazy<IndexUrl> =
19-
Lazy::new(|| IndexUrl::Pypi(VerbatimUrl::from_url(PYPI_URL.clone())));
17+
static DEFAULT_INDEX_URL: LazyLock<IndexUrl> =
18+
LazyLock::new(|| IndexUrl::Pypi(VerbatimUrl::from_url(PYPI_URL.clone())));
2019

2120
/// The URL of an index to use for fetching packages (e.g., PyPI).
2221
#[derive(Debug, Clone, Hash, Eq, PartialEq)]

crates/install-wheel-rs/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ csv = { workspace = true }
3434
data-encoding = { workspace = true }
3535
fs-err = { workspace = true }
3636
mailparse = { workspace = true }
37-
once_cell = { workspace = true }
3837
pathdiff = { workspace = true }
3938
platform-info = { workspace = true }
4039
reflink-copy = { workspace = true }

crates/install-wheel-rs/src/script.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use configparser::ini::Ini;
2-
use once_cell::sync::Lazy;
32
use regex::Regex;
43
use rustc_hash::FxHashSet;
54
use serde::Serialize;
5+
use std::sync::LazyLock;
66

77
use crate::{wheel, Error};
88

@@ -30,7 +30,7 @@ impl Script {
3030
// between the object reference and the left square bracket, between the extra names and the square brackets and colons delimiting them,
3131
// and after the right square bracket."
3232
// – https://packaging.python.org/en/latest/specifications/entry-points/#file-format
33-
static SCRIPT_REGEX: Lazy<Regex> = Lazy::new(|| {
33+
static SCRIPT_REGEX: LazyLock<Regex> = LazyLock::new(|| {
3434
Regex::new(r"^(?P<module>[\w\d_\-.]+)\s*:\s*(?P<function>[\w\d_\-.]+)(?:\s*\[\s*(?P<extras>(?:[^,]+,?\s*)+)\])?\s*$").unwrap()
3535
});
3636

crates/install-wheel-rs/src/uninstall.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use std::collections::BTreeSet;
22
use std::path::{Component, Path, PathBuf};
33

44
use fs_err as fs;
5-
use once_cell::sync::Lazy;
6-
use std::sync::Mutex;
5+
use std::sync::{LazyLock, Mutex};
76
use tracing::debug;
87
use uv_fs::write_atomic_sync;
98

@@ -219,7 +218,7 @@ fn normcase(s: &str) -> String {
219218
}
220219
}
221220

222-
static EASY_INSTALL_PTH: Lazy<Mutex<i32>> = Lazy::new(Mutex::default);
221+
static EASY_INSTALL_PTH: LazyLock<Mutex<i32>> = LazyLock::new(Mutex::default);
223222

224223
/// Uninstall the legacy editable represented by the `.egg-link` file.
225224
///

crates/pep440-rs/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ crate-type = ["rlib", "cdylib"]
1919
workspace = true
2020

2121
[dependencies]
22-
once_cell = { workspace = true }
2322
pyo3 = { workspace = true, optional = true, features = ["extension-module", "abi3-py37"] }
2423
serde = { workspace = true, features = ["derive"] }
2524
rkyv = { workspace = true }

crates/pep440-rs/src/version.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#[cfg(feature = "pyo3")]
2+
use pyo3::{
3+
basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, FromPyObject, IntoPy, PyAny,
4+
PyObject, PyResult, Python,
5+
};
6+
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
7+
use std::sync::LazyLock;
18
use std::{
29
borrow::Borrow,
310
cmp::Ordering,
@@ -6,13 +13,6 @@ use std::{
613
sync::Arc,
714
};
815

9-
#[cfg(feature = "pyo3")]
10-
use pyo3::{
11-
basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, FromPyObject, IntoPy, PyAny,
12-
PyObject, PyResult, Python,
13-
};
14-
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
15-
1616
/// One of `~=` `==` `!=` `<=` `>=` `<` `>` `===`
1717
#[derive(
1818
Eq,
@@ -821,8 +821,8 @@ impl FromStr for Version {
821821
/// * The epoch must be `0`.
822822
/// * The release portion must have 4 or fewer segments.
823823
/// * All release segments, except for the first, must be representable in a
824-
/// `u8`. The first segment must be representable in a `u16`. (This permits
825-
/// calendar versions, like `2023.03`, to be represented.)
824+
/// `u8`. The first segment must be representable in a `u16`. (This permits
825+
/// calendar versions, like `2023.03`, to be represented.)
826826
/// * There is *at most* one of the following components: pre, dev or post.
827827
/// * If there is a pre segment, then its numeric value is less than 64.
828828
/// * If there is a dev or post segment, then its value is less than `u8::MAX`.
@@ -843,20 +843,20 @@ impl FromStr for Version {
843843
///
844844
/// * Bytes 6 and 7 correspond to the first release segment as a `u16`.
845845
/// * Bytes 5, 4 and 3 correspond to the second, third and fourth release
846-
/// segments, respectively.
846+
/// segments, respectively.
847847
/// * Bytes 2, 1 and 0 represent *one* of the following:
848848
/// `min, .devN, aN, bN, rcN, <no suffix>, .postN, max`.
849849
/// Its representation is thus:
850850
/// * The most significant 3 bits of Byte 2 corresponds to a value in
851-
/// the range 0-6 inclusive, corresponding to min, dev, pre-a, pre-b, pre-rc,
852-
/// no-suffix or post releases, respectively. `min` is a special version that
853-
/// does not exist in PEP 440, but is used here to represent the smallest
854-
/// possible version, preceding any `dev`, `pre`, `post` or releases. `max` is
855-
/// an analogous concept for the largest possible version, following any `post`
856-
/// or local releases.
851+
/// the range 0-6 inclusive, corresponding to min, dev, pre-a, pre-b, pre-rc,
852+
/// no-suffix or post releases, respectively. `min` is a special version that
853+
/// does not exist in PEP 440, but is used here to represent the smallest
854+
/// possible version, preceding any `dev`, `pre`, `post` or releases. `max` is
855+
/// an analogous concept for the largest possible version, following any `post`
856+
/// or local releases.
857857
/// * The low 5 bits combined with the bits in bytes 1 and 0 correspond
858-
/// to the release number of the suffix, if one exists. If there is no
859-
/// suffix, then this bits are always 0.
858+
/// to the release number of the suffix, if one exists. If there is no
859+
/// suffix, then these bits are always 0.
860860
///
861861
/// The order of the encoding above is significant. For example, suffixes are
862862
/// encoded at a less significant location than the release numbers, so that
@@ -2532,8 +2532,8 @@ fn parse_u64(bytes: &[u8]) -> Result<u64, VersionParseError> {
25322532
}
25332533

25342534
/// The minimum version that can be represented by a [`Version`]: `0a0.dev0`.
2535-
pub static MIN_VERSION: once_cell::sync::Lazy<Version> =
2536-
once_cell::sync::Lazy::new(|| Version::from_str("0a0.dev0").unwrap());
2535+
pub static MIN_VERSION: LazyLock<Version> =
2536+
LazyLock::new(|| Version::from_str("0a0.dev0").unwrap());
25372537

25382538
#[cfg(test)]
25392539
mod tests {

crates/pep508-rs/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ workspace = true
2121

2222
[dependencies]
2323
derivative = { workspace = true }
24-
once_cell = { workspace = true }
2524
pep440_rs = { workspace = true }
2625
pyo3 = { workspace = true, optional = true, features = ["abi3", "extension-module"] }
2726
pyo3-log = { workspace = true, optional = true }

crates/pep508-rs/src/verbatim_url.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
use regex::Regex;
12
use std::borrow::Cow;
23
use std::fmt::Debug;
34
use std::ops::Deref;
45
use std::path::{Path, PathBuf};
5-
6-
use once_cell::sync::Lazy;
7-
use regex::Regex;
6+
use std::sync::LazyLock;
87
use thiserror::Error;
98
use url::{ParseError, Url};
109

@@ -301,13 +300,13 @@ pub enum VerbatimUrlError {
301300
pub fn expand_env_vars(s: &str) -> Cow<'_, str> {
302301
// Generate the project root, to be used via the `${PROJECT_ROOT}`
303302
// environment variable.
304-
static PROJECT_ROOT_FRAGMENT: Lazy<String> = Lazy::new(|| {
303+
static PROJECT_ROOT_FRAGMENT: LazyLock<String> = LazyLock::new(|| {
305304
let project_root = std::env::current_dir().unwrap();
306305
project_root.to_string_lossy().to_string()
307306
});
308307

309-
static RE: Lazy<Regex> =
310-
Lazy::new(|| Regex::new(r"(?P<var>\$\{(?P<name>[A-Z0-9_]+)})").unwrap());
308+
static RE: LazyLock<Regex> =
309+
LazyLock::new(|| Regex::new(r"(?P<var>\$\{(?P<name>[A-Z0-9_]+)})").unwrap());
311310

312311
RE.replace_all(s, |caps: &regex::Captures<'_>| {
313312
let name = caps.name("name").unwrap().as_str();

crates/pypi-types/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ chrono = { workspace = true, features = ["serde"] }
2222
indexmap = { workspace = true, features = ["serde"] }
2323
itertools = { workspace = true }
2424
mailparse = { workspace = true }
25-
once_cell = { workspace = true }
2625
regex = { workspace = true }
2726
rkyv = { workspace = true }
2827
serde = { workspace = true }

0 commit comments

Comments
 (0)