Display witnesses of non-exhaustive match

Reporting format follows rustc and shows at most three witnesses.
This commit is contained in:
iDawer 2022-06-20 15:48:09 +05:00
parent ad6810e90b
commit 4ff9bedbed
6 changed files with 320 additions and 80 deletions

View file

@ -1295,7 +1295,7 @@ impl DefWithBody {
);
}
}
BodyValidationDiagnostic::MissingMatchArms { match_expr } => {
BodyValidationDiagnostic::MissingMatchArms { match_expr, uncovered_patterns } => {
match source_map.expr_syntax(match_expr) {
Ok(source_ptr) => {
let root = source_ptr.file_syntax(db.upcast());
@ -1307,6 +1307,7 @@ impl DefWithBody {
MissingMatchArms {
file: source_ptr.file_id,
match_expr: AstPtr::new(&match_expr),
uncovered_patterns,
}
.into(),
);