Skip to content

Commit

Permalink
save-analysis: handle missing field names
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Oct 21, 2018
1 parent e54b788 commit 115a2d6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -809,13 +809,14 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
field_ref: &ast::Field,
variant: &ty::VariantDef,
) -> Option<Ref> {
let index = self.tcx.find_field_index(field_ref.ident, variant).unwrap();
filter!(self.span_utils, field_ref.ident.span);
let span = self.span_from_span(field_ref.ident.span);
Some(Ref {
kind: RefKind::Variable,
span,
ref_id: id_from_def_id(variant.fields[index].did),
self.tcx.find_field_index(field_ref.ident, variant).map(|index| {
let span = self.span_from_span(field_ref.ident.span);
Ref {
kind: RefKind::Variable,
span,
ref_id: id_from_def_id(variant.fields[index].did),
}
})
}

Expand Down

0 comments on commit 115a2d6

Please sign in to comment.