Skip to content

Commit 2300eed

Browse files
Replace deprecated proc-macro-error2 with proc-macro2-diagnostics (#4613)
proc-macro-error2 is unmaintained (RUSTSEC-2026-0173). Migrate the kani_macros crate to proc-macro2-diagnostics, one of the alternatives recommended by the advisory. The abort!/abort_call_site! macros (which panicked and were caught by the #[proc_macro_error] wrapper) are replaced by threading Result<TokenStream, Diagnostic> through the macro helpers and emitting the diagnostic at each entry point via Diagnostic::emit_as_item_tokens(). The structured note/help sub-diagnostics and spans are preserved, and proc-macro2-diagnostics auto-enables native nightly emission, so the compiler output is unchanged. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
1 parent 4c0fce8 commit 2300eed

6 files changed

Lines changed: 277 additions & 158 deletions

File tree

Cargo.lock

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ dependencies = [
119119

120120
[[package]]
121121
name = "anyhow"
122-
version = "1.0.102"
122+
version = "1.0.103"
123123
source = "registry+https://github.com/rust-lang/crates.io-index"
124-
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
124+
checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3"
125125

126126
[[package]]
127127
name = "ar_archive_writer"
@@ -1110,8 +1110,8 @@ dependencies = [
11101110
name = "kani_macros"
11111111
version = "0.67.0"
11121112
dependencies = [
1113-
"proc-macro-error2",
11141113
"proc-macro2",
1114+
"proc-macro2-diagnostics",
11151115
"quote",
11161116
"strum",
11171117
"strum_macros",
@@ -1675,34 +1675,24 @@ dependencies = [
16751675
]
16761676

16771677
[[package]]
1678-
name = "proc-macro-error-attr2"
1679-
version = "2.0.0"
1678+
name = "proc-macro2"
1679+
version = "1.0.106"
16801680
source = "registry+https://github.com/rust-lang/crates.io-index"
1681-
checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"
1681+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
16821682
dependencies = [
1683-
"proc-macro2",
1684-
"quote",
1683+
"unicode-ident",
16851684
]
16861685

16871686
[[package]]
1688-
name = "proc-macro-error2"
1689-
version = "2.0.1"
1687+
name = "proc-macro2-diagnostics"
1688+
version = "0.10.1"
16901689
source = "registry+https://github.com/rust-lang/crates.io-index"
1691-
checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"
1690+
checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
16921691
dependencies = [
1693-
"proc-macro-error-attr2",
16941692
"proc-macro2",
16951693
"quote",
16961694
"syn",
1697-
]
1698-
1699-
[[package]]
1700-
name = "proc-macro2"
1701-
version = "1.0.106"
1702-
source = "registry+https://github.com/rust-lang/crates.io-index"
1703-
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
1704-
dependencies = [
1705-
"unicode-ident",
1695+
"version_check",
17061696
]
17071697

17081698
[[package]]

library/kani_macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ proc-macro = true
1313

1414
[dependencies]
1515
proc-macro2 = "1.0"
16-
proc-macro-error2 = { version = "2.0.0", features = ["nightly"] }
16+
proc-macro2-diagnostics = { version = "0.10", default-features = false }
1717
quote = "1.0.20"
1818
syn = { version = "2.0.18", features = ["full", "visit-mut", "visit", "extra-traits"] }
1919
strum = "0.27.1"

0 commit comments

Comments
 (0)