Check for None-delimited group in attribute value
This commit is contained in:
parent
c3d637f397
commit
dd460f82a1
@ -24,7 +24,7 @@ proc-macro = true
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0"
|
||||
quote = "1.0"
|
||||
syn = "2.0"
|
||||
syn = "2.0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
serde = { version = "1.0", path = "../serde" }
|
||||
|
@ -1381,12 +1381,18 @@ fn get_lit_str2(
|
||||
meta_item_name: Symbol,
|
||||
meta: &ParseNestedMeta,
|
||||
) -> syn::Result<Option<syn::LitStr>> {
|
||||
match meta.value()?.parse()? {
|
||||
syn::Expr::Lit(syn::ExprLit {
|
||||
let expr: syn::Expr = meta.value()?.parse()?;
|
||||
let mut value = &expr;
|
||||
while let syn::Expr::Group(e) = value {
|
||||
value = &e.expr;
|
||||
}
|
||||
if let syn::Expr::Lit(syn::ExprLit {
|
||||
lit: syn::Lit::Str(lit),
|
||||
..
|
||||
}) => Ok(Some(lit)),
|
||||
expr => {
|
||||
}) = value
|
||||
{
|
||||
Ok(Some(lit.clone()))
|
||||
} else {
|
||||
cx.error_spanned_by(
|
||||
expr,
|
||||
format!(
|
||||
@ -1397,7 +1403,6 @@ fn get_lit_str2(
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_lit_into_path(
|
||||
cx: &Ctxt,
|
||||
|
Loading…
x
Reference in New Issue
Block a user