From e3a5e8ec23f40ed1cc7a700cc57630161449d728 Mon Sep 17 00:00:00 2001 From: Zyad Hassan <88045115+zhassan-aws@users.noreply.github.com> Date: Thu, 5 Sep 2024 13:47:26 -0700 Subject: [PATCH] Replace `proc-macro-error` with `proc-macro-error2` (#3493) The following security advisory has been issued today regarding the `proc-macro-error` crate which is causing our CI to fail: https://rustsec.org/advisories/RUSTSEC-2024-0370 Replacing the crate with `proc-macro-error2` which is a fork of that crate. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --- Cargo.lock | 46 +++++++++--------------- library/kani_macros/Cargo.toml | 2 +- library/kani_macros/src/derive.rs | 2 +- library/kani_macros/src/lib.rs | 4 +-- tests/ui/derive-arbitrary/union/expected | 5 +-- 5 files changed, 22 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c371b85fba9..560ad32c310c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,7 +176,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn", ] [[package]] @@ -483,7 +483,7 @@ dependencies = [ "shell-words", "strum", "strum_macros", - "syn 2.0.77", + "syn", "tracing", "tracing-subscriber", "tracing-tree", @@ -538,10 +538,10 @@ dependencies = [ name = "kani_macros" version = "0.55.0" dependencies = [ - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.77", + "syn", ] [[package]] @@ -801,27 +801,25 @@ dependencies = [ ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "74cdd32837fa2e86ec09c8266e5aad92400ac934c6dbca83d54673b298db3e45" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn", ] [[package]] @@ -1029,7 +1027,7 @@ checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn", ] [[package]] @@ -1136,17 +1134,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.77", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "unicode-ident", + "syn", ] [[package]] @@ -1190,7 +1178,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn", ] [[package]] @@ -1287,7 +1275,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn", ] [[package]] @@ -1574,5 +1562,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn", ] diff --git a/library/kani_macros/Cargo.toml b/library/kani_macros/Cargo.toml index a6b20a68bc39..a1aeb743952b 100644 --- a/library/kani_macros/Cargo.toml +++ b/library/kani_macros/Cargo.toml @@ -13,7 +13,7 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" -proc-macro-error = "1.0.4" +proc-macro-error2 = "2.0.0" quote = "1.0.20" syn = { version = "2.0.18", features = ["full", "visit-mut", "visit", "extra-traits"] } diff --git a/library/kani_macros/src/derive.rs b/library/kani_macros/src/derive.rs index cc936560e510..e89f6f089795 100644 --- a/library/kani_macros/src/derive.rs +++ b/library/kani_macros/src/derive.rs @@ -10,7 +10,7 @@ //! //! ``` use proc_macro2::{Ident, Span, TokenStream}; -use proc_macro_error::abort; +use proc_macro_error2::abort; use quote::{quote, quote_spanned}; use syn::spanned::Spanned; use syn::{ diff --git a/library/kani_macros/src/lib.rs b/library/kani_macros/src/lib.rs index 63ed990a4840..8a1d2d80f864 100644 --- a/library/kani_macros/src/lib.rs +++ b/library/kani_macros/src/lib.rs @@ -12,7 +12,7 @@ mod derive; // proc_macro::quote is nightly-only, so we'll cobble things together instead use proc_macro::TokenStream; -use proc_macro_error::proc_macro_error; +use proc_macro_error2::proc_macro_error; #[cfg(kani_sysroot)] use sysroot as attr_impl; @@ -398,7 +398,7 @@ pub fn modifies(attr: TokenStream, item: TokenStream) -> TokenStream { /// This code should only be activated when pre-building Kani's sysroot. #[cfg(kani_sysroot)] mod sysroot { - use proc_macro_error::{abort, abort_call_site}; + use proc_macro_error2::{abort, abort_call_site}; mod contracts; diff --git a/tests/ui/derive-arbitrary/union/expected b/tests/ui/derive-arbitrary/union/expected index 3acea286d7ca..e54592a47ca6 100644 --- a/tests/ui/derive-arbitrary/union/expected +++ b/tests/ui/derive-arbitrary/union/expected @@ -3,10 +3,7 @@ error: Cannot derive `Arbitrary` for `Wrapper` union |\ | #[derive(kani::Arbitrary)]\ | ^^^^^^^^^^^^^^^\ -|\ +| note: `#[derive(Arbitrary)]` cannot be used for unions such as `Wrapper` -|\ -| union Wrapper {\ -| ^^^^^^^\ = note: this error originates in the derive macro `kani::Arbitrary`