rust/compiler/rustc_middle/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
..
dep_graph Allow query system to recover a HirId. 2022-09-14 19:04:13 +02:00
hir Auto merge of #101688 - cjgillot:verify-hir-parent, r=petrochenkov 2022-09-12 00:41:56 +00:00
infer Better errors for implied static bound 2022-09-13 20:18:04 -04:00
middle Migrate limit error 2022-09-01 23:35:38 +08:00
mir Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
query Move some code and add comments. 2022-09-14 19:06:05 +02:00
thir Use boxed slices in PatKind. 2022-09-02 07:26:22 +10:00
traits Better errors for implied static bound 2022-09-13 20:18:04 -04:00
ty Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk 2022-09-15 00:01:17 +00:00
util span: move MultiSpan 2022-04-05 07:01:00 +01:00
arena.rs Deeply check that method signatures match, and allow for nested RPITITs 2022-09-09 01:31:46 +00:00
error.rs fix comment 2022-09-05 23:18:18 +08:00
lib.rs Auto merge of #96709 - jackh726:gats-stabilization, r=compiler-errors 2022-09-13 09:39:41 +00:00
lint.rs Remove unused tool_name. 2022-09-14 19:06:09 +02:00
macros.rs impl TypeVisitable in type traversal macros 2022-07-05 22:25:33 +01:00
metadata.rs rustc: Parameterize ty::Visibility over used ID 2022-09-07 13:35:41 +04:00
tests.rs
thir.rs Also compute implicit params in THIR. 2022-09-13 19:18:24 +02:00
values.rs Make HandleCycleError an enum instead of a macro-generated closure 2022-09-06 19:26:08 -05:00