rust/compiler/rustc_lint/src
bors 2cb9a65684 Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk
Compute lint levels by definition

Lint levels are currently computed once for the whole crate. Any code that wants to emit a lint depends on this single `lint_levels(())` query. This query contains the `Span` for each attribute that participates in the lint level tree, so any code that wants to emit a lint basically depends on the spans in all files in the crate.

Contrary to hard errors, we do not clear the incremental session on lints, so this implicit world dependency pessimizes incremental reuse. (And is furthermore invisible for allowed lints.)

This PR completes https://github.com/rust-lang/rust/pull/99634 (thanks for the initial work `@fee1-dead)` and includes it in the dependency graph.

The design is based on 2 queries:
1. `lint_levels_on(HirId) -> FxHashMap<LintId, LevelAndSource>` which accesses the attributes at the given `HirId` and processes them into lint levels.  The `TyCtxt` is responsible for probing the HIR tree to find the user-visible level.
2. `lint_expectations(())` which lists all the `#[expect]` attributes in the crate.

This PR also introduces the ability to reconstruct a `HirId` from a `DepNode` by encoding the local part of the `DefPathHash` and the `ItemLocalId` in the two `u64` of the fingerprint.  This allows for the dep-graph to directly recompute `lint_levels_on` directly, without having to force the calling query.

Closes https://github.com/rust-lang/rust/issues/95094.
Supersedes https://github.com/rust-lang/rust/pull/99634.
2022-09-15 00:01:17 +00:00
..
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
array_into_iter.rs refactor: remove unnecessary variables 2022-09-05 22:31:02 +09:00
builtin.rs Remove unused argument from check_mac_def. 2022-09-12 14:05:54 +10:00
context.rs Compute lint_levels by definition 2022-09-14 19:02:44 +02:00
early.rs Compute lint_levels by definition 2022-09-14 19:02:44 +02:00
enum_intrinsics_non_enums.rs Update TypeVisitor paths 2022-07-06 06:41:53 +01:00
errors.rs UPDATE - into_diagnostic to take a Handler instead of a ParseSess 2022-09-05 02:18:45 -04:00
expect.rs Compute lint_levels by definition 2022-09-14 19:02:44 +02:00
hidden_unicode_codepoints.rs Rename some things related to literals. 2022-08-16 13:41:34 +10:00
internal.rs Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, r=cjgillot 2022-09-05 16:21:40 +00:00
late.rs Remove unused argument from visit_poly_trait_ref. 2022-09-12 13:51:10 +10:00
let_underscore.rs Fix imports. 2022-08-04 17:31:08 -04:00
levels.rs Add FIXME. 2022-09-14 19:06:39 +02:00
lib.rs Move some code and add comments. 2022-09-14 19:06:05 +02:00
methods.rs refactor: remove unnecessary variables 2022-09-05 22:31:02 +09:00
non_ascii_idents.rs lint: port non-ascii-idents diagnostics 2022-06-30 08:59:21 +01:00
non_fmt_panic.rs lint: port non-fmt-panic diagnostics 2022-06-30 08:59:21 +01:00
nonstandard_style.rs Remove unused span argument from check_mod and process_mod. 2022-09-12 13:44:27 +10:00
noop_method_call.rs separate the receiver from arguments in HIR 2022-09-05 22:25:49 +09:00
pass_by_value.rs lint: port pass-by-value diagnostics 2022-06-30 08:59:21 +01:00
passes.rs Remove unused argument from check_mac_def. 2022-09-12 14:05:54 +10:00
redundant_semicolon.rs lint: port redundant semicolons diagnostics 2022-06-30 08:59:21 +01:00
tests.rs Update to last upstream version 2021-07-08 17:14:28 +02:00
traits.rs lint: port drop trait/glue diagnostics 2022-06-30 08:59:21 +01:00
types.rs Avoid Iterator::last 2022-09-11 17:23:00 +02:00
unused.rs Plumb dyn trait representation through ty::Dynamic 2022-09-12 16:55:55 -07:00