about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/errors.rs
AgeCommit message (Collapse)AuthorLines
2023-08-30feat(rustc_lint): make `CheckLintName` respect lint levelWeihang Lo-53/+1
2023-08-24refactor: use references to reduce unnecessary clonesWeihang Lo-20/+20
2023-08-24lint: translate `RenamedOrRemovedLint`Weihang Lo-3/+13
2023-05-29Use `Cow` in `{D,Subd}iagnosticMessage`.Nicholas Nethercote-1/+1
Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment: ``` // FIXME(davidtwco): can a `Cow<'static, str>` be used here? ``` This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging. This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths. Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile.
2023-04-17Spelling - compilerJosh Soref-1/+1
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-3/+3
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-09refactor: cleanupRejyr-2/+0
2023-01-09migrate: `levels.rs`Rejyr-2/+2
2023-01-09add: `lints` for `errors.rs`Rejyr-1/+3
2023-01-09migrate: `early.rs` and `enum_intrinsics_non_enums.rs`Rejyr-0/+1
2022-10-26Convert all #[suggestion_*] attributes to #[suggestion(style = "...")]Xiretza-1/+1
Using the following command: find compiler/ -type f -name '*.rs' -exec perl -i -gpe \ 's/(#\[\w*suggestion)_(short|verbose|hidden)\(\s*(\S+,)?/\1(\3style = "\2",/g' \ '{}' +
2022-10-23Migrate all diagnosticsNilstrieb-17/+17
2022-10-17lint: use derive moreDavid Wood-23/+2
Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10errors: `AddToDiagnostic::add_to_diagnostic_with`David Wood-3/+12
`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-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-2/+2
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-9/+9
2022-09-21UPDATE - rename AddSubdiagnostic trait to AddToDiagnosticJhonny Bill Mena-3/+3
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-11/+11
2022-09-21UPDATE - move SessionDiagnostic from rustc_session to rustc_errorsJhonny Bill Mena-2/+2
2022-09-05UPDATE - into_diagnostic to take a Handler instead of a ParseSessJhonny Bill Mena-4/+4
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
2022-08-22refactor: migrate to kind-less `SessionDiagnostic` derivesRejyr-8/+8
2022-08-22migrate: `rustc_lint::context`Rejyr-1/+81
2022-08-22rename: `UnknownTool` to `UnknownToolInScopedLint`Rejyr-2/+2
2022-08-22migrate: `BuiltinEllipsisInclusiveRangePatterns`Rejyr-0/+10
2022-08-22migrate: `OverruledAttribute`Rejyr-0/+40
2022-08-22hotfix: add missing importRejyr-1/+1
2022-08-22change: diagnostic `String` field to `Symbol`Rejyr-1/+1
2022-08-22migrate: `bad_attr` to `SessionDiagnostic`Rejyr-1/+20
2022-08-22migrate: `UnknownTool` error to `SessionDiagnostic`Rejyr-0/+13