about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
AgeCommit message (Collapse)AuthorLines
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>
2022-06-30lint: port non-fmt-panic diagnosticsDavid Wood-39/+34
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port non-ascii-idents diagnosticsDavid Wood-18/+17
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port `CString` ptr diagnosticsDavid Wood-10/+7
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port translation migration diagnosticsDavid Wood-3/+2
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port non-existant doc keyword diagnosticsDavid Wood-7/+4
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port impl `LintPass` by hand diagnosticsDavid Wood-2/+2
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port ty diagnosticsDavid Wood-11/+12
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port query instability diagnosticsDavid Wood-6/+3
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port default hash types diagnosticsDavid Wood-8/+5
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port hidden unicode codepoints diagnosticsDavid Wood-30/+14
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port expectation diagnosticsDavid Wood-2/+3
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port enum intrinsics diagnosticsDavid Wood-23/+7
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port array-into-iter diagnosticsDavid Wood-11/+10
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30middle: translation in `LintDiagnosticBuilder`David Wood-2/+2
Accept `DiagnosticMessage` in `LintDiagnosticBuilder::build` so that lints can be built with translatable diagnostic messages. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-28Rollup merge of #98420 - ↵Dylan DPC-3/+6
davidtwco:translation-lint-fixes-and-more-migration, r=compiler-errors translation: lint fix + more migration - Unfortunately, the diagnostic lints are very broken and trigger much more often than they should. This PR corrects the conditional which checks if the function call being made is to a diagnostic function so that it returns in every intended case. - The `rustc_lint_diagnostics` attribute is used by the diagnostic translation/struct migration lints to identify calls where non-translatable diagnostics or diagnostics outwith impls are being created. Any function used in creating a diagnostic should be annotated with this attribute so this PR adds the attribute to many more functions. - Port the diagnostics from the `rustc_privacy` crate and enable the lints for that crate. r? ``@compiler-errors``
2022-06-27lint: fix condition in diagnostic lintsDavid Wood-3/+6
Unfortunately, the diagnostic lints are very broken and trigger much more often than they should. Correct the conditional which checks if the function call being made is to a diagnostic function so that it returns in every intended case. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-27Rollup merge of #97389 - m-ou-se:memory-ordering-diagnostics, r=estebankMatthias Krüger-82/+66
Improve memory ordering diagnostics Before: ![image](https://user-images.githubusercontent.com/783247/170234545-891cac30-eaa2-4186-847b-35cd51e00f2b.png) After: ![image](https://user-images.githubusercontent.com/783247/170239684-645f186f-5a02-4eb9-8651-2e5fe9591352.png) --- Before this change, the compiler suggests the failure ordering is too strong and suggests choosing a weaker ordering. After this change, it instead suggests the success ordering is not strong enough, and suggests chosing a stronger one. This is more likely to be correct. Also, before this change, the compiler suggested downgrading an invalid AcqRel failure ordering to Relaxed, without mentioning Acquire as an option.
2022-06-22Slightly tweak invalid atomic ordering lint messages.Mara Bos-8/+8
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-06-19Use `ensure` for `UnusedBrokenConst`.Camille GILLOT-4/+2
2022-06-19Make some lints incremental.Camille GILLOT-14/+13
2022-06-18Auto merge of #98153 - nnethercote:fix-MissingDoc-quadratic-behaviour, ↵bors-27/+9
r=cjgillot Fix `MissingDoc` quadratic behaviour Best reviewed one commit at a time. r? `@cjgillot`
2022-06-17Re-allow `let_underscore_drop` by default.Aaron Kofsky-1/+1
This lint is way way too noisy to have it be `Deny` by default.
2022-06-16Rollup merge of #97757 - xFrednet:rfc-2383-expect-with-force-warn, ↵Matthias Krüger-16/+26
r=wesleywiser,flip1995 Support lint expectations for `--force-warn` lints (RFC 2383) Rustc has a `--force-warn` flag, which overrides lint level attributes and forces the diagnostics to always be warn. This means, that for lint expectations, the diagnostic can't be suppressed as usual. This also means that the expectation would not be fulfilled, even if a lint had been triggered in the expected scope. This PR now also tracks the expectation ID in the `ForceWarn` level. I've also made some minor adjustments, to possibly catch more bugs and make the whole implementation more robust. This will probably conflict with https://github.com/rust-lang/rust/pull/97718. That PR should ideally be reviewed and merged first. The conflict itself will be trivial to fix. --- r? `@wesleywiser` cc: `@flip1995` since you've helped with the initial review and also discussed this topic with me. :upside_down_face: Follow-up of: https://github.com/rust-lang/rust/pull/87835 Issue: https://github.com/rust-lang/rust/issues/85549 Yeah, and that's it.
2022-06-16Support lint expectations for `--force-warn` lints (RFC 2383)xFrednet-16/+26
2022-06-16Inline and remove `{enter,exit}_attrs` functions.Nicholas Nethercote-22/+6
They each have a single call site.
2022-06-16Remove unused `hir_id` arg from `visit_attribute`.Nicholas Nethercote-2/+2
2022-06-16Fix quadratic behaviour in the `MissingDoc` lint.Nicholas Nethercote-4/+2
The `MissingDoc` lint has quadratic behaviour when processing doc comments. This is a problem for large doc comments (e.g. 1000+ lines) when `deny(missing_code)` is enabled. A 1000-line doc comment using `//!` comments is represented as 1000 attributes on an item. The lint machinery iterates over each attribute with `visit_attribute`. `MissingDoc`'s impl of that function calls `with_lint_attrs`, which calls `enter_attrs`, which iterates over all 1000 attributes looking for a `doc(hidden)` attribute. I.e. for every attribute we iterate over all the other attributes. The fix is simple: don't call `with_lint_attrs` on attributes. This makes sense: `with_lint_attrs` is intended to iterate over the attributes on a language fragment like a statement or expression, but it doesn't need to be called on attributes themselves.
2022-06-14Rollup merge of #97948 - davidtwco:diagnostic-translation-lints, r=oli-obkDylan DPC-31/+109
lint: add diagnostic translation migration lints Introduce allow-by-default lints for checking whether diagnostics are written in `SessionDiagnostic` or `AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation. These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter. r? `````@oli-obk`````
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-1/+1
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-13Rollup merge of #98043 - TaKO8Ki:remove-unnecessary-to-string, r=davidtwcoMatthias Krüger-22/+20
Remove unnecessary `to_string` and `String::new` https://github.com/rust-lang/rust/pull/96468/commits/73fa217bc11fbac76f730223f6766c8e03513b5e changed the type of the `suggestion` argument to `impl ToString`. This patch removes unnecessary `to_string` and `String::new`. cc: `````@davidtwco`````
2022-06-13Rollup merge of #97875 - JohnTitor:rm-infer-static-outlives-requirements, ↵Matthias Krüger-11/+2
r=pnkfelix Remove the `infer_static_outlives_requirements` feature Closes #54185 r? ``@pnkfelix``
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-22/+20
2022-06-11Address commentsMichael Goulet-3/+1
2022-06-11Handle empty where-clause betterMichael Goulet-1/+2
2022-06-11Make `let_underscore_drop` Deny by default.Aaron Kofsky-1/+1
This is done so that we can check the noisiness of this lint in a Crater run. Note that when I built the compiler, I actually encountered lots of places where this lint will trigger and fail compilation, so I had to also set `RUSTFLAGS_NOT_BOOSTRAP` to `-A let_underscore_drop` when compiling to prevent that.
2022-06-11Have the drop code suggestion not include `let _ =`Aaron Kofsky-1/+1