about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/diagnostic.rs
AgeCommit message (Collapse)AuthorLines
2023-02-01Make "use latest edition" subdiagnostic translatableXiretza-37/+0
2023-02-01Use AddToDiagnostic for "use latest edition" helpXiretza-12/+36
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-0/+2
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-20add debug assertion for suggestions with overlapping partsLukas Markeffsky-27/+44
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-3/+3
2023-01-01Merge multiple mutable borrows of immutable binding errorsEsteban Küber-2/+2
Fix #53466.
2022-12-13Rollup merge of #105625 - matthiaskrgr:clippy_dec12, r=compiler-errorsMatthias Krüger-1/+1
minor code cleanups r? `@compiler-errors`
2022-12-12minor code cleanupsMatthias Krüger-1/+1
2022-12-11Point at method call when it is the source of the bound errorEsteban Küber-1/+5
2022-12-01Remove useless borrows and derefsMaybe Waffle-1/+1
2022-11-18Fix compilation issue after rebaseCharles Lew-0/+3
2022-11-18Migrate diagnostics list output to use icu list formatter.Charles Lew-0/+3
2022-11-14Auto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbinibors-2/+1
Bump bootstrap compiler to 1.66 This PR: - Bumps version placeholders to release - Bumps to latest beta - cfg-steps code r? `@pietroalbini`
2022-11-09Rollup merge of #102763 - compiler-errors:nits, r=cjgillotMichael Goulet-5/+5
Some diagnostic-related nits 1. Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` 2. Make `diag.span_suggestions` take an `IntoIterator` instead of `Iterator`, just to remove some `.into_iter` calls on the caller. idk if I should add a lint to make sure people use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` in cases where we're just, e.g., adding subdiagnostics to the diagnostic... maybe a followup.
2022-11-09rebase conflictMichael Goulet-2/+2
2022-11-09Make span_suggestions take IntoIteratorMichael Goulet-3/+3
2022-11-09Add missing `emitted_at` to the `Diagnostic`SLASHLogin-0/+1
2022-11-09Add constructor for `Diagnostic` that takes `Vec<(DiagnosticMessage, Style)>`SLASHLogin-0/+15
2022-11-09FormattingSLASHLogin-1/+4
2022-11-09Add `replace_args` method for `rustc_errors::diagnostic::Diagnostic`SLASHLogin-0/+4
2022-11-09Delay diagnostic translation in `rustc_codegen_ssa`SLASHLogin-0/+9
2022-11-06cfg-step codeMark Rousskov-2/+1
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-0/+29
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-10-23Allow specifying multiple alternative suggestionsXiretza-3/+23
This allows porting uses of span_suggestions() to diagnostic structs. Doesn't work for multipart_suggestions() because the rank would be reversed - the struct would specify multiple spans, each of which has multiple possible replacements, while multipart_suggestions() creates multiple possible replacements, each with multiple spans.
2022-10-20Implement assertions and fixes to not emit empty spans without suggestionsKevin Per-0/+25
2022-10-19Implement -Ztrack-diagnosticsmejrs-0/+29
2022-10-12UPDATE - Move IntoDiagnosticArg implementations to diagnostic_impls fileJhonny Bill Mena-149/+2
2022-10-10errors: `DiagnosticMessage::Eager`David Wood-1/+18
Add variant of `DiagnosticMessage` for eagerly translated messages (messages in the target language which don't need translated by the emitter during emission). Also adds `eager_subdiagnostic` function which is intended to be invoked by the diagnostic derive for subdiagnostic fields which are marked as needing eager translation. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10errors: `AddToDiagnostic::add_to_diagnostic_with`David Wood-4/+15
`AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10errors: use `HashMap` to store diagnostic argsDavid Wood-6/+13
Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-01Compute `lint_levels` by definitionDeadbeef-2/+3
2022-10-01Refactor rustc lint APIMaybe Waffle-2/+7
2022-09-27Implement IntoDiagnosticArg for rustc_ast::token::Token(Kind)Xiretza-0/+12
2022-09-27Implement IntoDiagnosticArg for rustc_ast::PathXiretza-0/+8
2022-09-22Revert "Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk"Camille GILLOT-3/+2
This reverts commit 2cb9a65684dba47c52de8fa938febf97a73e70a9, reversing changes made to 750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c.
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-1/+1
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-4/+5
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename AddSubdiagnostic trait to AddToDiagnosticJhonny Bill Mena-2/+2
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-1/+1
2022-09-14Compute `lint_levels` by definitionDeadbeef-2/+3
2022-09-08translations(rustc_session): migrates two diagnostics in session.rsLuis Cardoso-1/+4
2022-09-08translations(rustc_session): migrate TargetDataLayout::parseLuis Cardoso-0/+2
2022-09-03Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwcoDylan DPC-0/+7
Migrate rustc_metadata to SessionDiagnostics Migrate rustc_metadata to SessionDiagnostics. Part of https://github.com/rust-lang/rust/issues/100717
2022-08-31Rollup merge of #101165 - ldm0:drain_to_iter, r=cjgillotMatthias Krüger-2/+2
Use more `into_iter` rather than `drain(..)` Clearer semantic.
2022-08-31respond to review feedback: mainly eliminate as many conversions as possible...Nathan Stocks-0/+7
- ... when creating diagnostics in rustc_metadata - use the error_code! macro - pass macro output to diag.code() - use fluent from within manual implementation of SessionDiagnostic - emit the untested errors in case they occur in the wild - stop panicking in the probably-not-dead code, add fixme to write test
2022-08-30Code deduplication in tool_only_multipart_suggestionXiretza-12/+5
2022-08-30Use more `into_iter` rather than `drain(..)`Donough Liu-2/+2
2022-08-24errors: `IntoDiagnosticArg` for `io::Error`/pathsDavid Wood-0/+14
Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-17Moved structs to rustc_expand::errors, added several more migrations, fixed ↵nidnogg-1/+2
slug name
2022-08-05move DiagnosticArgFromDisplay into rustc_errorsMichael Goulet-0/+20