don't unwrap unexpected tokens in format!

Fixes #57512.
This commit is contained in:
Andy Russell
2019-01-11 12:40:05 -05:00
parent 6ecad33838
commit 020e1f5b60
3 changed files with 12 additions and 5 deletions

View File

@@ -159,7 +159,7 @@ fn parse_args<'a>(
};
let name: &str = &ident.as_str();
p.expect(&token::Eq).unwrap();
p.expect(&token::Eq)?;
let e = p.parse_expr()?;
if let Some(prev) = names.get(name) {
ecx.struct_span_err(e.span, &format!("duplicate argument named `{}`", name))