about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/late.rs
AgeCommit message (Collapse)AuthorLines
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
2021-08-28Treat macros as HIR itemsinquisitivecrystal-4/+0
2021-07-25Add inferred args to typeckkadmin-0/+5
2021-05-17Auto merge of #85178 - cjgillot:local-crate, r=oli-obkbors-3/+3
Remove CrateNum parameter for queries that only work on local crate The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea. Using `()` as query key in those cases avoids having to worry about the validity of the query key.
2021-05-15Fix unused attributes on macro_rules.Eric Huss-0/+4
2021-05-12Use () for privacy.Camille GILLOT-3/+3
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-3/+3
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.
2021-03-09Track HirId when visiting attributes.Camille GILLOT-4/+7
2021-03-09Access attrs directly from HirId in rustc_lint::late.Camille GILLOT-14/+13
2021-02-15Index Modules using their LocalDefId.Camille GILLOT-1/+1
2021-02-15Only store a LocalDefId in hir::ForeignItem.Camille GILLOT-2/+2
2021-02-15Only store a LocalDefId in hir::ImplItem.Camille GILLOT-2/+2
2021-02-15Only store a LocalDefId in hir::TraitItem.Camille GILLOT-2/+2
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-2/+2
Items are guaranteed to be HIR owner.
2021-02-15Use ItemId as a strongly typed index.Camille GILLOT-1/+1