diff --git a/patches/backport-rust-crates.bootstrap b/patches/backport-rust-crates.bootstrap new file mode 100644 index 0000000..c25fd82 --- /dev/null +++ b/patches/backport-rust-crates.bootstrap @@ -0,0 +1,11586 @@ +# Rust crate backport by daijro +# Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1900504 +# Requirement: ./mach vendor rust +diff --git a/Cargo.lock b/Cargo.lock +index 7242103ece..d52ae0cacd 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -823,7 +823,7 @@ version = "0.16.2" + source = "registry+https://github.com/rust-lang/crates.io-index" + checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" + dependencies = [ +- "time 0.3.23", ++ "time 0.3.36", + "version_check", + ] + +@@ -1264,6 +1264,16 @@ dependencies = [ + "uuid", + ] + ++[[package]] ++name = "deranged" ++version = "0.3.11" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" ++dependencies = [ ++ "powerfmt", ++ "serde", ++] ++ + [[package]] + name = "derive_arbitrary" + version = "1.3.1" +@@ -3757,7 +3767,7 @@ dependencies = [ + "serde_json", + "smallvec", + "syn", +- "time 0.3.23", ++ "time 0.3.36", + "tokio", + "tokio-util", + "tracing", +@@ -3887,7 +3897,7 @@ dependencies = [ + "env_logger", + "log", + "qlog", +- "time 0.3.23", ++ "time 0.3.36", + "winapi", + ] + +@@ -4077,6 +4087,12 @@ dependencies = [ + "nsstring", + ] + ++[[package]] ++name = "num-conv" ++version = "0.1.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" ++ + [[package]] + name = "num-derive" + version = "0.4.0" +@@ -4450,10 +4466,16 @@ dependencies = [ + "indexmap 1.9.3", + "line-wrap", + "serde", +- "time 0.3.23", ++ "time 0.3.36", + "xml-rs", + ] + ++[[package]] ++name = "powerfmt" ++version = "0.2.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" ++ + [[package]] + name = "ppv-lite86" + version = "0.2.17" +@@ -5629,11 +5651,14 @@ dependencies = [ + + [[package]] + name = "time" +-version = "0.3.23" ++version = "0.3.36" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" ++checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" + dependencies = [ ++ "deranged", + "itoa", ++ "num-conv", ++ "powerfmt", + "serde", + "time-core", + "time-macros", +@@ -5641,16 +5666,17 @@ dependencies = [ + + [[package]] + name = "time-core" +-version = "0.1.1" ++version = "0.1.2" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" ++checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + + [[package]] + name = "time-macros" +-version = "0.2.10" ++version = "0.2.18" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" ++checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" + dependencies = [ ++ "num-conv", + "time-core", + ] + +@@ -6327,7 +6353,7 @@ dependencies = [ + "serde_derive", + "serde_json", + "thiserror", +- "time 0.3.23", ++ "time 0.3.36", + "tokio", + "tokio-stream", + "url", +diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml +index 31ca3fcf0f..03c38e4fe0 100644 +--- a/supply-chain/audits.toml ++++ b/supply-chain/audits.toml +@@ -1388,6 +1388,16 @@ criteria = "safe-to-deploy" + version = "0.8.0" + notes = "This crates was written by Sentry and I've fully audited it as Firefox crash reporting machinery relies on it." + ++[[audits.deranged]] ++who = "Alex Franchuk " ++criteria = "safe-to-deploy" ++version = "0.3.11" ++notes = """ ++This crate contains a decent bit of `unsafe` code, however all internal ++unsafety is verified with copious assertions (many are compile-time), and ++otherwise the unsafety is documented and left to the caller to verify. ++""" ++ + [[audits.derive_arbitrary]] + who = "Mike Hommey " + criteria = "safe-to-run" +@@ -2746,6 +2756,24 @@ criteria = "safe-to-deploy" + version = "0.4.2" + notes = "All code written or reviewed by Josh Stone." + ++[[audits.num-conv]] ++who = "Alex Franchuk " ++criteria = "safe-to-deploy" ++version = "0.1.0" ++notes = """ ++Very straightforward, simple crate. No dependencies, unsafe, extern, ++side-effectful std functions, etc. ++""" ++ ++[[audits.powerfmt]] ++who = "Alex Franchuk " ++criteria = "safe-to-deploy" ++version = "0.2.0" ++notes = """ ++A tiny bit of unsafe code to implement functionality that isn't in stable rust ++yet, but it's all valid. Otherwise it's a pretty simple crate. ++""" ++ + [[audits.num-derive]] + who = "Josh Stone " + criteria = "safe-to-deploy" +@@ -3804,6 +3832,16 @@ who = "Kershaw Chang " + criteria = "safe-to-deploy" + delta = "0.3.17 -> 0.3.23" + ++[[audits.time]] ++who = "Alex Franchuk " ++criteria = "safe-to-deploy" ++delta = "0.3.23 -> 0.3.36" ++notes = """ ++There's a bit of new unsafe code that is self-imposed because they now assert ++that ordinals are non-zero. All unsafe code was checked to ensure that the ++invariants claimed were true. ++""" ++ + [[audits.time-core]] + who = "Kershaw Chang " + criteria = "safe-to-deploy" +@@ -3819,6 +3857,11 @@ who = "Kershaw Chang " + criteria = "safe-to-deploy" + delta = "0.1.0 -> 0.1.1" + ++[[audits.time-core]] ++who = "Alex Franchuk " ++criteria = "safe-to-deploy" ++delta = "0.1.1 -> 0.1.2" ++ + [[audits.time-macros]] + who = "Kershaw Chang " + criteria = "safe-to-deploy" +@@ -3834,6 +3877,11 @@ who = "Kershaw Chang " + criteria = "safe-to-deploy" + delta = "0.2.6 -> 0.2.10" + ++[[audits.time-macros]] ++who = "Alex Franchuk " ++criteria = "safe-to-deploy" ++delta = "0.2.10 -> 0.2.18" ++ + [[audits.tinystr]] + who = "Zibi Braniecki " + criteria = "safe-to-deploy" +diff --git a/third_party/rust/time-core/.cargo-checksum.json b/third_party/rust/time-core/.cargo-checksum.json +index 239ee76621..32d6e08d1f 100644 +--- a/third_party/rust/time-core/.cargo-checksum.json ++++ b/third_party/rust/time-core/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"Cargo.toml":"032c780eaf4ddfde703d5a6b260ad7bad35a5a1ee57a33cacf503f5e47dff6a9","LICENSE-Apache":"b8929fea28678da67251fb2daf9438f67503814211051861612441806d8edb05","LICENSE-MIT":"04620bf27e4a643dd47bf27652320c205acdb776c1f9f24bb8c3bfaba10804c5","src/convert.rs":"59566933f2977d62abbfe39b20be16a85df00db8627211471ccfe182dbbe684c","src/lib.rs":"18020c914b1cd561465e624ef3ea3eef980bd82bc93847e2543bce12da28b043","src/util.rs":"52c1fbf68b71c3582caf0d9a8255378c6c14a737e2df8d7e6d6603b0eb12ca06"},"package":"7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"} +\ No newline at end of file ++{"files":{"Cargo.toml":"d90c41d20f37fc3dbc3d88f7715cacafb5aea973030f498e9b2833decdbe63f0","LICENSE-Apache":"b8929fea28678da67251fb2daf9438f67503814211051861612441806d8edb05","LICENSE-MIT":"04620bf27e4a643dd47bf27652320c205acdb776c1f9f24bb8c3bfaba10804c5","src/convert.rs":"354a1b05e8bb1e92eda5dcdecf33dc6cf2ce72b11115ae4cb0909dcd51d2b294","src/lib.rs":"461b752a45b0f819284e8d8e6b2f49d52b3b661026ab84ee64bf04f4daa0a2d2","src/util.rs":"52c1fbf68b71c3582caf0d9a8255378c6c14a737e2df8d7e6d6603b0eb12ca06"},"package":"ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"} +\ No newline at end of file +diff --git a/third_party/rust/time-core/Cargo.toml b/third_party/rust/time-core/Cargo.toml +index bbc8a325e3..3d6555ebd5 100644 +--- a/third_party/rust/time-core/Cargo.toml ++++ b/third_party/rust/time-core/Cargo.toml +@@ -11,9 +11,9 @@ + + [package] + edition = "2021" +-rust-version = "1.65.0" ++rust-version = "1.67.0" + name = "time-core" +-version = "0.1.1" ++version = "0.1.2" + authors = [ + "Jacob Pratt ", + "Time contributors", +@@ -29,4 +29,7 @@ categories = ["date-and-time"] + license = "MIT OR Apache-2.0" + repository = "https://github.com/time-rs/time" + ++[package.metadata.docs.rs] ++rustdoc-args = ["--generate-link-to-definition"] ++ + [dependencies] +diff --git a/third_party/rust/time-core/src/convert.rs b/third_party/rust/time-core/src/convert.rs +index dae77e9afa..9c28f02638 100644 +--- a/third_party/rust/time-core/src/convert.rs ++++ b/third_party/rust/time-core/src/convert.rs +@@ -1,88 +1,104 @@ +-#![allow(clippy::missing_docs_in_private_items)] // TODO temporary ++//! Conversion between units of time. + +-macro_rules! declare_structs { +- ($($t:ident)*) => {$( +- #[derive(Debug, Copy, Clone)] ++use self::sealed::Per; ++ ++mod sealed { ++ /// A trait for defining the ratio of two units of time. ++ /// ++ /// This trait is used to implement the `per` method on the various structs. ++ pub trait Per { ++ /// The smallest unsigned integer type that can represent [`VALUE`](Self::VALUE). ++ type Output; ++ ++ /// The number of one unit of time in the other. ++ const VALUE: Self::Output; ++ } ++} ++ ++/// Declare and implement `Per` for all relevant types. Identity implementations are automatic. ++macro_rules! impl_per { ++ ($($t:ident ($str:literal) per {$( ++ $larger:ident : $output:ty = $value:expr ++ )*})*) => {$( ++ #[doc = concat!("A unit of time representing exactly one ", $str, ".")] ++ #[derive(Debug, Clone, Copy)] + pub struct $t; + + impl $t { +- pub const fn per(self, _: T) -> <(Self, T) as Per>::Output ++ #[doc = concat!("Obtain the number of times `", stringify!($t), "` can fit into `T`.")] ++ #[doc = concat!("If `T` is smaller than `", stringify!($t), "`, the code will fail to")] ++ /// compile. The return type is the smallest unsigned integer type that can represent ++ /// the value. ++ /// ++ /// Valid calls: ++ /// ++ #[doc = concat!(" - `", stringify!($t), "::per(", stringify!($t), ")` (returns `u8`)")] ++ $(#[doc = concat!(" - `", stringify!($t), "::per(", stringify!($larger), ")` (returns `", stringify!($output), "`)")])* ++ pub const fn per(_larger: T) -> >::Output + where +- (Self, T): Per, ++ Self: Per, + T: Copy, + { +- <(Self, T)>::VALUE ++ Self::VALUE + } + } +- )*}; +-} +- +-declare_structs! { +- Nanosecond +- Microsecond +- Millisecond +- Second +- Minute +- Hour +- Day +- Week +-} +- +-mod sealed { +- pub trait Sealed {} +-} + +-pub trait Per: sealed::Sealed { +- type Output; ++ impl Per<$t> for $t { ++ type Output = u8; + +- const VALUE: Self::Output; +-} +- +-macro_rules! impl_per { +- ($($t:ty : $x:ident in $y:ident = $val:expr)*) => {$( +- impl sealed::Sealed for ($x, $y) {} ++ const VALUE: u8 = 1; ++ } + +- impl Per for ($x, $y) { +- type Output = $t; ++ $(impl Per<$larger> for $t { ++ type Output = $output; + +- const VALUE: $t = $val; +- } ++ const VALUE: $output = $value; ++ })* + )*}; + } + + impl_per! { +- u16: Nanosecond in Microsecond = 1_000 +- u32: Nanosecond in Millisecond = 1_000_000 +- u32: Nanosecond in Second = 1_000_000_000 +- u64: Nanosecond in Minute = 60_000_000_000 +- u64: Nanosecond in Hour = 3_600_000_000_000 +- u64: Nanosecond in Day = 86_400_000_000_000 +- u64: Nanosecond in Week = 604_800_000_000_000 +- +- u16: Microsecond in Millisecond = 1_000 +- u32: Microsecond in Second = 1_000_000 +- u32: Microsecond in Minute = 60_000_000 +- u32: Microsecond in Hour = 3_600_000_000 +- u64: Microsecond in Day = 86_400_000_000 +- u64: Microsecond in Week = 604_800_000_000 +- +- u16: Millisecond in Second = 1_000 +- u16: Millisecond in Minute = 60_000 +- u32: Millisecond in Hour = 3_600_000 +- u32: Millisecond in Day = 86_400_000 +- u32: Millisecond in Week = 604_800_000 +- +- u8: Second in Minute = 60 +- u16: Second in Hour = 3_600 +- u32: Second in Day = 86_400 +- u32: Second in Week = 604_800 +- +- u8: Minute in Hour = 60 +- u16: Minute in Day = 1_440 +- u16: Minute in Week = 10_080 +- +- u8: Hour in Day = 24 +- u8: Hour in Week = 168 +- +- u8: Day in Week = 7 ++ Nanosecond ("nanosecond") per { ++ Microsecond: u16 = 1_000 ++ Millisecond: u32 = 1_000_000 ++ Second: u32 = 1_000_000_000 ++ Minute: u64 = 60_000_000_000 ++ Hour: u64 = 3_600_000_000_000 ++ Day: u64 = 86_400_000_000_000 ++ Week: u64 = 604_800_000_000_000 ++ } ++ Microsecond ("microsecond") per { ++ Millisecond: u16 = 1_000 ++ Second: u32 = 1_000_000 ++ Minute: u32 = 60_000_000 ++ Hour: u32 = 3_600_000_000 ++ Day: u64 = 86_400_000_000 ++ Week: u64 = 604_800_000_000 ++ } ++ Millisecond ("millisecond") per { ++ Second: u16 = 1_000 ++ Minute: u16 = 60_000 ++ Hour: u32 = 3_600_000 ++ Day: u32 = 86_400_000 ++ Week: u32 = 604_800_000 ++ } ++ Second ("second") per { ++ Minute: u8 = 60 ++ Hour: u16 = 3_600 ++ Day: u32 = 86_400 ++ Week: u32 = 604_800 ++ } ++ Minute ("minute") per { ++ Hour: u8 = 60 ++ Day: u16 = 1_440 ++ Week: u16 = 10_080 ++ } ++ Hour ("hour") per { ++ Day: u8 = 24 ++ Week: u8 = 168 ++ } ++ Day ("day") per { ++ Week: u8 = 7 ++ } ++ Week ("week") per {} + } +diff --git a/third_party/rust/time-core/src/lib.rs b/third_party/rust/time-core/src/lib.rs +index 4f1c53b12e..41c3547869 100644 +--- a/third_party/rust/time-core/src/lib.rs ++++ b/third_party/rust/time-core/src/lib.rs +@@ -3,47 +3,6 @@ + //! This crate is an implementation detail of `time` and should not be relied upon directly. + + #![no_std] +-#![deny( +- anonymous_parameters, +- clippy::all, +- clippy::alloc_instead_of_core, +- clippy::explicit_auto_deref, +- clippy::obfuscated_if_else, +- clippy::std_instead_of_core, +- clippy::undocumented_unsafe_blocks, +- illegal_floating_point_literal_pattern, +- late_bound_lifetime_arguments, +- path_statements, +- patterns_in_fns_without_body, +- rust_2018_idioms, +- trivial_casts, +- trivial_numeric_casts, +- unreachable_pub, +- unsafe_op_in_unsafe_fn, +- unused_extern_crates, +- rustdoc::broken_intra_doc_links, +- rustdoc::private_intra_doc_links +-)] +-#![warn( +- clippy::dbg_macro, +- clippy::decimal_literal_representation, +- clippy::get_unwrap, +- clippy::missing_docs_in_private_items, +- clippy::nursery, +- clippy::print_stdout, +- clippy::todo, +- clippy::unimplemented, +- clippy::unnested_or_patterns, +- clippy::unwrap_in_result, +- clippy::unwrap_used, +- clippy::use_debug, +- deprecated_in_future, +- missing_copy_implementations, +- missing_debug_implementations, +- unused_qualifications, +- variant_size_differences +-)] +-#![allow(clippy::redundant_pub_crate)] + #![doc(html_favicon_url = "https://avatars0.githubusercontent.com/u/55999857")] + #![doc(html_logo_url = "https://avatars0.githubusercontent.com/u/55999857")] + #![doc(test(attr(deny(warnings))))] +diff --git a/third_party/rust/time-macros/.cargo-checksum.json b/third_party/rust/time-macros/.cargo-checksum.json +index 6f3847898a..ab81b00599 100644 +--- a/third_party/rust/time-macros/.cargo-checksum.json ++++ b/third_party/rust/time-macros/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"Cargo.toml":"97dbc36d7e8c8658e151c1cfe57397a116135a0d0efc97aacd339142da5d1c96","LICENSE-Apache":"b8929fea28678da67251fb2daf9438f67503814211051861612441806d8edb05","LICENSE-MIT":"04620bf27e4a643dd47bf27652320c205acdb776c1f9f24bb8c3bfaba10804c5","src/date.rs":"ffcd3d0998ec67abb43a3f8eccc6104172f5061b855312b89d53bb82fece2460","src/datetime.rs":"5c7f6e07dc2f0dcfcd86216664df53bc008dbc86f346df57a9ff57f52fe43bc6","src/error.rs":"b3dea92631092068dd73e57e1cbf548f7ae85762826dcdea7fd6454bf357a50a","src/format_description/ast.rs":"8ba87e3249766b89c42b040f623d3134aeec46b78208fdfee825ed0eeeb4591a","src/format_description/format_item.rs":"03ff10699383e5ad08fe690199d45288f13363337abbc811a70b03a8b1703ab1","src/format_description/lexer.rs":"e7db7b6431f00c81b8d15a162088a1622ecd65bfb58d4e642c3c93a8dd5ae4ad","src/format_description/mod.rs":"f48c0ff590bc74529f06a98f60a6af5814bc30d1456bf0b81ac334c0b3f41bba","src/format_description/public/component.rs":"e2c2c8a189e2eb9f9354ff1d9d8edeafa34303e91dc58457df373e7e61c38b78","src/format_description/public/mod.rs":"5260592b310ea9e30808d30c92ea94c7bf1bdb171250a1342279e927d2528d73","src/format_description/public/modifier.rs":"37661e1f7cd9fd11a82f5a1ce6d5971686afa91e6feebc7b9d32df297e8b667f","src/helpers/mod.rs":"a8f8ed59a72b239d7a530357d212873f2e75ea924ec19a6d5d6e24a2baa8100c","src/helpers/string.rs":"3af2d0c701ca978c705922a272e76506dbdf0f376d44ed9ae7283086c67852ba","src/lib.rs":"200678edc14d5920abc0516717b8e010667e58da8bdc65c1cb583fdde0353089","src/offset.rs":"4b9c001a954c1f121a572f5675073f7a4e46d00cc9eb77736bfea2df94ffd05b","src/quote.rs":"634a12b95236e4ab2b8ab70a1a4a2629113c3ce3cf6defefc7ffeb81544c1d89","src/serde_format_description.rs":"db5fb2dc94e01c5114cab3484e68334516d53c4642f31dae0d66f1183253a17c","src/time.rs":"d762e8f22f749d9546d5d2a78b8a0380510be27b4cd3fed375695d7982d8396e","src/to_tokens.rs":"6636ea489c7484bad9b39f72d6956a04c95ce82d8462b12079cc03db778fd263"},"package":"96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4"} +\ No newline at end of file ++{"files":{"Cargo.toml":"3330436e81a4de8b20b9a2931f9e857b7974a8423462d928b04cff55ad531cff","LICENSE-Apache":"edd65bdd88957a205c47d53fa499eed8865a70320f0f03f6391668cb304ea376","LICENSE-MIT":"231c837c45eb53f108fb48929e488965bc4fcc14e9ea21d35f50e6b99d98685b","src/date.rs":"be197c8a2ed37e8b3123a798a91697b0e61cf9b60e7b1898a0e1b458fe8e3ef1","src/datetime.rs":"5c7f6e07dc2f0dcfcd86216664df53bc008dbc86f346df57a9ff57f52fe43bc6","src/error.rs":"b3dea92631092068dd73e57e1cbf548f7ae85762826dcdea7fd6454bf357a50a","src/format_description/ast.rs":"697d5ce506b5386092d706bfe5bf4f81f50e1130796cb17c2fc61457fb165307","src/format_description/format_item.rs":"02d12976209c7af83c2aa4a3221a1a65420fae8c8ba12a28933fb738a2872ff9","src/format_description/lexer.rs":"e2c75f3dda5773a0c8301fdfc0d58a0b833923ba59ac04bcc49fd10aee20496c","src/format_description/mod.rs":"2109b77a8198769c6a6732a54233d7e0058bf4a6da724824103d107859795956","src/format_description/public/component.rs":"5d86912e247724957f7183d70745ced20a7408ed90c24bb47da73a0e26550899","src/format_description/public/mod.rs":"8030e767cb94d559dda2dddc72d42654a756362bd165e5c2cccf112f15d49610","src/format_description/public/modifier.rs":"e1d8fdababcaee2e181a7acb3a938baf309f5a0e2d3877585cf678fcc12f212a","src/helpers/mod.rs":"af47d6c053ffd1113788c5d7591d46fa7d879dc0c5cb2c6c02f9c05462499c4f","src/helpers/string.rs":"3af2d0c701ca978c705922a272e76506dbdf0f376d44ed9ae7283086c67852ba","src/lib.rs":"6ed2d4a41d15a1b5d9fef7d437a1520d967acbfbab98a88630062340f701ca54","src/offset.rs":"aed29d0da9fc65a7dc77314e0346dfdc6fdaf663f17adf9edf00933e8f8e605f","src/quote.rs":"d3003dafa3073825f188851a974846099681cc81145070affb033469cbc7bb31","src/serde_format_description.rs":"db5fb2dc94e01c5114cab3484e68334516d53c4642f31dae0d66f1183253a17c","src/time.rs":"299ddb54e44fb88e514592db5335f06352ebdd0dbf064752790657db85f4c13c","src/to_tokens.rs":"afb067f4d95d19c1b7a650cbcf60ae155b5a9619c89825867997f39ce163ac94"},"package":"3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"} +\ No newline at end of file +diff --git a/third_party/rust/time-macros/Cargo.toml b/third_party/rust/time-macros/Cargo.toml +index 1c86d657d5..b817622154 100644 +--- a/third_party/rust/time-macros/Cargo.toml ++++ b/third_party/rust/time-macros/Cargo.toml +@@ -11,9 +11,9 @@ + + [package] + edition = "2021" +-rust-version = "1.65.0" ++rust-version = "1.67.0" + name = "time-macros" +-version = "0.2.10" ++version = "0.2.18" + authors = [ + "Jacob Pratt ", + "Time contributors", +@@ -32,14 +32,104 @@ categories = ["date-and-time"] + license = "MIT OR Apache-2.0" + repository = "https://github.com/time-rs/time" + ++[package.metadata.docs.rs] ++rustdoc-args = ["--generate-link-to-definition"] ++ + [lib] + proc-macro = true + ++[dependencies.num-conv] ++version = "0.1.0" ++ + [dependencies.time-core] +-version = "=0.1.1" ++version = "=0.1.2" + + [features] + formatting = [] + large-dates = [] + parsing = [] + serde = [] ++ ++[lints.clippy] ++all = "warn" ++alloc-instead-of-core = "deny" ++dbg-macro = "warn" ++decimal-literal-representation = "warn" ++explicit-auto-deref = "warn" ++get-unwrap = "warn" ++manual-let-else = "warn" ++missing-docs-in-private-items = "warn" ++missing-enforced-import-renames = "warn" ++nursery = "warn" ++obfuscated-if-else = "warn" ++print-stdout = "warn" ++semicolon-outside-block = "warn" ++std-instead-of-core = "deny" ++todo = "warn" ++undocumented-unsafe-blocks = "deny" ++unimplemented = "warn" ++uninlined-format-args = "warn" ++unnested-or-patterns = "warn" ++unwrap-in-result = "warn" ++unwrap-used = "warn" ++use-debug = "warn" ++ ++[lints.clippy.option-if-let-else] ++level = "allow" ++priority = 1 ++ ++[lints.clippy.redundant-pub-crate] ++level = "allow" ++priority = 1 ++ ++[lints.rust] ++ambiguous-glob-reexports = "deny" ++clashing-extern-declarations = "deny" ++const-item-mutation = "deny" ++deref-nullptr = "deny" ++drop-bounds = "deny" ++future-incompatible = "deny" ++hidden-glob-reexports = "deny" ++improper-ctypes = "deny" ++improper-ctypes-definitions = "deny" ++invalid-from-utf8 = "deny" ++invalid-macro-export-arguments = "deny" ++invalid-nan-comparisons = "deny" ++invalid-reference-casting = "deny" ++invalid-value = "deny" ++keyword-idents = "warn" ++let-underscore = "warn" ++macro-use-extern-crate = "warn" ++meta-variable-misuse = "warn" ++missing-abi = "warn" ++missing-copy-implementations = "warn" ++missing-debug-implementations = "warn" ++missing-docs = "warn" ++named-arguments-used-positionally = "deny" ++non-ascii-idents = "deny" ++noop-method-call = "warn" ++opaque-hidden-inferred-bound = "deny" ++overlapping-range-endpoints = "deny" ++single-use-lifetimes = "warn" ++suspicious-double-ref-op = "deny" ++temporary-cstring-as-ptr = "deny" ++trivial-casts = "warn" ++trivial-numeric-casts = "warn" ++unconditional-recursion = "deny" ++unnameable-test-items = "deny" ++unreachable-pub = "warn" ++unsafe-op-in-unsafe-fn = "deny" ++unstable-syntax-pre-expansion = "deny" ++unused = "warn" ++unused-import-braces = "warn" ++unused-lifetimes = "warn" ++unused-qualifications = "warn" ++variant-size-differences = "warn" ++ ++[lints.rust.unstable-name-collisions] ++level = "warn" ++priority = 1 ++ ++[lints.rustdoc] ++private-doc-tests = "warn" ++unescaped-backticks = "warn" +diff --git a/third_party/rust/time-macros/LICENSE-Apache b/third_party/rust/time-macros/LICENSE-Apache +index 7646f21e37..c763a0c9de 100644 +--- a/third_party/rust/time-macros/LICENSE-Apache ++++ b/third_party/rust/time-macros/LICENSE-Apache +@@ -187,7 +187,7 @@ + same "printed page" as the copyright notice for easier + identification within third-party archives. + +- Copyright 2022 Jacob Pratt et al. ++ Copyright 2024 Jacob Pratt et al. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. +diff --git a/third_party/rust/time-macros/LICENSE-MIT b/third_party/rust/time-macros/LICENSE-MIT +index a11a755732..5cc097f1c0 100644 +--- a/third_party/rust/time-macros/LICENSE-MIT ++++ b/third_party/rust/time-macros/LICENSE-MIT +@@ -1,4 +1,4 @@ +-Copyright (c) 2022 Jacob Pratt et al. ++Copyright (c) 2024 Jacob Pratt et al. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal +diff --git a/third_party/rust/time-macros/src/date.rs b/third_party/rust/time-macros/src/date.rs +index 574ef8ce6f..03cbf11ae2 100644 +--- a/third_party/rust/time-macros/src/date.rs ++++ b/third_party/rust/time-macros/src/date.rs +@@ -1,5 +1,6 @@ + use std::iter::Peekable; + ++use num_conv::Truncate; + use proc_macro::{token_stream, TokenTree}; + use time_core::util::{days_in_year, weeks_in_year}; + +@@ -93,7 +94,7 @@ pub(crate) fn parse(chars: &mut Peekable) -> Result days_in_year_month(year, month) { + return Err(Error::InvalidComponent { + name: "day", +@@ -127,10 +128,12 @@ pub(crate) fn parse(chars: &mut Peekable) -> Result TokenTree { + quote_group! {{ +- const DATE: ::time::Date = ::time::Date::__from_ordinal_date_unchecked( +- #(self.year), +- #(self.ordinal), +- ); ++ const DATE: ::time::Date = unsafe { ++ ::time::Date::__from_ordinal_date_unchecked( ++ #(self.year), ++ #(self.ordinal), ++ ) ++ }; + DATE + }} + } +diff --git a/third_party/rust/time-macros/src/format_description/ast.rs b/third_party/rust/time-macros/src/format_description/ast.rs +index b75056bc2f..4c3a19e5a6 100644 +--- a/third_party/rust/time-macros/src/format_description/ast.rs ++++ b/third_party/rust/time-macros/src/format_description/ast.rs +@@ -1,4 +1,3 @@ +-use std::boxed::Box; + use std::iter; + + use super::{lexer, unused, Error, Location, Spanned, SpannedValue, Unused}; +diff --git a/third_party/rust/time-macros/src/format_description/format_item.rs b/third_party/rust/time-macros/src/format_description/format_item.rs +index 6a8cf555ee..ea36caee05 100644 +--- a/third_party/rust/time-macros/src/format_description/format_item.rs ++++ b/third_party/rust/time-macros/src/format_description/format_item.rs +@@ -1,4 +1,3 @@ +-use std::boxed::Box; + use std::num::NonZeroU16; + use std::str::{self, FromStr}; + +@@ -103,14 +102,9 @@ impl From> for crate::format_description::public::OwnedFormatItem { + impl<'a> From]>> for crate::format_description::public::OwnedFormatItem { + fn from(items: Box<[Item<'a>]>) -> Self { + let items = items.into_vec(); +- if items.len() == 1 { +- if let Ok([item]) = <[_; 1]>::try_from(items) { +- item.into() +- } else { +- bug!("the length was just checked to be 1") +- } +- } else { +- Self::Compound(items.into_iter().map(Self::from).collect()) ++ match <[_; 1]>::try_from(items) { ++ Ok([item]) => item.into(), ++ Err(vec) => Self::Compound(vec.into_iter().map(Into::into).collect()), + } + } + } +@@ -143,6 +137,7 @@ macro_rules! component_definition { + _component_span: Span, + ) -> Result + { ++ #[allow(unused_mut)] + let mut this = Self { + $($field: None),* + }; +@@ -212,6 +207,7 @@ component_definition! { + Day = "day" { + padding = "padding": Option => padding, + }, ++ End = "end" {}, + Hour = "hour" { + padding = "padding": Option => padding, + base = "repr": Option => is_12_hour_clock, +diff --git a/third_party/rust/time-macros/src/format_description/lexer.rs b/third_party/rust/time-macros/src/format_description/lexer.rs +index 2c927cb94d..2ea53af57a 100644 +--- a/third_party/rust/time-macros/src/format_description/lexer.rs ++++ b/third_party/rust/time-macros/src/format_description/lexer.rs +@@ -3,7 +3,7 @@ use core::iter; + use super::{Error, Location, Spanned, SpannedValue}; + + pub(super) struct Lexed { +- iter: core::iter::Peekable, ++ iter: iter::Peekable, + } + + impl Iterator for Lexed { +diff --git a/third_party/rust/time-macros/src/format_description/mod.rs b/third_party/rust/time-macros/src/format_description/mod.rs +index fde1272f6a..676028dec4 100644 +--- a/third_party/rust/time-macros/src/format_description/mod.rs ++++ b/third_party/rust/time-macros/src/format_description/mod.rs +@@ -1,7 +1,5 @@ + //! Parser for format descriptions. + +-use std::vec::Vec; +- + macro_rules! version { + ($range:expr) => { + $range.contains(&VERSION) +@@ -17,7 +15,7 @@ pub(crate) fn parse_with_version( + version: Option, + s: &[u8], + proc_span: proc_macro::Span, +-) -> Result, crate::Error> { ++) -> Result, crate::Error> { + match version { + Some(crate::FormatDescriptionVersion::V1) | None => parse::<1>(s, proc_span), + Some(crate::FormatDescriptionVersion::V2) => parse::<2>(s, proc_span), +@@ -27,7 +25,7 @@ pub(crate) fn parse_with_version( + fn parse( + s: &[u8], + proc_span: proc_macro::Span, +-) -> Result, crate::Error> { ++) -> Result, crate::Error> { + let mut lexed = lexer::lex::(s, proc_span); + let ast = ast::parse::<_, VERSION>(&mut lexed); + let format_items = format_item::parse(ast); +diff --git a/third_party/rust/time-macros/src/format_description/public/component.rs b/third_party/rust/time-macros/src/format_description/public/component.rs +index 4737c6ce5c..94c73f0fb4 100644 +--- a/third_party/rust/time-macros/src/format_description/public/component.rs ++++ b/third_party/rust/time-macros/src/format_description/public/component.rs +@@ -46,4 +46,5 @@ declare_component! { + OffsetSecond + Ignore + UnixTimestamp ++ End + } +diff --git a/third_party/rust/time-macros/src/format_description/public/mod.rs b/third_party/rust/time-macros/src/format_description/public/mod.rs +index ccb0b6e2a3..9fd8b5ece1 100644 +--- a/third_party/rust/time-macros/src/format_description/public/mod.rs ++++ b/third_party/rust/time-macros/src/format_description/public/mod.rs +@@ -19,12 +19,12 @@ impl ToTokenStream for OwnedFormatItem { + fn append_to(self, ts: &mut TokenStream) { + match self { + Self::Literal(bytes) => quote_append! { ts +- ::time::format_description::FormatItem::Literal { ++ ::time::format_description::BorrowedFormatItem::Literal { + 0: #(Literal::byte_string(bytes.as_ref())) + } + }, + Self::Component(component) => quote_append! { ts +- ::time::format_description::FormatItem::Component { 0: #S(component) } ++ ::time::format_description::BorrowedFormatItem::Component { 0: #S(component) } + }, + Self::Compound(items) => { + let items = items +@@ -33,11 +33,11 @@ impl ToTokenStream for OwnedFormatItem { + .map(|item| quote! { #S(item), }) + .collect::(); + quote_append! { ts +- ::time::format_description::FormatItem::Compound { 0: &[#S(items)] } ++ ::time::format_description::BorrowedFormatItem::Compound { 0: &[#S(items)] } + } + } + Self::Optional(item) => quote_append! {ts +- ::time::format_description::FormatItem::Optional { 0: &#S(*item) } ++ ::time::format_description::BorrowedFormatItem::Optional { 0: &#S(*item) } + }, + Self::First(items) => { + let items = items +@@ -46,7 +46,7 @@ impl ToTokenStream for OwnedFormatItem { + .map(|item| quote! { #S(item), }) + .collect::(); + quote_append! { ts +- ::time::format_description::FormatItem::First { 0: &[#S(items)] } ++ ::time::format_description::BorrowedFormatItem::First { 0: &[#S(items)] } + } + } + } +diff --git a/third_party/rust/time-macros/src/format_description/public/modifier.rs b/third_party/rust/time-macros/src/format_description/public/modifier.rs +index e39c6bf552..63bfaa7065 100644 +--- a/third_party/rust/time-macros/src/format_description/public/modifier.rs ++++ b/third_party/rust/time-macros/src/format_description/public/modifier.rs +@@ -10,18 +10,18 @@ macro_rules! to_tokens { + $struct_vis:vis struct $struct_name:ident {$( + $(#[$field_attr:meta])* + $field_vis:vis $field_name:ident : $field_ty:ty +- ),+ $(,)?} ++ ),* $(,)?} + ) => { + $(#[$struct_attr])* + $struct_vis struct $struct_name {$( + $(#[$field_attr])* + $field_vis $field_name: $field_ty +- ),+} ++ ),*} + + impl ToTokenTree for $struct_name { + fn into_token_tree(self) -> TokenTree { + let mut tokens = TokenStream::new(); +- let Self {$($field_name),+} = self; ++ let Self {$($field_name),*} = self; + + quote_append! { tokens + let mut value = ::time::format_description::modifier::$struct_name::default(); +@@ -30,7 +30,7 @@ macro_rules! to_tokens { + quote_append!(tokens value.$field_name =); + $field_name.append_to(&mut tokens); + quote_append!(tokens ;); +- )+ ++ )* + quote_append!(tokens value); + + proc_macro::TokenTree::Group(proc_macro::Group::new( +@@ -245,3 +245,7 @@ to_tokens! { + pub(crate) sign_is_mandatory: bool, + } + } ++ ++to_tokens! { ++ pub(crate) struct End {} ++} +diff --git a/third_party/rust/time-macros/src/helpers/mod.rs b/third_party/rust/time-macros/src/helpers/mod.rs +index 56300b3e65..0cca2002de 100644 +--- a/third_party/rust/time-macros/src/helpers/mod.rs ++++ b/third_party/rust/time-macros/src/helpers/mod.rs +@@ -4,6 +4,7 @@ mod string; + use std::iter::Peekable; + use std::str::FromStr; + ++use num_conv::prelude::*; + use proc_macro::{token_stream, Span, TokenTree}; + use time_core::util::{days_in_year, is_leap_year}; + +@@ -92,15 +93,17 @@ fn jan_weekday(year: i32, ordinal: i32) -> u8 { + } + + let adj_year = year - 1; +- ((ordinal + adj_year + div_floor!(adj_year, 4) - div_floor!(adj_year, 100) ++ (ordinal + adj_year + div_floor!(adj_year, 4) - div_floor!(adj_year, 100) + + div_floor!(adj_year, 400) + + 6) +- .rem_euclid(7)) as _ ++ .rem_euclid(7) ++ .cast_unsigned() ++ .truncate() + } + + pub(crate) fn days_in_year_month(year: i32, month: u8) -> u8 { +- [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month as usize - 1] +- + (month == 2 && is_leap_year(year)) as u8 ++ [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month.extend::() - 1] ++ + u8::from(month == 2 && is_leap_year(year)) + } + + pub(crate) fn ywd_to_yo(year: i32, week: u8, iso_weekday_number: u8) -> (i32, u16) { +@@ -120,8 +123,9 @@ pub(crate) fn ywd_to_yo(year: i32, week: u8, iso_weekday_number: u8) -> (i32, u1 + } + + pub(crate) fn ymd_to_yo(year: i32, month: u8, day: u8) -> (i32, u16) { +- let ordinal = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334][month as usize - 1] +- + (month > 2 && is_leap_year(year)) as u16; ++ let ordinal = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334] ++ [month.extend::() - 1] ++ + u16::from(month > 2 && is_leap_year(year)); + + (year, ordinal + u16::from(day)) + } +diff --git a/third_party/rust/time-macros/src/lib.rs b/third_party/rust/time-macros/src/lib.rs +index 0e8568cdad..65e24d7d3b 100644 +--- a/third_party/rust/time-macros/src/lib.rs ++++ b/third_party/rust/time-macros/src/lib.rs +@@ -1,37 +1,12 @@ +-#![deny( +- anonymous_parameters, +- clippy::all, +- illegal_floating_point_literal_pattern, +- late_bound_lifetime_arguments, +- path_statements, +- patterns_in_fns_without_body, +- rust_2018_idioms, +- trivial_casts, +- trivial_numeric_casts, +- unreachable_pub, +- unsafe_code, +- unused_extern_crates +-)] +-#![warn( +- clippy::dbg_macro, +- clippy::decimal_literal_representation, +- clippy::get_unwrap, +- clippy::nursery, +- clippy::print_stdout, +- clippy::todo, +- clippy::unimplemented, +- clippy::unnested_or_patterns, +- clippy::unwrap_used, +- clippy::use_debug, +- single_use_lifetimes, +- unused_qualifications, +- variant_size_differences +-)] + #![allow( +- clippy::missing_const_for_fn, // useless in proc macro +- clippy::redundant_pub_crate, // suggests bad style +- clippy::option_if_let_else, // suggests terrible code ++ clippy::missing_const_for_fn, // irrelevant for proc macros ++ clippy::missing_docs_in_private_items, // TODO remove ++ clippy::std_instead_of_core, // irrelevant for proc macros ++ clippy::std_instead_of_alloc, // irrelevant for proc macros ++ clippy::alloc_instead_of_core, // irrelevant for proc macros ++ missing_docs, // TODO remove + )] ++ + #[allow(unused_macros)] + macro_rules! bug { + () => { compile_error!("provide an error message to help fix a possible bug") }; +@@ -93,6 +68,7 @@ enum FormatDescriptionVersion { + #[cfg(any(feature = "formatting", feature = "parsing"))] + enum VersionOrModuleName { + Version(FormatDescriptionVersion), ++ #[cfg_attr(not(feature = "serde"), allow(dead_code))] + ModuleName(Ident), + } + +@@ -175,7 +151,7 @@ pub fn format_description(input: TokenStream) -> TokenStream { + let items = format_description::parse_with_version(version, &string, span)?; + + Ok(quote! {{ +- const DESCRIPTION: &[::time::format_description::FormatItem<'_>] = &[#S( ++ const DESCRIPTION: &[::time::format_description::BorrowedFormatItem<'_>] = &[#S( + items + .into_iter() + .map(|item| quote! { #S(item), }) +@@ -236,7 +212,8 @@ pub fn serde_format_description(input: TokenStream) -> TokenStream { + let items: TokenStream = + items.into_iter().map(|item| quote! { #S(item), }).collect(); + let items = quote! { +- const ITEMS: &[::time::format_description::FormatItem<'_>] = &[#S(items)]; ++ const ITEMS: &[::time::format_description::BorrowedFormatItem<'_>] ++ = &[#S(items)]; + ITEMS + }; + +diff --git a/third_party/rust/time-macros/src/offset.rs b/third_party/rust/time-macros/src/offset.rs +index 62d7a223da..04dd37f131 100644 +--- a/third_party/rust/time-macros/src/offset.rs ++++ b/third_party/rust/time-macros/src/offset.rs +@@ -1,5 +1,6 @@ + use std::iter::Peekable; + ++use num_conv::prelude::*; + use proc_macro::{token_stream, Span, TokenTree}; + use time_core::convert::*; + +@@ -52,21 +53,21 @@ pub(crate) fn parse(chars: &mut Peekable) -> Result= 24 { ++ if hours > 25 { + Err(Error::InvalidComponent { + name: "hour", + value: hours.to_string(), + span_start: Some(hours_span), + span_end: Some(hours_span), + }) +- } else if minutes >= Minute.per(Hour) as _ { ++ } else if minutes >= Minute::per(Hour).cast_signed() { + Err(Error::InvalidComponent { + name: "minute", + value: minutes.to_string(), + span_start: Some(minutes_span), + span_end: Some(minutes_span), + }) +- } else if seconds >= Second.per(Minute) as _ { ++ } else if seconds >= Second::per(Minute).cast_signed() { + Err(Error::InvalidComponent { + name: "second", + value: seconds.to_string(), +@@ -85,11 +86,13 @@ pub(crate) fn parse(chars: &mut Peekable) -> Result TokenTree { + quote_group! {{ +- const OFFSET: ::time::UtcOffset = ::time::UtcOffset::__from_hms_unchecked( +- #(self.hours), +- #(self.minutes), +- #(self.seconds), +- ); ++ const OFFSET: ::time::UtcOffset = unsafe { ++ ::time::UtcOffset::__from_hms_unchecked( ++ #(self.hours), ++ #(self.minutes), ++ #(self.seconds), ++ ) ++ }; + OFFSET + }} + } +diff --git a/third_party/rust/time-macros/src/quote.rs b/third_party/rust/time-macros/src/quote.rs +index 4d3dcbca03..8603f4fa46 100644 +--- a/third_party/rust/time-macros/src/quote.rs ++++ b/third_party/rust/time-macros/src/quote.rs +@@ -45,20 +45,19 @@ macro_rules! sym { + }; + } + ++#[allow(unused_macro_rules)] // Varies by feature flag combination. + macro_rules! quote_inner { + // Base case + ($ts:ident) => {}; + + // Single or double symbols + ($ts:ident :: $($tail:tt)*) => { sym!($ts ':' ':'); quote_inner!($ts $($tail)*); }; +- ($ts:ident .. $($tail:tt)*) => { sym!($ts '.' '.'); quote_inner!($ts $($tail)*); }; + ($ts:ident : $($tail:tt)*) => { sym!($ts ':'); quote_inner!($ts $($tail)*); }; + ($ts:ident = $($tail:tt)*) => { sym!($ts '='); quote_inner!($ts $($tail)*); }; + ($ts:ident ; $($tail:tt)*) => { sym!($ts ';'); quote_inner!($ts $($tail)*); }; + ($ts:ident , $($tail:tt)*) => { sym!($ts ','); quote_inner!($ts $($tail)*); }; + ($ts:ident . $($tail:tt)*) => { sym!($ts '.'); quote_inner!($ts $($tail)*); }; + ($ts:ident & $($tail:tt)*) => { sym!($ts '&'); quote_inner!($ts $($tail)*); }; +- ($ts:ident << $($tail:tt)*) => { sym!($ts '<' '<'); quote_inner!($ts $($tail)*); }; + ($ts:ident < $($tail:tt)*) => { sym!($ts '<'); quote_inner!($ts $($tail)*); }; + ($ts:ident >> $($tail:tt)*) => { sym!($ts '>' '>'); quote_inner!($ts $($tail)*); }; + ($ts:ident > $($tail:tt)*) => { sym!($ts '>'); quote_inner!($ts $($tail)*); }; +diff --git a/third_party/rust/time-macros/src/time.rs b/third_party/rust/time-macros/src/time.rs +index 96314de1f4..4e565c1ded 100644 +--- a/third_party/rust/time-macros/src/time.rs ++++ b/third_party/rust/time-macros/src/time.rs +@@ -73,21 +73,21 @@ pub(crate) fn parse(chars: &mut Peekable) -> Result