From 7db694cb35a8359f4ef7706921c67458f3cdcf5f Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 4 Jul 2023 07:29:36 +0000 Subject: [PATCH] Bug 1841205 - Update num-derive to 0.4. r=emilio,supply-chain-reviewers Differential Revision: https://phabricator.services.mozilla.com/D182539 --- Cargo.lock | 4 +- Cargo.toml | 3 -- servo/components/style/Cargo.toml | 2 +- supply-chain/audits.toml | 5 +++ supply-chain/config.toml | 4 -- .../rust/num-derive/.cargo-checksum.json | 2 +- third_party/rust/num-derive/Cargo.toml | 42 ++++++++++++------- third_party/rust/num-derive/README.md | 6 +-- third_party/rust/num-derive/RELEASES.md | 8 ++++ third_party/rust/num-derive/src/lib.rs | 10 +---- .../rust/num-derive/tests/newtype-2018.rs | 2 + .../rust/num-derive/tests/trivial-2018.rs | 2 + .../num-derive/tests/with_custom_values.rs | 2 - 13 files changed, 54 insertions(+), 38 deletions(-) create mode 100644 third_party/rust/num-derive/tests/newtype-2018.rs create mode 100644 third_party/rust/num-derive/tests/trivial-2018.rs diff --git a/Cargo.lock b/Cargo.lock index 75cd71adbe49..01b1faeccafc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3778,7 +3778,9 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.3.3" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index c0494b7cafef..df25bede6b4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,9 +162,6 @@ moz_asserts = { path = "mozglue/static/rust/moz_asserts" } # Workaround for https://github.com/rust-lang/cargo/issues/11232 rure = { path = "third_party/rust/rure" } -# num-derive 0.3.3 + https://github.com/rust-num/num-derive/pull/54 -num-derive = { path = "third_party/rust/num-derive" } - # Other overrides chardetng = { git = "https://github.com/hsivonen/chardetng", rev="3484d3e3ebdc8931493aa5df4d7ee9360a90e76b" } chardetng_c = { git = "https://github.com/hsivonen/chardetng_c", rev="ed8a4c6f900a90d4dbc1d64b856e61490a1c3570" } diff --git a/servo/components/style/Cargo.toml b/servo/components/style/Cargo.toml index 2d176c2aed27..a9a0688fd8ca 100644 --- a/servo/components/style/Cargo.toml +++ b/servo/components/style/Cargo.toml @@ -52,7 +52,7 @@ nsstring = {path = "../../../xpcom/rust/nsstring/", optional = true} num_cpus = {version = "1.1.0"} num-integer = "0.1" num-traits = "0.2" -num-derive = "0.3" +num-derive = "0.4" owning_ref = "0.4" parking_lot = "0.11" precomputed-hash = "0.1.1" diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index 7f623ae0eb8c..600499af6a74 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -2019,6 +2019,11 @@ criteria = "safe-to-deploy" version = "0.3.3" notes = "All code written or reviewed by Josh Stone." +[[audits.num-derive]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.3.3 -> 0.4.0" + [[audits.num-integer]] who = "Josh Stone " criteria = "safe-to-deploy" diff --git a/supply-chain/config.toml b/supply-chain/config.toml index 8080a1dcd511..0709408a4887 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -130,10 +130,6 @@ audit-as-crates-io = false audit-as-crates-io = true notes = "wgpu-core pins this crate." -[policy.num-derive] -audit-as-crates-io = true -notes = "Local fork with a patch from https://github.com/rust-num/num-derive/pull/54" - [policy.packed_simd_2] audit-as-crates-io = true notes = "Based on upstream, see bug 1719674." diff --git a/third_party/rust/num-derive/.cargo-checksum.json b/third_party/rust/num-derive/.cargo-checksum.json index fe87985b3c31..22cbf847f39a 100644 --- a/third_party/rust/num-derive/.cargo-checksum.json +++ b/third_party/rust/num-derive/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"aeffa6070dd5f4311b70d4baf3723f48c58bf5895a529ddd3f2548042ecedce8","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"d772e283044982c8d132220666f831a2add33d2d891aee4faf61d6b1c8b81b6c","RELEASES.md":"a9031e1846496d2c19baea11378d038fc4c4789e224365c20f8e4f783a45fb23","src/lib.rs":"e0e97564d9e1ddb6bb70bc5e2a5b3825dbbfe689dacedd019d5e77cde8c56693","src/test.rs":"59cd2e3ab76bf4c4adae9bf9fe49d8c1f9e98d35f7c8ca47c8199b117bb13b22","tests/empty_enum.rs":"1b2312ec2fc9866fce7172e71e0aa2efcc3cb9d7659d0b633eb352bb1e080d53","tests/issue-6.rs":"b7fbbe86ff82933c15ec09fabadca02d2c70e184af30b9887cae83ed2f60367e","tests/issue-9.rs":"4c87f70a63e56c24480028fafa39a845d127620141df21bc0abfa23f84ff9bb7","tests/newtype-2015.rs":"163f76f0c139c3621ba7416cec5f9fb966c86c5ebed270df77196cf75d62402f","tests/newtype.rs":"bc1ff3fb3680935c2280cc91441c91ea104be24f525428987b49b86bc880217a","tests/num_derive_without_num.rs":"3ce528221a2cb752859e20c5423c4b474fec714b41d8c1b62f5614b165d7262b","tests/trivial-2015.rs":"1745e23dfafb8c717365e57d79323c61c7d4ceaa092d7399ed793fd4f2de8ff6","tests/trivial.rs":"a6b0faab04527f6835f43cd72317a00065a7a6cf4c506d04e77f898134f7a59b","tests/with_custom_values.rs":"9f15c4b732050a5498a9691c2b41902bd9172f0c7c5d3af152ea9bd4a272e885"},"package":"876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"} \ No newline at end of file +{"files":{"Cargo.toml":"f332f5a9fab58d78a8e2be8ec8db83fe47436ef9225e73361f4f6596cb325c6c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"4087ceabb42281161bc074db61ad4d888343f159e60e49776559a179eda34193","RELEASES.md":"6270e75a054d3f14ae28f04abd27edb7ec41d67e131c4f1e798a3adb97aa4bc1","src/lib.rs":"724f81441d84672e684ca270cbfecddd741c8340a7e846ecf3cf6c9e9871349f","tests/empty_enum.rs":"1b2312ec2fc9866fce7172e71e0aa2efcc3cb9d7659d0b633eb352bb1e080d53","tests/issue-16.rs":"4a056b4a688805fc95f01642f016da6dadb46d1c67ceb82e5b5eaf9fe2db92cd","tests/issue-6.rs":"b7fbbe86ff82933c15ec09fabadca02d2c70e184af30b9887cae83ed2f60367e","tests/issue-9.rs":"4c87f70a63e56c24480028fafa39a845d127620141df21bc0abfa23f84ff9bb7","tests/newtype-2015.rs":"163f76f0c139c3621ba7416cec5f9fb966c86c5ebed270df77196cf75d62402f","tests/newtype-2018.rs":"ce5b005d805690b8200f6752d24a5ebe7d248703d0aa619489c6d821b3df4b9c","tests/newtype.rs":"bc1ff3fb3680935c2280cc91441c91ea104be24f525428987b49b86bc880217a","tests/num_derive_without_num.rs":"3ce528221a2cb752859e20c5423c4b474fec714b41d8c1b62f5614b165d7262b","tests/trivial-2015.rs":"1745e23dfafb8c717365e57d79323c61c7d4ceaa092d7399ed793fd4f2de8ff6","tests/trivial-2018.rs":"645f0ff3c3c0d014b6891bd310de2bc5f3ccb3019cb70d0b653061eb6571f7cf","tests/trivial.rs":"a6b0faab04527f6835f43cd72317a00065a7a6cf4c506d04e77f898134f7a59b","tests/with_custom_values.rs":"4f2ea85d1f987c6620efe5bda095477c3b669af3cb67f98935c5a7d59d28b339"},"package":"9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e"} \ No newline at end of file diff --git a/third_party/rust/num-derive/Cargo.toml b/third_party/rust/num-derive/Cargo.toml index d0ccb4b08993..6ff605a52ffc 100644 --- a/third_party/rust/num-derive/Cargo.toml +++ b/third_party/rust/num-derive/Cargo.toml @@ -3,24 +3,31 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] -edition = "2018" +edition = "2021" +rust-version = "1.56.0" name = "num-derive" -version = "0.3.3" +version = "0.4.0" authors = ["The Rust Project Developers"] -exclude = ["/bors.toml", "/ci/*", "/.github/*"] +exclude = [ + "/bors.toml", + "/ci/*", + "/.github/*", +] description = "Numeric syntax extensions" homepage = "https://github.com/rust-num/num-derive" documentation = "https://docs.rs/num-derive" readme = "README.md" -keywords = ["mathematics", "numerics"] +keywords = [ + "mathematics", + "numerics", +] categories = ["science"] license = "MIT OR Apache-2.0" repository = "https://github.com/rust-num/num-derive" @@ -34,9 +41,18 @@ proc-macro = true name = "newtype-2015" edition = "2015" +[[test]] +name = "newtype-2018" +edition = "2018" + [[test]] name = "trivial-2015" edition = "2015" + +[[test]] +name = "trivial-2018" +edition = "2018" + [dependencies.proc-macro2] version = "1" @@ -44,12 +60,10 @@ version = "1" version = "1" [dependencies.syn] -version = "2" +version = "2.0.5" + [dev-dependencies.num] -version = "0.3" +version = "0.4" [dev-dependencies.num-traits] version = "0.2" - -[features] -full-syntax = ["syn/full"] diff --git a/third_party/rust/num-derive/README.md b/third_party/rust/num-derive/README.md index 9826cdfc7684..20d66a63349a 100644 --- a/third_party/rust/num-derive/README.md +++ b/third_party/rust/num-derive/README.md @@ -2,7 +2,7 @@ [![crate](https://img.shields.io/crates/v/num-derive.svg)](https://crates.io/crates/num-derive) [![documentation](https://docs.rs/num-derive/badge.svg)](https://docs.rs/num-derive) -[![minimum rustc 1.31](https://img.shields.io/badge/rustc-1.31+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html) +[![minimum rustc 1.56](https://img.shields.io/badge/rustc-1.56+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html) [![build status](https://github.com/rust-num/num-derive/workflows/master/badge.svg)](https://github.com/rust-num/num-derive/actions) Procedural macros to derive numeric traits in Rust. @@ -14,7 +14,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] num-traits = "0.2" -num-derive = "0.3" +num-derive = "0.4" ``` and this to your crate root: @@ -51,7 +51,7 @@ Release notes are available in [RELEASES.md](RELEASES.md). ## Compatibility -The `num-derive` crate is tested for rustc 1.31 and greater. +The `num-derive` crate is tested for rustc 1.56 and greater. ## License diff --git a/third_party/rust/num-derive/RELEASES.md b/third_party/rust/num-derive/RELEASES.md index c3e18cca00eb..fbb34da48458 100644 --- a/third_party/rust/num-derive/RELEASES.md +++ b/third_party/rust/num-derive/RELEASES.md @@ -1,3 +1,11 @@ +# Release 0.4.0 (2023-06-29) + +- [Update to syn-2][54] -- thanks @maurer! + - This raises the minimum supported rustc to 1.56. + - The "full-syntax" feature has also been removed. + +[54]: https://github.com/rust-num/num-derive/pull/54 + # Release 0.3.3 (2020-10-29) - [Make `NumOps` work with `no_std`][41] -- thanks @jedrzejboczar! diff --git a/third_party/rust/num-derive/src/lib.rs b/third_party/rust/num-derive/src/lib.rs index 2ee7823cd62c..26b9c77c214b 100644 --- a/third_party/rust/num-derive/src/lib.rs +++ b/third_party/rust/num-derive/src/lib.rs @@ -71,19 +71,11 @@ use quote::quote; use syn::{Data, Fields, Ident}; /// Try to parse the tokens, or else return a compilation error -/// suggesting "full-syntax" if that's not already enabled. macro_rules! parse { ($tokens:ident as $type:ty) => { match syn::parse::<$type>($tokens) { Ok(parsed) => parsed, - Err(mut error) => { - if cfg!(not(feature = "full-syntax")) { - let hint = syn::Error::new( - Span::call_site(), - r#"this might need the "full-syntax" feature of `num-derive`"#, - ); - error.combine(hint); - } + Err(error) => { return TokenStream::from(error.to_compile_error()); } } diff --git a/third_party/rust/num-derive/tests/newtype-2018.rs b/third_party/rust/num-derive/tests/newtype-2018.rs new file mode 100644 index 000000000000..814529ec8abb --- /dev/null +++ b/third_party/rust/num-derive/tests/newtype-2018.rs @@ -0,0 +1,2 @@ +// Same source, just compiled for 2018 edition +include!("newtype.rs"); diff --git a/third_party/rust/num-derive/tests/trivial-2018.rs b/third_party/rust/num-derive/tests/trivial-2018.rs new file mode 100644 index 000000000000..92b971bc83c8 --- /dev/null +++ b/third_party/rust/num-derive/tests/trivial-2018.rs @@ -0,0 +1,2 @@ +// Same source, just compiled for 2018 edition +include!("trivial.rs"); diff --git a/third_party/rust/num-derive/tests/with_custom_values.rs b/third_party/rust/num-derive/tests/with_custom_values.rs index 94c84458be6b..9b202f4c5190 100644 --- a/third_party/rust/num-derive/tests/with_custom_values.rs +++ b/third_party/rust/num-derive/tests/with_custom_values.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![cfg(feature = "full-syntax")] - extern crate num as num_renamed; #[macro_use] extern crate num_derive;