Skip to content

Commit

Permalink
Updated E0026 to new format.
Browse files Browse the repository at this point in the history
  • Loading branch information
razielgn committed Aug 8, 2016
1 parent 8a4641b commit ee38609
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
field_map.get(&field.name)
.map(|f| self.field_ty(span, f, substs))
.unwrap_or_else(|| {
span_err!(tcx.sess, span, E0026,
"struct `{}` does not have a field named `{}`",
tcx.item_path_str(variant.did),
field.name);
struct_span_err!(tcx.sess, span, E0026,
"struct `{}` does not have a field named `{}`",
tcx.item_path_str(variant.did),
field.name)
.span_label(span,
&format!("struct `{}` does not have field `{}`",
tcx.item_path_str(variant.did),
field.name))
.emit();

tcx.types.err
})
}
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0026.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ struct Thing {
fn main() {
let thing = Thing { x: 0, y: 0 };
match thing {
Thing { x, y, z } => {} //~ ERROR E0026
Thing { x, y, z } => {}
//~^ ERROR struct `Thing` does not have a field named `z` [E0026]
//~| NOTE struct `Thing` does not have field `z`
}
}

0 comments on commit ee38609

Please sign in to comment.