summary refs log tree commit diff
path: root/compiler/rustc_lint/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-09-29Rollup merge of #116231 - DaniPopes:simpler-lint-array, r=NilstriebMatthias Krüger-1/+1
Remove `rustc_lint_defs::lint_array`
2023-09-28Remove `rustc_lint_defs::lint_array`DaniPopes-1/+1
2023-09-28Auto merge of #116199 - Urgau:simplify-invalid_ref_casting, r=cjgillotbors-1/+1
Simplify some of the logic in the `invalid_reference_casting` lint This PR simplifies 2 areas of the logic for the `invalid_reference_casting` lint: - The init detection: we now use the newly added `expr_or_init` function instead of a manual detection - The ref-to-mut-ptr casting detection logic: I simplified this logic by caring less hardly about the order of the casting operations Those two simplifications permits us to detect more cases, as can be seen in the test output changes.
2023-09-27Use absolute paths in rustc_lint::passes macrosAlex Macleod-5/+1
A cosmetic change, so the callsite doesn't have to import things
2023-09-27Prefer expr_or_init over manual init detectionUrgau-1/+1
2023-09-01Auto merge of #113126 - Bryanskiy:delete_old, r=petrochenkovbors-0/+5
Replace old private-in-public diagnostic with type privacy lints Next part of RFC https://github.com/rust-lang/rust/issues/48054. r? `@petrochenkov`
2023-08-23Bump cfg(bootstrap)Mark Rousskov-1/+1
2023-08-14Use `{Local}ModDefId` in many queriesNilstrieb-2/+2
2023-08-04Make rustc internal lints per module.Camille GILLOT-7/+7
2023-08-04Make MissingDoc a module lint.Camille GILLOT-17/+4
2023-08-04Make MissingDebugImplementation a module lint.Camille GILLOT-4/+1
2023-08-04Querify clashing_extern_declarations lint.Camille GILLOT-2/+3
2023-08-04Auto merge of #114414 - cjgillot:early-unnameable-test, r=petrochenkovbors-2/+0
Make test harness lint about unnnameable tests. Implementation of https://github.com/rust-lang/rust/pull/113734#discussion_r1283073418 About the options suggested in https://github.com/rust-lang/rust/issues/36629#issuecomment-404753945: adding this case to unused_attribute was just more complicated. I'll try to understand a bit more what you had in mind in https://github.com/rust-lang/rfcs/pull/2471#issuecomment-397241123 This was just simpler to do in a standalone PR. I'll remove the corresponding changes from https://github.com/rust-lang/rust/pull/113734 later. r? `@petrochenkov`
2023-08-03Auto merge of #108955 - Nilstrieb:dont-use-me-pls, r=oli-obkbors-1/+2
Add `internal_features` lint Implements https://github.com/rust-lang/compiler-team/issues/596 Also requires some more test blessing for codegen tests etc `@jyn514` had the idea of just `allow`ing the lint by default in the test suite. I'm not sure whether this is a good idea, but it's definitely one worth considering. Additional input encouraged.
2023-08-03Rollup merge of #113657 - Urgau:expand-incorrect_fn_null_check-lint, r=cjgillotMatthias Krüger-3/+3
Expand, rename and improve `incorrect_fn_null_checks` lint This PR, - firstly, expand the lint by now linting on references - secondly, it renames the lint `incorrect_fn_null_checks` -> `useless_ptr_null_checks` - and thirdly it improves the lint by catching `ptr::from_mut`, `ptr::from_ref`, as well as `<*mut _>::cast` and `<*const _>::cast_mut` Fixes https://github.com/rust-lang/rust/issues/113601 cc ```@est31```
2023-08-03Make test harness lint about unnnameable tests.Camille GILLOT-2/+0
2023-08-03Add `internal_features` lintNilstrieb-1/+2
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-08-02Replace old private-in-public diagnostic with type privacy lintsBryanskiy-0/+5
2023-08-01Rename incorrect_fn_null_checks to useless_ptr_null_checksUrgau-3/+3
2023-07-29Add support for deferred casting for the invalid_reference_casting lintUrgau-1/+1
2023-07-13Rename cast_ref_to_mut lint to invalid_reference_castingUrgau-3/+3
2023-07-10Uplift `clippy::fn_null_check` to rustcUrgau-0/+3
2023-05-31Uplift clippy::cast_ref_to_mut to rustcUrgau-0/+3
2023-05-27Uplift clippy::invalid_utf8_in_unchecked as invalid_from_utf8_uncheckedUrgau-0/+3
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-1/+1
2023-05-10Uplift clippy::drop_ref to rustcUrgau-0/+3
2023-04-25Add deny lint to prevent untranslatable diagnostics using static stringsclubby789-0/+1
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+1
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-03-22Move useless_anynous_reexport lint into unused_importsGuillaume Gomez-3/+0
2023-03-12Add lint for useless anonymous reexportsGuillaume Gomez-0/+3
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-02-23Add lint against `Iterator::map` receiving a callable that returns `()`Obei Sideg-1/+5
2023-02-22errors: generate typed identifiers in each crateDavid Wood-0/+4
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-31make unaligned_reference a hard errorRalf Jung-1/+10
2023-01-28Reintroduce multiple_supertrait_upcastable lintGary Guo-0/+3
2023-01-14fix issues in unused lintyukang-1/+1
2023-01-09refactor: cleanupRejyr-2/+2
2023-01-09add: `lints.rs`Rejyr-0/+3
add: `lints.rs` refactor: move `InvalidAtomicOrderingDiag` to `lints.rs`
2022-12-29Revert "Implement allow-by-default multiple_supertrait_upcastable lint"David Tolnay-3/+0
This reverts commit 5e44a65517bfcccbe6624a70b54b9f192baa94f3.
2022-12-28Rollup merge of #105484 - nbdd0121:upcast, r=compiler-errorsfee1-dead-0/+3
Implement allow-by-default `multiple_supertrait_upcastable` lint The lint detects when an object-safe trait has multiple supertraits. Enabled in libcore and liballoc as they are low-level enough that many embedded programs will use them. r? `@nikomatsakis`
2022-12-21Update track_caller logic/lint after rebaseBryan Garza-0/+1
2022-12-12Reinstate `{Early,Late}LintPassObjects`.Nicholas Nethercote-6/+0
I removed these in #105291, and subsequently learned they are necessary for performance. This commit reinstates them with the new and more descriptive names `RuntimeCombined{Early,Late}LintPass`, similar to the existing passes like `BuiltinCombinedEarlyLintPass`. It also adds some comments, particularly emphasising how we have ways to combine passes at both compile-time and runtime. And it moves some comments around.
2022-12-09Implement allow-by-default multiple_supertrait_upcastable lintGary Guo-0/+3
2022-12-07Add some useful comments.Nicholas Nethercote-1/+8
2022-12-07Remove `$hir` argument from `late_lint_methods!`.Nicholas Nethercote-4/+2
Because it's always `'tcx`.
2022-12-02Remove six macros relating to lint definitions.Nicholas Nethercote-119/+103
These were enabled by the removal of `-Zno-interleave-lints`.
2022-12-02Remove `-Zno-interleave-lints`.Nicholas Nethercote-44/+7
Because it complicates lint implementation greatly.
2022-11-23Make `deref_into_dyn_supertrait` lint the impl and not the usageMaybe Waffle-0/+3
2022-11-07fix: lint against lint functionsRejyr-0/+1
fix: lint against the functions `LintContext::{lookup_with_diagnostics,lookup,struct_span_lint,lint}`, `TyCtxt::struct_lint_node`, `LintLevelsBuilder::struct_lint`.
2022-10-26privacy: Rename "accessibility levels" to "effective visibilities"Vadim Petrochenkov-1/+1
And a couple of other naming tweaks Related to https://github.com/rust-lang/rust/issues/48054