Skip to content

Commit d7067f1

Browse files
ehussmark-i-m
authored andcommittedMay 28, 2020
Clarify lint vs fixed diagnostic.
1 parent 4d94eb9 commit d7067f1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 

‎src/diagnostics.md

+17
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,30 @@ Some messages are emitted via [lints](#lints), where the user can control the
8585
level. Most diagnostics are hard-coded such that the user cannot control the
8686
level.
8787

88+
Usually it is obvious whether a diagnostic should be "fixed" or a lint, but
89+
there are some grey areas.
90+
91+
Here are a few examples:
92+
93+
- Borrow checker errors: these are fixed errors. The user cannot adjust the
94+
level of these diagnostics to silence the borrow checker.
95+
- Dead code: this is a lint. While the user probably doesn't want dead code in
96+
their crate, making this a hard error would make refactoring and development
97+
very painful.
98+
- [safe_packed_borrows future compatibility warning][safe_packed_borrows]:
99+
this is a silencable lint related to safety. It was judged that the making
100+
this a hard (fixed) error would cause too much breakage, so instead a
101+
warning is emitted that eventually will be turned into a hard error.
102+
88103
Hard-coded warnings (those using the `span_warn` methods) should be avoided
89104
for normal code, preferring to use lints instead. Some cases, such as warnings
90105
with CLI flags, will require the use of hard-coded warnings.
91106

92107
See the `deny` [lint level](#diagnostic-levels) below for guidelines when to
93108
use an error-level lint instead of a fixed error.
94109

110+
[safe_packed_borrows]: https://github.com/rust-lang/rust/issues/46043
111+
95112
## Diagnostic output style guide
96113

97114
- Write in plain simple English. If your message, when shown on a – possibly

0 commit comments

Comments
 (0)
Please sign in to comment.