Skip to content

Commit

Permalink
Merge pull request #1403 from dtolnay/nestedattr
Browse files Browse the repository at this point in the history
Disallow outer attribute on expr inside of attribute
  • Loading branch information
dtolnay committed Mar 15, 2023
2 parents f6b3310 + b7babe8 commit 1fed689
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/attr.rs
Expand Up @@ -608,10 +608,15 @@ pub(crate) mod parsing {
}

fn parse_meta_name_value_after_path(path: Path, input: ParseStream) -> Result<MetaNameValue> {
let eq_token: Token![=] = input.parse()?;
if input.peek(Token![#]) && input.peek2(token::Bracket) {
return Err(input.error("unexpected attribute inside of attribute"));
}
let value: Expr = input.parse()?;
Ok(MetaNameValue {
path,
eq_token: input.parse()?,
value: input.parse()?,
eq_token,
value,
})
}
}
Expand Down

0 comments on commit 1fed689

Please sign in to comment.