Improve clarity of diagnostic message on non-exhaustive matches
This commit is contained in:
parent
43dd8613a3
commit
d87b87d10e
8 changed files with 10 additions and 10 deletions
|
@ -741,10 +741,10 @@ fn non_exhaustive_match<'p, 'tcx>(
|
|||
}
|
||||
} else if ty == cx.tcx.types.str_ {
|
||||
err.note(format!(
|
||||
"`{ty}` cannot be matched exhaustively, so a wildcard `_` is necessary",
|
||||
"`&str` cannot be matched exhaustively, so a wildcard `_` is necessary",
|
||||
));
|
||||
} else if cx.is_foreign_non_exhaustive_enum(ty) {
|
||||
err.note(format!("`{ty}` is marked as non-exhaustive"));
|
||||
err.note(format!("`{ty}` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue