Skip to content

Commit

Permalink
Rollup merge of rust-lang#35504 - razielgn:updated-e0026-to-new-forma…
Browse files Browse the repository at this point in the history
…t, r=jonathandturner

Updated E0026 to new format.

Part of rust-lang#35233.
Fixes rust-lang#35497.

r? @jonathandturner
  • Loading branch information
steveklabnik committed Aug 10, 2016
2 parents 1a96a6d + ee38609 commit e44c7ed
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 @@ -695,10 +695,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 e44c7ed

Please sign in to comment.