Updated E0026 to new format.

This commit is contained in:
Federico Ravasio 2016-08-08 20:58:21 +02:00
parent 8a4641bbdf
commit ee38609c20
2 changed files with 13 additions and 5 deletions

View File

@ -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
})
}

View File

@ -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`
}
}