Auto merge of #48082 - jseyfried:improve_struct_field_hygiene, r=petrochenkov

macros: improve struct constructor field hygiene, fix span bug

Fixes #47311.
r? @nrc
This commit is contained in:
bors 2018-02-26 09:41:33 +00:00
commit 4a70e27219
15 changed files with 62 additions and 24 deletions

View file

@ -2125,8 +2125,8 @@ impl<'a> Parser<'a> {
// Check if a colon exists one ahead. This means we're parsing a fieldname.
let (fieldname, expr, is_shorthand) = if self.look_ahead(1, |t| t == &token::Colon) {
let fieldname = self.parse_field_name()?;
self.bump();
hi = self.prev_span;
self.bump();
(fieldname, self.parse_expr()?, false)
} else {
let fieldname = self.parse_ident_common(false)?;