From ee38609c2044ad7a497b52e3169fe755f4566440 Mon Sep 17 00:00:00 2001 From: Federico Ravasio Date: Mon, 8 Aug 2016 20:58:21 +0200 Subject: [PATCH] Updated E0026 to new format. --- src/librustc_typeck/check/_match.rs | 14 ++++++++++---- src/test/compile-fail/E0026.rs | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index fe68690d4e974..9f9b8aed6bd75 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -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 }) } diff --git a/src/test/compile-fail/E0026.rs b/src/test/compile-fail/E0026.rs index 359c2a822a243..ac609da4cbdde 100644 --- a/src/test/compile-fail/E0026.rs +++ b/src/test/compile-fail/E0026.rs @@ -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` } }