Skip to content

Commit

Permalink
Bug 1841205 - Update num-derive to 0.4. r=emilio,supply-chain-reviewers
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Jul 4, 2023
1 parent e46d768 commit 7db694c
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 38 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion servo/components/style/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions supply-chain/audits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.3.3 -> 0.4.0"

[[audits.num-integer]]
who = "Josh Stone <[email protected]>"
criteria = "safe-to-deploy"
Expand Down
4 changes: 0 additions & 4 deletions supply-chain/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion third_party/rust/num-derive/.cargo-checksum.json
Original file line number Diff line number Diff line change
@@ -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"}
{"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"}
42 changes: 28 additions & 14 deletions third_party/rust/num-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -34,22 +41,29 @@ 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"

[dependencies.quote]
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"]
6 changes: 3 additions & 3 deletions third_party/rust/num-derive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions third_party/rust/num-derive/RELEASES.md
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
10 changes: 1 addition & 9 deletions third_party/rust/num-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
2 changes: 2 additions & 0 deletions third_party/rust/num-derive/tests/newtype-2018.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Same source, just compiled for 2018 edition
include!("newtype.rs");
2 changes: 2 additions & 0 deletions third_party/rust/num-derive/tests/trivial-2018.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Same source, just compiled for 2018 edition
include!("trivial.rs");
2 changes: 0 additions & 2 deletions third_party/rust/num-derive/tests/with_custom_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7db694c

Please sign in to comment.