rust/compiler
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
..
rustc
rustc_apfloat Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_arena Make use of [wrapping_]byte_{add,sub} 2022-08-23 19:32:37 +04:00
rustc_ast Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot 2022-09-14 20:52:18 +00:00
rustc_ast_lowering Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot 2022-09-14 20:52:18 +00:00
rustc_ast_passes Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_ast_pretty make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
rustc_attr Also replace the placeholder for the stable_features lint 2022-09-14 03:28:54 +02:00
rustc_borrowck Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_builtin_macros make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
rustc_codegen_cranelift Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_codegen_gcc Remove dead broken code from const zst handling in backends 2022-09-06 14:09:49 +00:00
rustc_codegen_llvm Auto merge of #99443 - jam1garner:mips-virt-feature, r=nagisa 2022-09-14 08:21:25 +00:00
rustc_codegen_ssa Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_const_eval Address code review comments 2022-09-13 14:50:12 -07:00
rustc_data_structures Auto merge of #99334 - NiklasJonsson:84447/error-privacy, r=oli-obk 2022-09-12 15:57:37 +00:00
rustc_driver make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
rustc_error_codes Stabilize #![feature(label_break_value)] 2022-08-23 21:14:12 -05:00
rustc_error_messages Better errors for implied static bound 2022-09-13 20:18:04 -04:00
rustc_errors Compute lint_levels by definition 2022-09-14 19:02:44 +02:00
rustc_expand make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
rustc_feature Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_fs_util Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_graphviz Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_hir Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillot 2022-09-14 05:21:14 +00:00
rustc_hir_pretty Handle generic parameters. 2022-09-09 01:31:46 +00:00
rustc_incremental Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
rustc_index Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_infer Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_interface change rlib format to discern native dependencies 2022-09-12 16:45:03 +03:00
rustc_lexer remove unnecessary PartialOrd and Ord 2022-09-08 06:15:33 +09:00
rustc_lint Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk 2022-09-15 00:01:17 +00:00
rustc_lint_defs Compute lint_levels by definition 2022-09-14 19:02:44 +02:00
rustc_llvm Introduce a fallible variant of LLVMConstIntGetZExtValue 2022-09-09 15:54:14 +02:00
rustc_log Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
rustc_macros Move TRY_LOAD_FROM_DISK out of rustc_queries to rustc_query_impl 2022-09-09 20:21:59 -05:00
rustc_metadata make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
rustc_middle Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk 2022-09-15 00:01:17 +00:00
rustc_mir_build Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_mir_dataflow Generalize the Assume intrinsic statement to a general Intrinsic statement 2022-09-06 14:18:32 +00:00
rustc_mir_transform minor fixups as per PR feedback 2022-09-11 14:04:17 +08:00
rustc_monomorphize Address code review comments 2022-09-13 14:50:12 -07:00
rustc_parse Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot 2022-09-14 20:52:18 +00:00
rustc_parse_format Separate CountIsStar from CountIsParam in rustc_parse_format. 2022-08-25 14:49:09 +02:00
rustc_passes Rollup merge of #101772 - est31:replace_placeholder_diagnostics, r=jackh726 2022-09-14 19:26:21 +05:30
rustc_plugin_impl Migrate rustc_plugin_impl to SessionDiagnostic 2022-08-22 16:35:05 +01:00
rustc_privacy Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillot 2022-09-14 05:21:14 +00:00
rustc_query_impl Correct Key impl for HirId. 2022-09-14 19:06:48 +02:00
rustc_query_system Allow query system to recover a HirId. 2022-09-14 19:04:13 +02:00
rustc_resolve Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillot 2022-09-14 05:21:14 +00:00
rustc_save_analysis Remove path_span argument to the visit_path_segment methods. 2022-09-12 13:24:25 +10:00
rustc_serialize Replace rustc_data_structures::thin_vec::ThinVec with thin_vec::ThinVec. 2022-08-29 15:42:13 +10:00
rustc_session make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
rustc_smir Only keep one version of ImplicitSelfKind. 2022-09-13 19:18:23 +02:00
rustc_span Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_symbol_mangling Address code review comments 2022-09-13 14:50:12 -07:00
rustc_target Use RelocModel::Pic for UEFI targets 2022-09-09 15:26:19 -04:00
rustc_trait_selection Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_traits Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00
rustc_transmute Auto merge of #100726 - jswrenn:transmute, r=oli-obk 2022-09-04 07:55:44 +00:00
rustc_ty_utils Plumb dyn trait representation through ty::Dynamic 2022-09-12 16:55:55 -07:00
rustc_type_ir Address code review comments 2022-09-13 14:50:12 -07:00
rustc_typeck Auto merge of #101212 - eholk:dyn-star, r=compiler-errors 2022-09-14 18:10:51 +00:00