mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-21 22:32:23 +00:00
Switch to syn
2.0 (#183)
This upgrades the derives from `syn` 1.0 to `syn` 2.0. While the MSRV for `syn` 2.0 is not Rust 1.56 which is higher than the MSRV of `bytemuck`, the derives don't fall under the MSRV policy.
This commit is contained in:
parent
b19f8abfe3
commit
b97dee7f90
@ -16,7 +16,7 @@ proc-macro = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# syn seems to have broken backwards compatibility in this version https://github.com/dtolnay/syn/issues/1194
|
# syn seems to have broken backwards compatibility in this version https://github.com/dtolnay/syn/issues/1194
|
||||||
syn = "1.0.99"
|
syn = "2.0.1"
|
||||||
quote = "1"
|
quote = "1"
|
||||||
proc-macro2 = "1"
|
proc-macro2 = "1"
|
||||||
|
|
||||||
|
@ -573,13 +573,11 @@ fn get_ident_from_stream(tokens: TokenStream) -> Option<Ident> {
|
|||||||
/// get a simple #[foo(bar)] attribute, returning "bar"
|
/// get a simple #[foo(bar)] attribute, returning "bar"
|
||||||
fn get_simple_attr(attributes: &[Attribute], attr_name: &str) -> Option<Ident> {
|
fn get_simple_attr(attributes: &[Attribute], attr_name: &str) -> Option<Ident> {
|
||||||
for attr in attributes {
|
for attr in attributes {
|
||||||
if let (AttrStyle::Outer, Some(outer_ident), Some(inner_ident)) = (
|
if let (AttrStyle::Outer, Meta::List(list)) = (&attr.style, &attr.meta) {
|
||||||
&attr.style,
|
if list.path.is_ident(attr_name) {
|
||||||
attr.path.get_ident(),
|
if let Some(ident) = get_ident_from_stream(list.tokens.clone()) {
|
||||||
get_ident_from_stream(attr.tokens.clone()),
|
return Some(ident);
|
||||||
) {
|
}
|
||||||
if outer_ident.to_string() == attr_name {
|
|
||||||
return Some(inner_ident);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,7 +589,7 @@ fn get_repr(attributes: &[Attribute]) -> Result<Representation> {
|
|||||||
attributes
|
attributes
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|attr| {
|
.filter_map(|attr| {
|
||||||
if attr.path.is_ident("repr") {
|
if attr.path().is_ident("repr") {
|
||||||
Some(attr.parse_args::<Representation>())
|
Some(attr.parse_args::<Representation>())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
Loading…
Reference in New Issue
Block a user