From 3bb5fc53b5697f6e48c2e71b1559ae2c01a67673 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 27 May 2020 15:18:47 -0700 Subject: [PATCH] Clarify lint vs fixed diagnostic. --- src/diagnostics.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/diagnostics.md b/src/diagnostics.md index b85b198b..a9634ba6 100644 --- a/src/diagnostics.md +++ b/src/diagnostics.md @@ -85,6 +85,21 @@ Some messages are emitted via [lints](#lints), where the user can control the level. Most diagnostics are hard-coded such that the user cannot control the level. +Usually it is obvious whether a diagnostic should be "fixed" or a lint, but +there are some grey areas. + +Here are a few examples: + +- Borrow checker errors: these are fixed errors. The user cannot adjust the + level of these diagnostics to silence the borrow checker. +- Dead code: this is a lint. While the user probably doesn't want dead code in + their crate, making this a hard error would make refactoring and development + very painful. +- [safe_packed_borrows future compatibility warning][safe_packed_borrows]: + this is a silencable lint related to safety. It was judged that the making + this a hard (fixed) error would cause too much breakage, so instead a + warning is emitted that eventually will be turned into a hard error. + Hard-coded warnings (those using the `span_warn` methods) should be avoided for normal code, preferring to use lints instead. Some cases, such as warnings with CLI flags, will require the use of hard-coded warnings. @@ -92,6 +107,8 @@ with CLI flags, will require the use of hard-coded warnings. See the `deny` [lint level](#diagnostic-levels) below for guidelines when to use an error-level lint instead of a fixed error. +[safe_packed_borrows]: https://github.com/rust-lang/rust/issues/46043 + ## Diagnostic output style guide - Write in plain simple English. If your message, when shown on a – possibly