Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

Commit bb0939d

Browse files
committed
ioreg::parser: Give correct span to field types
1 parent 7337ec9 commit bb0939d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ioreg/parser.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,13 @@ impl<'a, 'b> Parser<'a, 'b> {
387387
return None;
388388
}
389389

390+
let sp_lo = self.span.lo;
390391
let docstring = docstring.or_else(|| self.parse_docstring(Inner));
391392
match self.parse_enum_variants() {
392393
Some(variants) => {
393-
let ty = node::EnumField {opt_name: None, variants: variants};
394+
let ty = respan(
395+
mk_sp(sp_lo, self.span.hi),
396+
node::EnumField {opt_name: None, variants: variants});
394397
(docstring, ty)
395398
},
396399
None => return None,
@@ -402,7 +405,7 @@ impl<'a, 'b> Parser<'a, 'b> {
402405
1 => node::BoolField,
403406
_ => node::UIntField,
404407
};
405-
(docstring, ty)
408+
(docstring, respan(name.span, ty))
406409
},
407410
};
408411

@@ -427,7 +430,7 @@ impl<'a, 'b> Parser<'a, 'b> {
427430
count: count,
428431
bit_range_span: bits_span,
429432
access: access,
430-
ty: dummy_spanned(ty),
433+
ty: ty,
431434
docstring: docstring,
432435
};
433436
Some(field)

0 commit comments

Comments
 (0)