Skip to content

Commit

Permalink
Rollup merge of rust-lang#35410 - silenuss:e0027-formatting, r=jonath…
Browse files Browse the repository at this point in the history
…andturner

Update compiler error 0027 to use new error format.

Part of rust-lang#35233,
Addresses rust-lang#35200

r? @jonathandturner
  • Loading branch information
Jonathan Turner authored Aug 6, 2016
2 parents ae59b96 + c9e9d42 commit 2fd369f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
for field in variant.fields
.iter()
.filter(|field| !used_fields.contains_key(&field.name)) {
span_err!(tcx.sess, span, E0027,
"pattern does not mention field `{}`",
field.name);
struct_span_err!(tcx.sess, span, E0027,
"pattern does not mention field `{}`",
field.name)
.span_label(span, &format!("missing field `{}`", field.name))
.emit();
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0027.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ fn main() {
let d = Dog { name: "Rusty".to_string(), age: 8 };

match d {
Dog { age: x } => {} //~ ERROR E0027
Dog { age: x } => {}
//~^ ERROR pattern does not mention field `name`
//~| NOTE missing field `name`
}
}

0 comments on commit 2fd369f

Please sign in to comment.