[go: up one dir, main page]

Skip to content

Commit

Permalink
Replace proc-macro-error with proc-macro-error2 (model-checking#3493
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
zhassan-aws authored Sep 5, 2024
1 parent 701f6fb commit e3a5e8e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 37 deletions.
46 changes: 17 additions & 29 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.77",
"syn",
]

[[package]]
Expand Down Expand Up @@ -483,7 +483,7 @@ dependencies = [
"shell-words",
"strum",
"strum_macros",
"syn 2.0.77",
"syn",
"tracing",
"tracing-subscriber",
"tracing-tree",
Expand Down Expand Up @@ -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]]
Expand Down Expand Up @@ -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]]
Expand Down Expand Up @@ -1029,7 +1027,7 @@ checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.77",
"syn",
]

[[package]]
Expand Down Expand Up @@ -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]]
Expand Down Expand Up @@ -1190,7 +1178,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.77",
"syn",
]

[[package]]
Expand Down Expand Up @@ -1287,7 +1275,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.77",
"syn",
]

[[package]]
Expand Down Expand Up @@ -1574,5 +1562,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.77",
"syn",
]
2 changes: 1 addition & 1 deletion library/kani_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

Expand Down
2 changes: 1 addition & 1 deletion library/kani_macros/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
4 changes: 2 additions & 2 deletions library/kani_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
5 changes: 1 addition & 4 deletions tests/ui/derive-arbitrary/union/expected
Original file line number Diff line number Diff line change
Expand Up @@ -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`

0 comments on commit e3a5e8e

Please sign in to comment.