Skip to content

Commit f95573c

Browse files
bors[bot]jonasbb
andauthored
Merge #578
578: Prepare for syn v2 r=jonasbb a=jonasbb Update darling to v0.20 and syn to v2, require serde v1.0.157 (first using syn v2). This moves all direct dependencies to crates using syn v2. syn v2 has problems with the `#[serde_as(as = "..")]` style of attributes, since `as` is a keyword and keywords are not allowed in meta attributes. Instead pre-process the token stream to replace all `as` with `r#as` which can be parsed. Bump thiserror and cxx in the lock file. Not all crates are using syn v2 yet. Co-authored-by: Jonas Bushart <jonas@bushart.org>
2 parents 74858ec + 008a62f commit f95573c

File tree

9 files changed

+151
-85
lines changed

9 files changed

+151
-85
lines changed

Cargo.lock

Lines changed: 48 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

serde_with/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
* Update `syn` to v2 and `darling` to v0.20 (#578)
13+
Update proc-macro dependencies.
14+
This change should have no impact on users, but now uses the same dependency as `serde_derive`.
15+
1016
## [2.3.2] - 2023-04-05
1117

1218
### Changed

serde_with/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ hex = {version = "0.4.3", optional = true, default-features = false}
6767
indexmap_1 = {package = "indexmap", version = "1.8", optional = true, default-features = false, features = ["serde-1"]}
6868
# The derive feature is needed for the flattened_maybe macro.
6969
# https://github.com/jonasbb/serde_with/blob/eb1965a74a3be073ecd13ec05f02a01bc1c44309/serde_with/src/flatten_maybe.rs#L67
70-
serde = {version = "1.0.139", default-features = false, features = ["derive"] }
70+
serde = {version = "1.0.157", default-features = false, features = ["derive"] }
7171
serde_json = {version = "1.0.45", optional = true, default-features = false}
7272
serde_with_macros = {path = "../serde_with_macros", version = "=2.3.2", optional = true}
7373
time_0_3 = {package = "time", version = "~0.3.11", optional = true, default-features = false}

serde_with/src/flatten_maybe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
/// ```
5151
#[macro_export]
5252
macro_rules! flattened_maybe {
53-
($fn:ident, $field:literal) => {
53+
($fn:ident, $field:tt) => {
5454
fn $fn<'de, T, D>(deserializer: D) -> $crate::__private__::Result<T, D::Error>
5555
where
5656
T: $crate::serde::Deserialize<'de>,

serde_with_macros/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
* Update `syn` to v2 and `darling` to v0.20 (#578)
13+
Update proc-macro dependencies.
14+
This change should have no impact on users, but now uses the same dependency as `serde_derive`.
15+
1016
## [2.3.2] - 2023-04-05
1117

1218
No changes.

serde_with_macros/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ proc-macro = true
3030
maintenance = {status = "actively-developed"}
3131

3232
[dependencies]
33-
darling = "0.14.0"
33+
darling = "0.20.0"
3434
proc-macro2 = "1.0.1"
3535
quote = "1.0.0"
3636

@@ -40,13 +40,13 @@ features = [
4040
"full",
4141
"parsing",
4242
]
43-
version = "1.0.3"
43+
version = "2.0.0"
4444

4545
[dev-dependencies]
4646
expect-test = "1.4.0"
4747
pretty_assertions = "1.0.0"
4848
rustversion = "1.0.0"
49-
serde = {version = "1.0.75", features = ["derive"]}
49+
serde = {version = "1.0.157", features = ["derive"]}
5050
serde_json = "1.0.25"
5151
trybuild = "1.0.80"
5252
version-sync = "0.9.1"

serde_with_macros/src/apply.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use darling::{Error as DarlingError, FromMeta};
1+
use darling::{ast::NestedMeta, Error as DarlingError, FromMeta};
22
use proc_macro::TokenStream;
33
use quote::ToTokens as _;
44
use syn::{
55
parse::{Parse, ParseStream},
66
punctuated::Punctuated,
7-
Attribute, Error, Field, NestedMeta, Path, Token, Type, TypeArray, TypeGroup, TypeParen,
8-
TypePath, TypePtr, TypeReference, TypeSlice, TypeTuple,
7+
Attribute, Error, Field, Path, Token, Type, TypeArray, TypeGroup, TypeParen, TypePath, TypePtr,
8+
TypeReference, TypeSlice, TypeTuple,
99
};
1010

1111
/// Parsed form of a single rule in the `#[apply(...)]` attribute.
@@ -53,7 +53,7 @@ impl Parse for ApplyInput {
5353
}
5454

5555
let rules: Punctuated<AddAttributesRule, Token![,]> =
56-
input.parse_terminated(AddAttributesRule::parse)?;
56+
input.parse_terminated(AddAttributesRule::parse, Token![,])?;
5757
Ok(Self { metas, rules })
5858
}
5959
}

0 commit comments

Comments
 (0)