mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Display witnesses of non-exhaustive match
Reporting format follows rustc and shows at most three witnesses.
This commit is contained in:
parent
ad6810e90b
commit
4ff9bedbed
6 changed files with 320 additions and 80 deletions
|
@ -150,6 +150,7 @@ pub struct MismatchedArgCount {
|
|||
pub struct MissingMatchArms {
|
||||
pub file: HirFileId,
|
||||
pub match_expr: AstPtr<ast::Expr>,
|
||||
pub uncovered_patterns: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -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(),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue