Skip to content

Commit c9e9d42

Browse files
committed
Update compiler error 0027 to use new error format.
1 parent b30eff7 commit c9e9d42

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/librustc_typeck/check/_match.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
700700
for field in variant.fields
701701
.iter()
702702
.filter(|field| !used_fields.contains_key(&field.name)) {
703-
span_err!(tcx.sess, span, E0027,
704-
"pattern does not mention field `{}`",
705-
field.name);
703+
struct_span_err!(tcx.sess, span, E0027,
704+
"pattern does not mention field `{}`",
705+
field.name)
706+
.span_label(span, &format!("missing field `{}`", field.name))
707+
.emit();
706708
}
707709
}
708710
}

src/test/compile-fail/E0027.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ fn main() {
1717
let d = Dog { name: "Rusty".to_string(), age: 8 };
1818

1919
match d {
20-
Dog { age: x } => {} //~ ERROR E0027
20+
Dog { age: x } => {}
21+
//~^ ERROR pattern does not mention field `name`
22+
//~| NOTE missing field `name`
2123
}
2224
}

0 commit comments

Comments
 (0)