diff --git a/Cargo.lock b/Cargo.lock
index 5c11381921..7a5f139aee 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -127,7 +127,7 @@ version = "0.1.0"
dependencies = [
"proc-macro2",
"quote 1.0.33",
- "syn 1.0.103",
+ "syn 2.0.37",
]
[[package]]
@@ -252,7 +252,7 @@ version = "0.1.0"
dependencies = [
"proc-macro2",
"quote 1.0.33",
- "syn 1.0.103",
+ "syn 2.0.37",
]
[[package]]
@@ -310,7 +310,7 @@ version = "0.1.0"
dependencies = [
"proc-macro2",
"quote 1.0.33",
- "syn 1.0.103",
+ "syn 2.0.37",
]
[[package]]
@@ -2423,7 +2423,7 @@ dependencies = [
"argh",
"proc-macro2",
"quote 1.0.33",
- "syn 1.0.103",
+ "syn 2.0.37",
]
[[package]]
diff --git a/argh_helpers/Cargo.toml b/argh_helpers/Cargo.toml
index c9431921a2..71b9c4d51e 100644
--- a/argh_helpers/Cargo.toml
+++ b/argh_helpers/Cargo.toml
@@ -7,6 +7,6 @@ edition = "2021"
proc-macro = true
[dependencies]
-syn = {version = "1.0", features = ["extra-traits"]}
+syn = { version = "2", features = ["extra-traits"] }
quote = "1.0"
proc-macro2 = "1.0"
diff --git a/argh_helpers/src/lib.rs b/argh_helpers/src/lib.rs
index 2441d72698..c695f4475a 100644
--- a/argh_helpers/src/lib.rs
+++ b/argh_helpers/src/lib.rs
@@ -136,20 +136,26 @@ pub fn pad_description_for_argh(
if let syn::Fields::Named(fields) = &mut s.fields {
for f in fields.named.iter_mut() {
for a in f.attrs.iter_mut() {
- if a.path
+ if a.path()
.get_ident()
.map(|i| i.to_string())
.unwrap_or_default()
== *"doc"
{
- if let Ok(syn::Meta::NameValue(nv)) = a.parse_meta() {
- if let syn::Lit::Str(s) = nv.lit {
- let doc = s.value().lines().fold(String::new(), |mut output, s| {
- let _ = write!(output, "{: <61}", s);
- output
- });
- *a = syn::parse_quote! { #[doc= #doc] };
- }
+ if let syn::Meta::NameValue(syn::MetaNameValue {
+ value:
+ syn::Expr::Lit(syn::ExprLit {
+ lit: syn::Lit::Str(s),
+ ..
+ }),
+ ..
+ }) = &a.meta
+ {
+ let doc = s.value().lines().fold(String::new(), |mut output, s| {
+ let _ = write!(output, "{: <61}", s);
+ output
+ });
+ *a = syn::parse_quote! { #[doc= #doc] };
}
}
}
diff --git a/base/base_event_token_derive/Cargo.toml b/base/base_event_token_derive/Cargo.toml
index cd55db3d85..be3316b7b2 100644
--- a/base/base_event_token_derive/Cargo.toml
+++ b/base/base_event_token_derive/Cargo.toml
@@ -11,4 +11,4 @@ proc-macro = true
[dependencies]
proc-macro2 = "^1"
quote = "^1"
-syn = "^1"
+syn = "2"
diff --git a/bit_field/bit_field_derive/Cargo.toml b/bit_field/bit_field_derive/Cargo.toml
index be1010b9c0..cf59cfa4a3 100644
--- a/bit_field/bit_field_derive/Cargo.toml
+++ b/bit_field/bit_field_derive/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
proc-macro2 = "^1"
quote = "^1"
-syn = "^1"
+syn = { version = "2", features = ["full"] }
[lib]
proc-macro = true
diff --git a/bit_field/bit_field_derive/bit_field_derive.rs b/bit_field/bit_field_derive/bit_field_derive.rs
index ee54199424..b3c0dd0ece 100644
--- a/bit_field/bit_field_derive/bit_field_derive.rs
+++ b/bit_field/bit_field_derive/bit_field_derive.rs
@@ -24,6 +24,7 @@ use syn::Ident;
use syn::Lit;
use syn::LitInt;
use syn::Meta;
+use syn::MetaNameValue;
use syn::Type;
use syn::Visibility;
@@ -391,10 +392,10 @@ fn parse_bits_attr(attrs: &[Attribute]) -> Result