about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/internal.rs
AgeCommit message (Collapse)AuthorLines
2024-10-26Auto merge of #132190 - matthiaskrgr:rollup-rsocfiz, r=matthiaskrgrbors-2/+2
Rollup of 3 pull requests Successful merges: - #131875 (Add WASM | WASI | Emscripten groups to triagebot.toml) - #132019 (Document `PartialEq` impl for `OnceLock`) - #132182 (Downgrade `untranslatable_diagnostic` and `diagnostic_outside_of_impl` to `allow`) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-26Downgrade `untranslatable_diagnostic` and `diagnostic_outside_of_impl` to ↵Jieyou Xu-2/+2
`allow` See <https://github.com/rust-lang/rust/issues/132181> for more context.
2024-10-19Unify syntax (all to @eval_always)blyxyas-2/+2
2024-10-19Remove module passes filteringblyxyas-2/+2
2024-10-19Do not run lints that cannot emitblyxyas-2/+4
Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had #![allow]ed them. This PR changes that
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-37/+25
2024-09-03Add an internal lint that warns when accessing untracked dataNadrieril-3/+21
2024-09-01Deny imports of rustc_type_ir::inherent outside of type ir + new trait solverMichael Goulet-2/+28
2024-08-10Refactor: `diagnostic_outside_of_impl`, `untranslatable_diagnostic`Pavel Grigorenko-60/+74
1. Decouple them. 2. Make logic around `diagnostic_outside_of_impl`'s early exits simpler. 3. Make `untranslatable_diagnostic` run one loop instead of two and not allocate an intermediate vec. 4. Overall, reduce the amount of code executed when the lints do not end up firing.
2024-08-10`untranslatable_diagnostic` lint: point at the untranslated thingPavel Grigorenko-10/+12
and not the function/method call
2024-07-29Reformat `use` declarations.Nicholas Nethercote-8/+12
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-18Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent`León Orell Valerian Liehr-1/+45
2024-07-02Instance::resolve -> Instance::try_resolve, and other nitsMichael Goulet-2/+2
2024-06-03Fix up comments.Nicholas Nethercote-7/+7
Wrap overly long ones, etc.
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_lint`.Nicholas Nethercote-0/+1
2024-03-11Allow multiple `impl Into<{D,Subd}iagMessage>` parameters in a function.Nicholas Nethercote-12/+5
The internal diagnostic lint currently only allows one, because that was all that occurred in practice. But rust-lang/rust-clippy/pull/12453 wants to introduce functions with more than one, and this limitation is getting in the way.
2024-03-11Rename diagnostic derive things.Nicholas Nethercote-2/+1
For increased consistency. - session_diagnostic_derive -> diagnostic_derive - session_subdiagnostic_derive -> subdiagnostic_derive - SubdiagnosticDeriveBuilder -> SubdiagnosticDerive
2024-03-11Rename `DecorateLint` as `LintDiagnostic`.Nicholas Nethercote-5/+5
To match `derive(LintDiagnostic)`.
2024-03-11Rename `AddToDiagnostic` as `Subdiagnostic`.Nicholas Nethercote-4/+4
To match `derive(Subdiagnostic)`. Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
2024-03-11Rename `IntoDiagnostic` as `Diagnostic`.Nicholas Nethercote-7/+4
To match `derive(Diagnostic)`. Also rename `into_diagnostic` as `into_diag`.
2024-03-08Fix crash in late internal checkingyukang-4/+6
2024-03-06Rewrite the `untranslatable_diagnostic` lint.Nicholas Nethercote-43/+122
Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This commit changes it to check calls to any function with an `impl Into<{D,Subd}iagMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. The commit also adds `#[allow(rustc::untranslatable_diagnostic)`] attributes to places that need it that are caught by the improved lint. These places that might be easy to convert to translatable diagnostics. Finally, it also: - Expands and corrects some comments. - Does some minor formatting improvements. - Adds missing `DecorateLint` cases to `tests/ui-fulldeps/internal-lints/diagnostics.rs`.
2024-03-05Rename `SubdiagnosticMessage` as `SubdiagMessage`.Nicholas Nethercote-1/+1
2024-03-05Rename `DiagnosticMessage` as `DiagMessage`.Nicholas Nethercote-1/+1
2024-02-28Remove the `UntranslatableDiagnosticTrivial` lint.Nicholas Nethercote-82/+1
It's a specialized form of the `UntranslatableDiagnostic` lint that is deny-by-default. Now that `UntranslatableDiagnostic` has been changed from allow-by-default to deny-by-default, the trivial variant is no longer needed.
2024-02-10hir: Remove `hir::Map::{opt_parent_id,parent_id,get_parent,find_parent}`Vadim Petrochenkov-6/+5
2024-02-06Invert diagnostic lints.Nicholas Nethercote-2/+2
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-01-23Rename `LintContext::emit_spanned_lint` as `LintContext::emit_span_lint`.Nicholas Nethercote-13/+13
2024-01-06rustc_span: Optimize syntax context comparisonsVadim Petrochenkov-1/+3
Including comparisons with root context
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-1/+1
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-16tweak pass description and fix lint fail post-rebaseArthur Lafrance-1/+1
2023-10-16debug Span::ctxt() call detectionArthur Lafrance-17/+6
2023-10-16basic lint v2 implementedArthur Lafrance-2/+43
2023-10-13Format all the let chains in compilerMichael Goulet-50/+49
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-12/+12
2023-05-24Use `is_some_and`/`is_ok_and` in less obvious spotsMaybe Waffle-3/+2
2023-05-06Check arguments length in trivial diagnostic lintclubby789-2/+4
2023-04-25Add deny lint to prevent untranslatable diagnostics using static stringsclubby789-1/+79
2023-04-10Fix typos in compilerDaniPopes-3/+3
2023-03-21Use local key in providersMichael Goulet-1/+1
2023-03-09Document tool lintsclubby789-0/+30
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+1
2023-01-15remove redundant clonesMatthias Krüger-2/+2
2023-01-09refactor: cleanupRejyr-2/+0
2023-01-09migrate: `internal.rs`Rejyr-76/+35
2023-01-04get_parent and find_parentMichael Goulet-1/+1
2023-01-04rename get_parent_node to parent_idMichael Goulet-1/+1
2022-12-01rustc_hir: Relax lifetime requirements on `Visitor::visit_path`Vadim Petrochenkov-1/+1