parent
e221616639
commit
7c3f631ddf
3 changed files with 18 additions and 3 deletions
|
@ -618,9 +618,12 @@ impl MetaItemKind {
|
||||||
}) => MetaItemKind::list_from_tokens(tokens.clone()),
|
}) => MetaItemKind::list_from_tokens(tokens.clone()),
|
||||||
AttrArgs::Delimited(..) => None,
|
AttrArgs::Delimited(..) => None,
|
||||||
AttrArgs::Eq(_, AttrArgsEq::Ast(expr)) => match expr.kind {
|
AttrArgs::Eq(_, AttrArgsEq::Ast(expr)) => match expr.kind {
|
||||||
ast::ExprKind::Lit(token_lit) => Some(MetaItemKind::NameValue(
|
ast::ExprKind::Lit(token_lit) => {
|
||||||
Lit::from_token_lit(token_lit, expr.span).expect("token_lit in from_attr_args"),
|
// Turn failures to `None`, we'll get parse errors elsewhere.
|
||||||
)),
|
Lit::from_token_lit(token_lit, expr.span)
|
||||||
|
.ok()
|
||||||
|
.map(|lit| MetaItemKind::NameValue(lit))
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
},
|
||||||
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => Some(MetaItemKind::NameValue(lit.clone())),
|
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => Some(MetaItemKind::NameValue(lit.clone())),
|
||||||
|
|
4
src/test/ui/parser/issue-104620.rs
Normal file
4
src/test/ui/parser/issue-104620.rs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
|
#![rustc_dummy=5z] //~ ERROR unexpected expression: `5z`
|
||||||
|
fn main() {}
|
8
src/test/ui/parser/issue-104620.stderr
Normal file
8
src/test/ui/parser/issue-104620.stderr
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
error: unexpected expression: `5z`
|
||||||
|
--> $DIR/issue-104620.rs:3:16
|
||||||
|
|
|
||||||
|
LL | #![rustc_dummy=5z]
|
||||||
|
| ^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue