summaryrefslogtreecommitdiffstats
path: root/vendor/camino
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/camino
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/camino')
-rw-r--r--vendor/camino/.cargo-checksum.json2
-rw-r--r--vendor/camino/CHANGELOG.md14
-rw-r--r--vendor/camino/Cargo.toml8
-rw-r--r--vendor/camino/README.md2
-rw-r--r--vendor/camino/build.rs11
-rw-r--r--vendor/camino/src/lib.rs24
-rw-r--r--vendor/camino/src/serde_impls.rs125
-rw-r--r--vendor/camino/src/tests.rs8
8 files changed, 190 insertions, 4 deletions
diff --git a/vendor/camino/.cargo-checksum.json b/vendor/camino/.cargo-checksum.json
index 8686980ae..d5eb10268 100644
--- a/vendor/camino/.cargo-checksum.json
+++ b/vendor/camino/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"ea1979dff05f6bdd9e2c6c65b8fdb28395bf59f16e7e7fa2a9d398bdd6ae106f","CODE_OF_CONDUCT.md":"f51e207c2961ec061cac5c8aa9dd3098c3437de2c106d740c2aae90771bc0f86","Cargo.toml":"b024a45f39757c112132e6ae883c0052b8bd86bfc166b89b9615621744fd8583","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"84762d717d0f2358c56f54ee46a6ca5f1582b7d3843f7a4d6e553ea04a57ca1b","build.rs":"ca6914ad35e69842b6fba6e436d0417f39dbe6ee18694d4dd89b372d31cbf715","clippy.toml":"818cba7332cc56b019d59e09805a3498f523da788f51454742905f1987c0b563","release.toml":"287514631fde7a1d29a8e8027bc37c585c7e30c173c8254f551b042e38f4bb81","rustfmt.toml":"bf9776adb152b3fdc0d75c0929ede148c3e28c58f909a7d052865bc332e8958f","src/lib.rs":"52da457eae1c189a1728df994b478fbf37baa85b630541b7a6cbb48670c1c329","src/proptest_impls.rs":"4f36f5804bd3cbbf65177db4b20d808ed56405388b552bad375aab308a535236","src/serde_impls.rs":"eb7f00d1ceb7135506047dbefd7e6acee0364b5a9194111f49dbf2d1eb3661ac","src/tests.rs":"d6108c540dc93446b17d297b50372f799ef777c2cb0280fd37824a102ec24533","tests/integration_tests.rs":"56aa396a173d0c255369159b57e4a7db294e607aa6cfb65efebd95d79cc51a04"},"package":"c77df041dc383319cc661b428b6961a005db4d6808d5e12536931b1ca9556055"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"519fb19bd7caf35f27c409e5d026910edac7fd9183db0cf145f36cb25834e44c","CODE_OF_CONDUCT.md":"f51e207c2961ec061cac5c8aa9dd3098c3437de2c106d740c2aae90771bc0f86","Cargo.toml":"7eba97118307432703c9f2154e6724878879b37645adf37ca9a49e48fd256f7c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"4ca8f827ccdad7459c2b7524587a25523a857f3ff4bbb11d569e666118806f49","build.rs":"a57fc77ab3880126e9d83088eff56dea7a7cfee9c18a920c244a724ad89b164d","clippy.toml":"818cba7332cc56b019d59e09805a3498f523da788f51454742905f1987c0b563","release.toml":"287514631fde7a1d29a8e8027bc37c585c7e30c173c8254f551b042e38f4bb81","rustfmt.toml":"bf9776adb152b3fdc0d75c0929ede148c3e28c58f909a7d052865bc332e8958f","src/lib.rs":"c01c8671336a98dd33b0c8900feac21f668e2789643eb1adad065e6d04a70bea","src/proptest_impls.rs":"4f36f5804bd3cbbf65177db4b20d808ed56405388b552bad375aab308a535236","src/serde_impls.rs":"f6d8a59a4e97a9d021a30466628780097bb82231ccc0a17ae861198e1ec24539","src/tests.rs":"2cb79e032972ca5eccd9ad95bed1e0314b15e5e7eaa84ecb53acc37636598afe","tests/integration_tests.rs":"56aa396a173d0c255369159b57e4a7db294e607aa6cfb65efebd95d79cc51a04"},"package":"c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2"} \ No newline at end of file
diff --git a/vendor/camino/CHANGELOG.md b/vendor/camino/CHANGELOG.md
index 03d672242..d4b4de0a0 100644
--- a/vendor/camino/CHANGELOG.md
+++ b/vendor/camino/CHANGELOG.md
@@ -3,6 +3,18 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [1.1.4] - 2023-03-09
+
+### Added
+
+- Implement `DerefMut` for `Utf8PathBuf` on Rust 1.68 and above.
+
+## [1.1.3] - 2023-02-21
+
+### Added
+
+- New method `Utf8DirEntry::into_path` to return an owned `Utf8PathBuf`.
+
## [1.1.2] - 2022-08-12
### Added
@@ -108,6 +120,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Initial release.
+[1.1.4]: https://github.com/camino-rs/camino/releases/tag/camino-1.1.4
+[1.1.3]: https://github.com/camino-rs/camino/releases/tag/camino-1.1.3
[1.1.2]: https://github.com/camino-rs/camino/releases/tag/camino-1.1.2
[1.1.1]: https://github.com/camino-rs/camino/releases/tag/camino-1.1.1
[1.1.0]: https://github.com/camino-rs/camino/releases/tag/camino-1.1.0
diff --git a/vendor/camino/Cargo.toml b/vendor/camino/Cargo.toml
index 1b2eb24d8..7bb01ed55 100644
--- a/vendor/camino/Cargo.toml
+++ b/vendor/camino/Cargo.toml
@@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "camino"
-version = "1.1.2"
+version = "1.1.4"
authors = [
"Without Boats <saoirse@without.boats>",
"Ashley Williams <ashley666ashley@gmail.com>",
@@ -53,6 +53,12 @@ version = "1"
features = ["derive"]
optional = true
+[dev-dependencies.bincode]
+version = "1"
+
+[dev-dependencies.serde_bytes]
+version = "0.11.8"
+
[features]
proptest1 = ["proptest"]
serde1 = ["serde"]
diff --git a/vendor/camino/README.md b/vendor/camino/README.md
index 9fad93a02..82c03e412 100644
--- a/vendor/camino/README.md
+++ b/vendor/camino/README.md
@@ -1,4 +1,4 @@
-# camino - UTF-8 encoded paths
+# camino - UTF-8 paths
[![camino on crates.io](https://img.shields.io/crates/v/camino)](https://crates.io/crates/camino)
[![crates.io download count](https://img.shields.io/crates/d/camino)](https://crates.io/crates/camino)
diff --git a/vendor/camino/build.rs b/vendor/camino/build.rs
index 7f5cbdf9b..c24fc8e61 100644
--- a/vendor/camino/build.rs
+++ b/vendor/camino/build.rs
@@ -24,13 +24,22 @@ fn main() {
if compiler.minor >= 56 {
println!("cargo:rustc-cfg=shrink_to");
}
- // Stable and beta 1.63 have a stable try_reserve_2.
+ // NOTE: the below checks use == rather than `matches!`. This is because `matches!` isn't stable
+ // on Rust 1.34.
+ // try_reserve_2 was added in a 1.63 nightly.
if (compiler.minor >= 63
&& (compiler.channel == ReleaseChannel::Stable || compiler.channel == ReleaseChannel::Beta))
|| compiler.minor >= 64
{
println!("cargo:rustc-cfg=try_reserve_2");
}
+ // path_buf_deref_mut was added in a 1.68 nightly.
+ if (compiler.minor >= 68
+ && (compiler.channel == ReleaseChannel::Stable || compiler.channel == ReleaseChannel::Beta))
+ || compiler.minor >= 69
+ {
+ println!("cargo:rustc-cfg=path_buf_deref_mut");
+ }
}
struct Compiler {
diff --git a/vendor/camino/src/lib.rs b/vendor/camino/src/lib.rs
index 44684b096..86a58ee51 100644
--- a/vendor/camino/src/lib.rs
+++ b/vendor/camino/src/lib.rs
@@ -484,6 +484,14 @@ impl Deref for Utf8PathBuf {
}
}
+/// *Requires Rust 1.68 or newer.*
+#[cfg(path_buf_deref_mut)]
+impl std::ops::DerefMut for Utf8PathBuf {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ unsafe { Utf8Path::assume_utf8_mut(&mut self.0) }
+ }
+}
+
impl fmt::Debug for Utf8PathBuf {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(&**self, f)
@@ -1457,6 +1465,11 @@ impl Utf8Path {
// *const Path to a *const Utf8Path is valid.
&*(path as *const Path as *const Utf8Path)
}
+
+ #[cfg(path_buf_deref_mut)]
+ unsafe fn assume_utf8_mut(path: &mut Path) -> &mut Utf8Path {
+ &mut *(path as *mut Path as *mut Utf8Path)
+ }
}
impl Clone for Box<Utf8Path> {
@@ -2220,6 +2233,17 @@ impl Utf8DirEntry {
pub fn into_inner(self) -> fs::DirEntry {
self.inner
}
+
+ /// Returns the full path to the file that this entry represents.
+ ///
+ /// This is analogous to [`path`], but moves ownership of the path.
+ ///
+ /// [`path`]: struct.Utf8DirEntry.html#method.path
+ #[inline]
+ #[must_use = "`self` will be dropped if the result is not used"]
+ pub fn into_path(self) -> Utf8PathBuf {
+ self.path
+ }
}
impl From<String> for Utf8PathBuf {
diff --git a/vendor/camino/src/serde_impls.rs b/vendor/camino/src/serde_impls.rs
index d4c4ecab9..49b6f8621 100644
--- a/vendor/camino/src/serde_impls.rs
+++ b/vendor/camino/src/serde_impls.rs
@@ -55,3 +55,128 @@ impl Serialize for Utf8Path {
self.as_str().serialize(serializer)
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::Utf8PathBuf;
+ use serde_bytes::ByteBuf;
+
+ #[test]
+ fn valid_utf8() {
+ let valid_utf8 = &["", "bar", "💩"];
+ for input in valid_utf8 {
+ let encode = Encode {
+ path: ByteBuf::from(*input),
+ };
+ let encoded = bincode::serialize(&encode).expect("encoded correctly");
+
+ assert_valid_utf8::<DecodeOwned>(input, &encoded);
+ assert_valid_utf8::<DecodeBorrowed>(input, &encoded);
+ }
+ }
+
+ fn assert_valid_utf8<'de, T: TestTrait<'de>>(input: &str, encoded: &'de [u8]) {
+ let output = bincode::deserialize::<T>(encoded).expect("valid UTF-8 should be fine");
+ assert_eq!(
+ output.path(),
+ input,
+ "for input, with {}, paths should match",
+ T::description()
+ );
+ }
+
+ #[test]
+ fn invalid_utf8() {
+ let invalid_utf8: &[(&[u8], _, _)] = &[
+ (b"\xff", 0, 1),
+ (b"foo\xfe", 3, 1),
+ (b"a\xC3\xA9 \xED\xA0\xBD\xF0\x9F\x92\xA9", 4, 1),
+ ];
+
+ for (input, valid_up_to, error_len) in invalid_utf8 {
+ let encode = Encode {
+ path: ByteBuf::from(*input),
+ };
+ let encoded = bincode::serialize(&encode).expect("encoded correctly");
+
+ assert_invalid_utf8::<DecodeOwned>(input, &encoded, *valid_up_to, *error_len);
+ assert_invalid_utf8::<DecodeBorrowed>(input, &encoded, *valid_up_to, *error_len)
+ }
+ }
+
+ fn assert_invalid_utf8<'de, T: TestTrait<'de>>(
+ input: &[u8],
+ encoded: &'de [u8],
+ valid_up_to: usize,
+ error_len: usize,
+ ) {
+ let error = bincode::deserialize::<T>(encoded).expect_err("invalid UTF-8 should error out");
+ let utf8_error = match *error {
+ bincode::ErrorKind::InvalidUtf8Encoding(utf8_error) => utf8_error,
+ other => panic!(
+ "for input {:?}, with {}, expected ErrorKind::InvalidUtf8Encoding, found: {}",
+ input,
+ T::description(),
+ other
+ ),
+ };
+ assert_eq!(
+ utf8_error.valid_up_to(),
+ valid_up_to,
+ "for input {:?}, with {}, valid_up_to didn't match",
+ input,
+ T::description(),
+ );
+ assert_eq!(
+ utf8_error.error_len(),
+ Some(error_len),
+ "for input {:?}, with {}, error_len didn't match",
+ input,
+ T::description(),
+ );
+ }
+
+ #[derive(Serialize, Debug)]
+ struct Encode {
+ path: ByteBuf,
+ }
+
+ trait TestTrait<'de>: Deserialize<'de> + fmt::Debug {
+ fn description() -> &'static str;
+ fn path(&self) -> &Utf8Path;
+ }
+
+ #[derive(Deserialize, Debug)]
+ #[allow(unused)]
+ struct DecodeOwned {
+ path: Utf8PathBuf,
+ }
+
+ impl<'de> TestTrait<'de> for DecodeOwned {
+ fn description() -> &'static str {
+ "DecodeOwned"
+ }
+
+ fn path(&self) -> &Utf8Path {
+ &self.path
+ }
+ }
+
+ #[derive(Deserialize, Debug)]
+ #[allow(unused)]
+ struct DecodeBorrowed<'a> {
+ #[serde(borrow)]
+ path: &'a Utf8Path,
+ }
+
+ impl<'de> TestTrait<'de> for DecodeBorrowed<'de> {
+ fn description() -> &'static str {
+ "DecodeBorrowed"
+ }
+
+ fn path(&self) -> &Utf8Path {
+ self.path
+ }
+ }
+}
diff --git a/vendor/camino/src/tests.rs b/vendor/camino/src/tests.rs
index 305b76091..e84c227af 100644
--- a/vendor/camino/src/tests.rs
+++ b/vendor/camino/src/tests.rs
@@ -44,3 +44,11 @@ where
{
let _ = orig.into();
}
+
+#[cfg(path_buf_deref_mut)]
+#[test]
+fn test_deref_mut() {
+ // This test is mostly for miri.
+ let mut path_buf = Utf8PathBuf::from("foobar");
+ let _: &mut Utf8Path = &mut path_buf;
+}