about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/late.rs
AgeCommit message (Collapse)AuthorLines
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-1/+1
cleanup
2023-11-22rustc_session: implement latent TODOTamir Duberstein-2/+3
2023-11-22rustc_lint: remove superfluous assertionTamir Duberstein-1/+0
`Option::unwrap` is called on the next line.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-6/+6
`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-11-17Move `lint_store` from `GlobalCtxt` to `Session`.Nicholas Nethercote-7/+13
This was made possible by the removal of plugin support, which simplified lint store creation. This simplifies the places in rustc and rustdoc that call `describe_lints`, which are early on. The lint store is now built before those places, so they don't have to create their own lint store for temporary use, they can just use the main one.
2023-11-17Remove dead lint code.Nicholas Nethercote-2/+0
2023-09-14Auto merge of #115825 - cjgillot:expr-field-lint, r=compiler-errorsbors-0/+4
Visit ExprField for lint levels. Fixes https://github.com/rust-lang/rust/issues/115823
2023-09-13Visit ExprField for lint levels.Camille GILLOT-0/+4
2023-09-10Call `LateLintPass::check_attribute` from `with_lint_attrs`Alex Macleod-13/+12
2023-08-14Use `{Local}ModDefId` in many queriesNilstrieb-3/+3
2023-08-04Make MissingDoc a module lint.Camille GILLOT-20/+22
2023-06-15Add an `ensure_sufficient_stack` to `LateContextAndPass::visit_expr`Scott McMurray-4/+7
This is apparently where it's busting stack, and the comments for `ensure_sufficient_stack` say that > E.g. almost any call to visit_expr or equivalent can benefit from this.
2023-05-19Consider lint check attributes on match arms in late lintsRyo Yoshida-2/+4
Additionally add analogous test for early lints.
2023-05-06introduce `DynSend` and `DynSync` auto traitSparrowLii-2/+2
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-7/+6
2023-01-28Take a LocalDefId in hir::Visitor::visit_fn.Camille GILLOT-1/+1
2023-01-03fix dupe word typosRageking8-1/+1
2022-12-12Speed up the "builtin lints only" case.Nicholas Nethercote-4/+33
This commit partly undoes #104863, which combined the builtin lints pass with other lints. This caused a slowdown, because often there are no other lints, and it's faster to do a pass with a single lint directly than it is to do a combined pass with a `passes` vector containing a single lint.
2022-12-12Reinstate `{Early,Late}LintPassObjects`.Nicholas Nethercote-12/+44
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-05Remove `{Early,Late}LintPassObjects`.Nicholas Nethercote-35/+9
`EarlyContextAndPass` wraps a single early lint pass. We aggregate multiple passes into that single pass by using `EarlyLintPassObjects`. This commit removes `EarlyLintPassObjects` by changing `EarlyContextAndPass` into `EarlyContextAndPasses`. I.e. it just removes a level of indirection. This makes the code simpler and slightly faster. The commit does likewise for late lints.
2022-12-02Auto merge of #104863 - nnethercote:reduce-lint-macros, r=cjgillotbors-77/+23
Reduce macro usage for lints r? `@cjgillot`
2022-12-02Inline and remove `late_lint_pass_crate`.Nicholas Nethercote-14/+9
It has a single call site.
2022-12-02Inline and remove `late_lint_mod_pass`.Nicholas Nethercote-17/+8
It has a single call site.
2022-12-02Merge `builtins` into `LateLintPassObjects`.Nicholas Nethercote-13/+7
This avoids calling the `late_lint_{mod_pass,pass_crate}` twice.
2022-12-02Remove `-Zno-interleave-lints`.Nicholas Nethercote-32/+4
Because it complicates lint implementation greatly.
2022-12-02Eliminate four unnecessary lint macros.Nicholas Nethercote-12/+6
The lint definitions use macros heavily. This commit merges some of them that are split unnecessarily. I find the reduced indirection makes it easier to imagine what the generated code will look like.
2022-12-01rustc_hir: Relax lifetime requirements on `Visitor::visit_path`Vadim Petrochenkov-1/+1
2022-11-13Store a LocalDefId in hir::Variant & hir::Field.Camille GILLOT-1/+1
2022-10-26privacy: Rename "accessibility levels" to "effective visibilities"Vadim Petrochenkov-4/+4
And a couple of other naming tweaks Related to https://github.com/rust-lang/rust/issues/48054
2022-10-06Remove `-Ztime` option.Nicholas Nethercote-7/+10
The compiler currently has `-Ztime` and `-Ztime-passes`. I've used `-Ztime-passes` for years but only recently learned about `-Ztime`. What's the difference? Let's look at the `-Zhelp` output: ``` -Z time=val -- measure time of rustc processes (default: no) -Z time-passes=val -- measure time of each rustc pass (default: no) ``` The `-Ztime-passes` description is clear, but the `-Ztime` one is less so. Sounds like it measures the time for the entire process? No. The real difference is that `-Ztime-passes` prints out info about passes, and `-Ztime` does the same, but only for a subset of those passes. More specifically, there is a distinction in the profiling code between a "verbose generic activity" and an "extra verbose generic activity". `-Ztime-passes` prints both kinds, while `-Ztime` only prints the first one. (It took me a close reading of the source code to determine this difference.) In practice this distinction has low value. Perhaps in the past the "extra verbose" output was more voluminous, but now that we only print stats for a pass if it exceeds 5ms or alters the RSS, `-Ztime-passes` is less spammy. Also, a lot of the "extra verbose" cases are for individual lint passes, and you need to also use `-Zno-interleave-lints` to see those anyway. Therefore, this commit removes `-Ztime` and the associated machinery. One thing to note is that the existing "extra verbose" activities all have an extra string argument, so the commit adds the ability to accept an extra argument to the "verbose" activities.
2022-09-12Remove unused argument from `visit_poly_trait_ref`.Nicholas Nethercote-7/+3
2022-09-12Remove unused span argument from `check_mod` and `process_mod`.Nicholas Nethercote-6/+6
2022-09-12Remove unused span argument from `walk_fn`.Nicholas Nethercote-1/+1
2022-09-06Allow lint passes to be bound by `TyCtxt`Jason Newcomb-7/+8
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module
2022-08-11Simplify `rustc_hir::intravisit::Visitor::visit_variant_data`.Nicholas Nethercote-16/+3
It has four arguments that are never used. This avoids lots of argument passing in functions that feed into `visit_variant_data`.
2022-07-29Remove some late `check_*` functions.Nicholas Nethercote-14/+0
They're not used by rustc or clippy.
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-2/+2
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-06Make AST lowering a query.Camille GILLOT-1/+1
2022-06-16Inline and remove `{enter,exit}_attrs` functions.Nicholas Nethercote-12/+4
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-05-20Remove `crate` visibility usage in compilerJacob Pratt-1/+1
2022-05-08Move lint expectation checking into a separate query (RFC 2383)xFrednet-3/+0
2022-03-02Check lint expectations and emit lint if unfulfilled (RFC-2383)xFrednet-0/+3
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-4/+4
2021-09-30Do not pass hir::Crate to lints.Camille GILLOT-4/+2
2021-09-12Gather module items after lowering.Camille GILLOT-4/+2
2021-09-02Rename walk_crate.Camille GILLOT-1/+1
2021-09-02Stop using walk_crate.Camille GILLOT-3/+2