Skip to content

Commit ee38609

Browse files
committed
Updated E0026 to new format.
1 parent 8a4641b commit ee38609

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/librustc_typeck/check/_match.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
682682
field_map.get(&field.name)
683683
.map(|f| self.field_ty(span, f, substs))
684684
.unwrap_or_else(|| {
685-
span_err!(tcx.sess, span, E0026,
686-
"struct `{}` does not have a field named `{}`",
687-
tcx.item_path_str(variant.did),
688-
field.name);
685+
struct_span_err!(tcx.sess, span, E0026,
686+
"struct `{}` does not have a field named `{}`",
687+
tcx.item_path_str(variant.did),
688+
field.name)
689+
.span_label(span,
690+
&format!("struct `{}` does not have field `{}`",
691+
tcx.item_path_str(variant.did),
692+
field.name))
693+
.emit();
694+
689695
tcx.types.err
690696
})
691697
}

src/test/compile-fail/E0026.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ struct Thing {
1616
fn main() {
1717
let thing = Thing { x: 0, y: 0 };
1818
match thing {
19-
Thing { x, y, z } => {} //~ ERROR E0026
19+
Thing { x, y, z } => {}
20+
//~^ ERROR struct `Thing` does not have a field named `z` [E0026]
21+
//~| NOTE struct `Thing` does not have field `z`
2022
}
2123
}

0 commit comments

Comments
 (0)