about summary refs log tree commit diff
path: root/compiler/rustc_lint
AgeCommit message (Collapse)AuthorLines
2022-07-06Add function to manually fulfill lint expectations (RFC 2383)xFrednet-1/+32
2022-07-06Rollup merge of #98519 - TaKO8Ki:add-head-span-field-to-item-and-impl-item, ↵Guillaume Gomez-24/+13
r=cjgillot Replace some `guess_head_span` with `def_span` This patch fixes a part of #97417. r? `@cjgillot`
2022-07-06fix miri-opt testsTakayuki Maeda-10/+6
2022-07-06replace `guess_head_span` with `def_span`Takayuki Maeda-14/+7
2022-07-06Rollup merge of #98884 - davidtwco:translation-on-lints-derive, r=oli-obkDylan DPC-15/+44
macros: `LintDiagnostic` derive - Move `LintDiagnosticBuilder` into `rustc_errors` so that a diagnostic derive can refer to it. - Introduce a `DecorateLint` trait, which is equivalent to `SessionDiagnostic` or `AddToDiagnostic` but for lints. Necessary without making more changes to the lint infrastructure as `DecorateLint` takes a `LintDiagnosticBuilder` and re-uses all of the existing logic for determining what type of diagnostic a lint should be emitted as (e.g. error/warning). - Various refactorings of the diagnostic derive machinery (extracting `build_field_mapping` helper and moving `sess` field out of the `DiagnosticDeriveBuilder`). - Introduce a `LintDiagnostic` derive macro that works almost exactly like the `SessionDiagnostic` derive macro except that it derives a `DecorateLint` implementation instead. A new derive is necessary for this because `SessionDiagnostic` is intended for when the generated code creates the diagnostic. `AddToDiagnostic` could have been used but it would have required more changes to the lint machinery. ~~At time of opening this pull request, ignore all of the commits from #98624, it's just the last few commits that are new.~~ r? `@oli-obk`
2022-07-06Update TypeVisitor pathsAlan Egerton-5/+5
2022-07-05macros: add diagnostic derive for lintsDavid Wood-7/+16
`SessionDiagnostic` isn't suitable for use on lints as whether or not it creates an error or a warning is decided at compile-time by the macro, whereas lints decide this at runtime based on the location of the lint being reported (as it will depend on the user's `allow`/`deny` attributes, etc). Re-using most of the machinery for `SessionDiagnostic`, this macro introduces a `LintDiagnostic` derive which implements a `DecorateLint` trait, taking a `LintDiagnosticBuilder` and adding to the lint according to the diagnostic struct.
2022-07-05errors: introduce `DecorateLint`David Wood-2/+22
Add a new trait to be generated by diagnostic derives which uses a `LintDiagnosticBuilder`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-05lint: `LintDiagnosticBuilder` into `rustc_errors`David Wood-7/+7
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-05Rollup merge of #98624 - davidtwco:translation-on-lints, r=compiler-errorsDylan DPC-587/+507
lints: mostly translatable diagnostics As lints are created slightly differently than other diagnostics, intended to try make them translatable first and then look into the applicability of diagnostic structs but ended up just making most of the diagnostics in the crate translatable (which will still be useful if I do make a lot of them structs later anyway). r? ``@compiler-errors``
2022-06-30fix grammar in useless doc comment lintAndy Russell-2/+2
2022-06-30lint: port asm labels diagnosticsDavid Wood-3/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port deref nullptr diagnosticsDavid Wood-2/+2
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port clashing extern diagnosticsDavid Wood-14/+10
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: add todo for invalid value diagnosticsDavid Wood-0/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port incomplete features diagnosticsDavid Wood-14/+5
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port explicit outlives diagnosticsDavid Wood-6/+3
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port keyword idents diagnosticsDavid Wood-2/+4
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port test items diagnosticsDavid Wood-1/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port `...` range pattern diagnosticsDavid Wood-6/+12
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port trivial bounds diagnosticsDavid Wood-6/+4
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port type alias bounds diagnosticsDavid Wood-10/+5
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port unreachable `pub` diagnosticDavid Wood-3/+4
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port unstable feature diagnosticsDavid Wood-1/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port mutable transmutes diagnosticDavid Wood-3/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port no-mangle diagnosticsDavid Wood-5/+4
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port unused doc comment diagnosticsDavid Wood-7/+5
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port deprecated attr diagnosticsDavid Wood-24/+27
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port anonymous parameter diagnosticsDavid Wood-12/+8
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port missing debug impl diagnosticsDavid Wood-6/+3
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port missing copy impl diagnosticsDavid Wood-5/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port missing documentation diagnosticsDavid Wood-1/+4
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port unsafe diagnosticsDavid Wood-36/+32
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port non-shorthand pattern diagnosticsDavid Wood-10/+10
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port box pointers diagnosticsDavid Wood-1/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port while true diagnosticsDavid Wood-4/+3
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port unused allocation diagnosticsDavid Wood-7/+5
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port unused import braces diagnosticsDavid Wood-1/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port unused delimiter diagnosticsDavid Wood-5/+9
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port path statement diagnosticsDavid Wood-4/+4
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port unused diagnosticsDavid Wood-30/+34
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port atomic ordering diagnosticsDavid Wood-25/+25
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port variant size difference diagnosticsDavid Wood-6/+3
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port improper ctypes diagnosticsDavid Wood-63/+66
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port overflowing literals diagnosticsDavid Wood-41/+42
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port drop trait/glue diagnosticsDavid Wood-13/+8
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port redundant semicolons diagnosticsDavid Wood-7/+5
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port pass-by-value diagnosticsDavid Wood-3/+4
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port no-op method call diagnosticsDavid Wood-12/+7
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port non-standard style diagnosticsDavid Wood-18/+22
Signed-off-by: David Wood <david.wood@huawei.com>