1
Fork 0

Improve clarity of diagnostic message on non-exhaustive matches

This commit is contained in:
Sebastian Toh 2023-09-03 19:55:11 +08:00
parent 43dd8613a3
commit d87b87d10e
8 changed files with 10 additions and 10 deletions

View file

@ -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"));
}
}
}