Skip to content

Commit f0d3bbb

Browse files
sam0x17bkchr
andauthored
Globally upgrade to syn 2.x and latest quote and proc_macro2 1x versions (paritytech#13846)
* globally upgrade quote to latest 1.0.x (1.0.26) * globally upgrade syn to final 1.0.x version (1.0.109) * globally upgrade proc-macro2 to 1.0.56 * upgrade to syn v2.0.13 and fix everything except NestedMeta * fix parse nested metadata code in decl_runtime_apis.rs * Port more stuff to syn 2.0 * Make the rest compile * Ignore error * update to syn 2.0.14 --------- Co-authored-by: Bastian Köcher <[email protected]>
1 parent b4f857e commit f0d3bbb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+409
-485
lines changed

Cargo.lock

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node/cli/tests/telemetry.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ async fn telemetry_works() {
5757
}
5858
},
5959

60-
Event::TextFrame { .. } =>
61-
panic!("Got a TextFrame over the socket, this is a bug"),
60+
Event::TextFrame { .. } => {
61+
panic!("Got a TextFrame over the socket, this is a bug")
62+
},
6263

6364
// Connection has been closed.
6465
Event::ConnectionError { .. } => {},

client/chain-spec/derive/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ proc-macro = true
1616

1717
[dependencies]
1818
proc-macro-crate = "1.1.3"
19-
proc-macro2 = "1.0.37"
20-
quote = "1.0.10"
21-
syn = "1.0.98"
19+
proc-macro2 = "1.0.56"
20+
quote = "1.0.26"
21+
syn = "2.0.14"

client/chain-spec/derive/src/impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn extension_derive(ast: &DeriveInput) -> proc_macro::TokenStream {
3535
.named
3636
.iter()
3737
.find_map(|f| {
38-
if f.attrs.iter().any(|attr| attr.path.is_ident(ATTRIBUTE_NAME)) {
38+
if f.attrs.iter().any(|attr| attr.path().is_ident(ATTRIBUTE_NAME)) {
3939
let typ = &f.ty;
4040
Some(quote! { #typ })
4141
} else {

client/consensus/babe/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,9 @@ fn aux_storage_cleanup<C: HeaderMetadata<Block> + HeaderBackend<Block>, Block: B
556556
Ok(meta) => {
557557
hashes.insert(meta.parent);
558558
},
559-
Err(err) =>
560-
warn!(target: LOG_TARGET, "Failed to lookup metadata for block `{:?}`: {}", first, err,),
559+
Err(err) => {
560+
warn!(target: LOG_TARGET, "Failed to lookup metadata for block `{:?}`: {}", first, err,)
561+
},
561562
}
562563

563564
// Cleans data for finalized block's ancestors

client/db/src/pinned_blocks_cache.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ impl<Block: BlockT> PinnedBlocksCache<Block> {
149149
self.cache.len()
150150
);
151151
},
152-
None =>
153-
log::warn!(target: LOG_TARGET, "Unable to bump reference count. hash = {}", hash),
152+
None => {
153+
log::warn!(target: LOG_TARGET, "Unable to bump reference count. hash = {}", hash)
154+
},
154155
};
155156
}
156157

client/service/test/src/client/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ fn finality_notification_check(
158158
assert_eq!(notif.hash, *finalized.last().unwrap());
159159
assert_eq!(stale_heads, stale_heads_expected);
160160
},
161-
Err(TryRecvError::Closed) =>
162-
panic!("unexpected notification result, client send channel was closed"),
161+
Err(TryRecvError::Closed) => {
162+
panic!("unexpected notification result, client send channel was closed")
163+
},
163164
Err(TryRecvError::Empty) => assert!(finalized.is_empty()),
164165
}
165166
}

client/state-db/src/lib.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,14 @@ impl fmt::Debug for StateDbError {
187187
"Incompatible pruning modes [stored: {:?}; requested: {:?}]",
188188
stored, requested
189189
),
190-
Self::TooManySiblingBlocks { number } =>
191-
write!(f, "Too many sibling blocks at #{number} inserted"),
190+
Self::TooManySiblingBlocks { number } => {
191+
write!(f, "Too many sibling blocks at #{number} inserted")
192+
},
192193
Self::BlockAlreadyExists => write!(f, "Block already exists"),
193194
Self::Metadata(message) => write!(f, "Invalid metadata: {}", message),
194-
Self::BlockUnavailable =>
195-
write!(f, "Trying to get a block record from db while it is not commit to db yet"),
195+
Self::BlockUnavailable => {
196+
write!(f, "Trying to get a block record from db while it is not commit to db yet")
197+
},
196198
Self::BlockMissing => write!(f, "Block record is missing from the pruning window"),
197199
}
198200
}

client/tracing/proc-macro/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ proc-macro = true
1616

1717
[dependencies]
1818
proc-macro-crate = "1.1.3"
19-
proc-macro2 = "1.0.37"
20-
quote = { version = "1.0.10", features = ["proc-macro"] }
21-
syn = { version = "1.0.98", features = ["proc-macro", "full", "extra-traits", "parsing"] }
19+
proc-macro2 = "1.0.56"
20+
quote = { version = "1.0.26", features = ["proc-macro"] }
21+
syn = { version = "2.0.14", features = ["proc-macro", "full", "extra-traits", "parsing"] }

frame/contracts/proc-macro/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"]
1515
proc-macro = true
1616

1717
[dependencies]
18-
proc-macro2 = "1"
19-
quote = "1"
20-
syn = { version = "1.0.98", features = ["full"] }
18+
proc-macro2 = "1.0.56"
19+
quote = "1.0.26"
20+
syn = { version = "2.0.14", features = ["full"] }
2121

2222
[dev-dependencies]
2323

frame/contracts/proc-macro/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ impl HostFn {
209209
"only #[version(<u8>)], #[unstable], #[prefixed_alias] and #[deprecated] attributes are allowed.";
210210
let span = item.span();
211211
let mut attrs = item.attrs.clone();
212-
attrs.retain(|a| !a.path.is_ident("doc"));
212+
attrs.retain(|a| !a.path().is_ident("doc"));
213213
let mut maybe_version = None;
214214
let mut is_stable = true;
215215
let mut alias_to = None;
216216
let mut not_deprecated = true;
217217
while let Some(attr) = attrs.pop() {
218-
let ident = attr.path.get_ident().ok_or(err(span, msg))?.to_string();
218+
let ident = attr.path().get_ident().ok_or(err(span, msg))?.to_string();
219219
match ident.as_str() {
220220
"version" => {
221221
if maybe_version.is_some() {
@@ -377,7 +377,7 @@ impl EnvDef {
377377
_ => None,
378378
};
379379

380-
let selector = |a: &syn::Attribute| a.path.is_ident("prefixed_alias");
380+
let selector = |a: &syn::Attribute| a.path().is_ident("prefixed_alias");
381381

382382
let aliases = items
383383
.iter()
@@ -401,7 +401,7 @@ impl EnvDef {
401401
}
402402

403403
fn is_valid_special_arg(idx: usize, arg: &FnArg) -> bool {
404-
let pat = if let FnArg::Typed(pat) = arg { pat } else { return false };
404+
let FnArg::Typed(pat) = arg else { return false };
405405
let ident = if let syn::Pat::Ident(ref ident) = *pat.pat { &ident.ident } else { return false };
406406
let name_ok = match idx {
407407
0 => ident == "ctx" || ident == "_ctx",
@@ -434,7 +434,7 @@ fn expand_func_doc(func: &HostFn) -> TokenStream2 {
434434
);
435435
quote! { #[doc = #alias_doc] }
436436
} else {
437-
let docs = func.item.attrs.iter().filter(|a| a.path.is_ident("doc")).map(|d| {
437+
let docs = func.item.attrs.iter().filter(|a| a.path().is_ident("doc")).map(|d| {
438438
let docs = d.to_token_stream();
439439
quote! { #docs }
440440
});

frame/election-provider-support/solution-type/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"]
1515
proc-macro = true
1616

1717
[dependencies]
18-
syn = { version = "1.0.98", features = ["full", "visit"] }
19-
quote = "1.0"
20-
proc-macro2 = "1.0.37"
18+
syn = { version = "2.0.14", features = ["full", "visit"] }
19+
quote = "1.0.26"
20+
proc-macro2 = "1.0.56"
2121
proc-macro-crate = "1.1.3"
2222

2323
[dev-dependencies]

frame/election-provider-support/solution-type/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn check_attributes(input: ParseStream) -> syn::Result<bool> {
161161
return Ok(false)
162162
}
163163
let attr = attrs.pop().expect("attributes vec with len 1 can be popped.");
164-
if attr.path.is_ident("compact") {
164+
if attr.path().is_ident("compact") {
165165
Ok(true)
166166
} else {
167167
Err(syn::Error::new_spanned(attr, "compact solution can accept only #[compact]"))
@@ -200,7 +200,7 @@ impl Parse for SolutionDef {
200200
format!("Expected binding: `{} = ...`", expected),
201201
))
202202
},
203-
syn::GenericArgument::Binding(syn::Binding { ident, ty, .. }) => {
203+
syn::GenericArgument::AssocType(syn::AssocType { ident, ty, .. }) => {
204204
// check that we have the right keyword for this position in the argument list
205205
if ident == expected {
206206
Ok(ty.clone())

frame/nfts/src/tests.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2700,7 +2700,11 @@ fn claim_swap_should_work() {
27002700
Balances::make_free_balance_be(&user_1, initial_balance);
27012701
Balances::make_free_balance_be(&user_2, initial_balance);
27022702

2703-
assert_ok!(Nfts::force_create(RuntimeOrigin::root(), user_1.clone(), default_collection_config()));
2703+
assert_ok!(Nfts::force_create(
2704+
RuntimeOrigin::root(),
2705+
user_1.clone(),
2706+
default_collection_config()
2707+
));
27042708

27052709
assert_ok!(Nfts::mint(
27062710
RuntimeOrigin::signed(user_1.clone()),

frame/scheduler/src/migration.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,9 @@ pub mod v4 {
297297
target: TARGET,
298298
"Did not clean up any agendas. v4::CleanupAgendas can be removed."
299299
),
300-
Some(n) =>
301-
log::info!(target: TARGET, "Cleaned up {} agendas, now {}", n, new_agendas),
300+
Some(n) => {
301+
log::info!(target: TARGET, "Cleaned up {} agendas, now {}", n, new_agendas)
302+
},
302303
None => unreachable!(
303304
"Number of agendas cannot increase, old {} new {}",
304305
old_agendas, new_agendas
@@ -560,8 +561,9 @@ mod test {
560561
"Agenda {} should be removed",
561562
i
562563
),
563-
Some(new) =>
564-
assert_eq!(Agenda::<Test>::get(i as u64), new, "Agenda wrong {}", i),
564+
Some(new) => {
565+
assert_eq!(Agenda::<Test>::get(i as u64), new, "Agenda wrong {}", i)
566+
},
565567
}
566568
}
567569
});

frame/staking/reward-curve/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ proc-macro = true
1616

1717
[dependencies]
1818
proc-macro-crate = "1.1.3"
19-
proc-macro2 = "1.0.37"
20-
quote = "1.0.10"
21-
syn = { version = "1.0.98", features = ["full", "visit"] }
19+
proc-macro2 = "1.0.56"
20+
quote = "1.0.26"
21+
syn = { version = "2.0.14", features = ["full", "visit"] }
2222

2323
[dev-dependencies]
2424
sp-runtime = { version = "7.0.0", path = "../../../primitives/runtime" }

0 commit comments

Comments
 (0)