Skip to content

Add some guidelines on diagnostics. #716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Who? Me?! <mark-i-m@users.noreply.github.com>
Co-authored-by: Chris Simpkins <git.simpkins@gmail.com>
  • Loading branch information
3 people authored May 27, 2020
commit 3b7d8c246f24dc282ca7cd0f6279f2202609d65a
4 changes: 2 additions & 2 deletions src/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The descriptions are written in markdown, and all of them are linked in the

<!-- TODO: When should an error use an error code, and when shouldn't it? -->

[`librustc_error_codes`]: https://github.com/rust-lang/rust/blob/master/src/librustc_error_codes/error_codes.rs
[`librustc_error_codes`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_error_codes/error_codes/index.html
[error index]: https://doc.rust-lang.org/error-index.html
[RFC 1567]: https://github.com/rust-lang/rfcs/blob/master/text/1567-long-error-codes-explanation-normalization.md

Expand Down Expand Up @@ -104,7 +104,7 @@ use an error-level lint instead of a fixed error.
flag. That said, don't make it so terse that it's hard to understand.
- The word "illegal" is illegal. Prefer "invalid" or a more specific word
instead.
- Errors should document the span of code where they occur – the `span_..`
- Errors should document the span of code where they occur – the `librustc_errors::diagnostic_builder::DiagnosticBuilder` `span_*`
methods allow to easily do this. Also `note` other spans that have
contributed to the error if the span isn't too large.
- When emitting a message with span, try to reduce the span to the smallest
Expand Down