Skip to content

Commit ef56dd1

Browse files
authored
Merge pull request #732 from Emilgardis/bump-syn
update to syn2
2 parents 615f093 + 4da1837 commit ef56dd1

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
77

88
## [Unreleased]
99

10+
- Updated syn to version 2 (#732)
11+
1012
## [v0.29.0] - 2023-06-05
1113

1214
- `FieldFpec` instead or `fty` generic (#722)
1315
- print error on ci `curl` request fail (#725)
1416
- removed `rty` generic in `FieldWriter` (#721)
15-
- `bool` and `u8` as default generics for `BitReader/Writer` and `FieldReader/Writer` (#720)
17+
- `bool` and `u8` as default generics for `BitReader/Writer` and `FieldReader/Writer` (#720)
1618
- Bump MSRV to 1.65 (#711)
1719
- Optimize case change/sanitize (#715)
1820
- Fix dangling implicit derives (#703)

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ features = ["serde"]
6767
version = "0.14.1"
6868

6969
[dependencies.syn]
70-
version = "1.0"
70+
version = "2.0"
7171
features = ["full","extra-traits"]

src/generate/peripheral.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use quote::{quote, ToTokens};
1616
use syn::{punctuated::Punctuated, Token};
1717

1818
use crate::util::{
19-
self, array_proxy_type, name_to_ty, new_syn_u32, path_segment, type_path, unsuffixed, Config,
20-
FullName, ToSanitizedCase, BITS_PER_BYTE,
19+
self, array_proxy_type, name_to_ty, path_segment, type_path, unsuffixed, Config, FullName,
20+
ToSanitizedCase, BITS_PER_BYTE,
2121
};
2222
use anyhow::{anyhow, bail, Context, Result};
2323

@@ -1393,21 +1393,16 @@ fn new_syn_field(ident: Ident, ty: syn::Type) -> syn::Field {
13931393
let span = Span::call_site();
13941394
syn::Field {
13951395
ident: Some(ident),
1396-
vis: syn::Visibility::Public(syn::VisPublic {
1397-
pub_token: Token![pub](span),
1398-
}),
1396+
vis: syn::Visibility::Public(Token![pub](span)),
13991397
attrs: vec![],
14001398
colon_token: Some(Token![:](span)),
14011399
ty,
1400+
mutability: syn::FieldMutability::None,
14021401
}
14031402
}
14041403

14051404
fn new_syn_array(ty: syn::Type, len: u32) -> syn::Type {
14061405
let span = Span::call_site();
1407-
syn::Type::Array(syn::TypeArray {
1408-
bracket_token: syn::token::Bracket { span },
1409-
elem: ty.into(),
1410-
semi_token: Token![;](span),
1411-
len: new_syn_u32(len, span),
1412-
})
1406+
let len = unsuffixed(len as _);
1407+
syn::parse_quote_spanned!( span => [#ty; #len] )
14131408
}

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::path::{Path, PathBuf};
1010
use svd_rs::{MaybeArray, Peripheral, PeripheralInfo};
1111

1212
use syn::{
13-
punctuated::Punctuated, token::Colon2, AngleBracketedGenericArguments, GenericArgument, Lit,
13+
punctuated::Punctuated, token::PathSep, AngleBracketedGenericArguments, GenericArgument, Lit,
1414
LitInt, PathArguments, PathSegment, Token, Type, TypePath,
1515
};
1616

@@ -473,7 +473,7 @@ pub fn ident_to_path(ident: Ident) -> TypePath {
473473
type_path(segments)
474474
}
475475

476-
pub fn type_path(segments: Punctuated<PathSegment, Colon2>) -> TypePath {
476+
pub fn type_path(segments: Punctuated<PathSegment, PathSep>) -> TypePath {
477477
TypePath {
478478
qself: None,
479479
path: syn::Path {

0 commit comments

Comments
 (0)