rust-analyzer/crates/hir-ty/src
bors fd243cd0fb Auto merge of #18099 - ChayimFriedman2:diag-only-necessary, r=Veykril
Use more correct handling of lint attributes

The previous analysis was top-down, and worked on a single file (expanding macros). The new analysis is bottom-up, starting from the diagnostics and climbing up the syntax and module tree.

While this is more efficient (and in fact, efficiency was the motivating reason to work on this), unfortunately the code was already fast enough. But luckily, it also fixes a correctness problem: outline parent modules' attributes were not respected for the previous analysis. Case lints specifically did their own analysis to accommodate that, but it was limited to only them. The new analysis works on all kinds of lints, present and future.

It was basically impossible to fix the old analysis without rewriting it because navigating the module hierarchy must come bottom-up, and if we already have a bottom-up analysis (including syntax analysis because modules can be nested in other syntax elements, including macros), it makes sense to use only this kind of analysis.

Few other bugs (not fundamental to the previous analysis) are also fixed, e.g. overwriting of lint levels (i.e. `#[allow(lint)] mod foo { #[warn(lint)] mod bar; }`.

After this PR is merged I intend to work on an editor command that does workspace-wide diagnostics analysis (that is, `rust-analyzer diagnostics` but from your editor and without having to spawn a new process, which will have to analyze the workspace from scratch). This can be useful to users who do not want to enable check on save because of its overhead, but want to see workspace wide diagnostics from r-a (or to maintainers of rust-analyzer).

Closes #18086.
Closes #18081.
Fixes #18056.
2024-09-12 12:39:27 +00:00
..
consteval fix: Always explicitly set trait ref self types when lowering 2024-09-06 14:06:41 +02:00
diagnostics Use more correct handling of lint attributes 2024-09-12 15:24:38 +03:00
infer Fix inference of literals when the expectation is Castable 2024-09-12 00:57:34 +03:00
layout Lift out workspace related data into a separate query to preserve crategraph deduplication 2024-09-11 12:16:41 +02:00
mir fix: Always explicitly set trait ref self types when lowering 2024-09-06 14:06:41 +02:00
object_safety fix: std::error::Error is object unsafe 2024-08-30 02:00:38 +09:00
tests Fix inference of literals when the expectation is Castable 2024-09-12 00:57:34 +03:00
autoderef.rs internal: Don't allocate autoderef steps when not needed 2024-08-25 13:12:07 +02:00
builder.rs Fix lifetime parameters moving paramter defaults 2024-07-02 12:34:32 +02:00
chalk_db.rs feat: Implement object safety 2024-08-29 22:22:21 +09:00
chalk_ext.rs feat: Implement TAIT 2024-08-10 15:22:05 +09:00
consteval.rs Avoid Option::is_none_or for a while 2024-09-02 20:04:35 +03:00
db.rs fix: std::error::Error is object unsafe 2024-08-30 02:00:38 +09:00
diagnostics.rs Merge commit '7219414e81810fd4d967136c4a0650523892c157' into sync-from-ra 2024-01-28 15:56:54 +02:00
display.rs Auto merge of #17973 - Veykril:proc-macro-curr-dir, r=Veykril 2024-08-27 11:53:04 +00:00
generics.rs feat: Implement object safety 2024-08-29 22:22:21 +09:00
infer.rs fix: Properly prevent mir building with unknown types present 2024-09-06 14:44:05 +02:00
inhabitedness.rs More symbol usage 2024-07-16 12:05:16 +02:00
interner.rs Merge commit 'a9116523604c998e7781f60d3b5a6f586e0414a9' into sync-from-ra 2024-01-21 16:53:06 +02:00
lang_items.rs Use statics + clone instead of const until const can access statics 2024-07-14 17:52:59 +02:00
layout.rs feat: Implement TAIT 2024-08-10 15:22:05 +09:00
lib.rs feat: Implement cast typechecks 2024-09-03 04:11:36 +09:00
lower.rs fix: Always explicitly set trait ref self types when lowering 2024-09-06 14:06:41 +02:00
mapping.rs include lifetime in ParamKind and in Generics::provenance_split 2024-03-18 17:18:08 +05:30
method_resolution.rs internal: Don't allocate autoderef steps when not needed 2024-08-25 13:12:07 +02:00
mir.rs fix: Properly prevent mir building with unknown types present 2024-09-06 14:44:05 +02:00
object_safety.rs fix: std::error::Error is object unsafe 2024-08-30 02:00:38 +09:00
primitive.rs Add f16 and f128 support 2024-07-10 10:43:14 +01:00
test_db.rs Simplify FileDelegate 2024-08-05 13:03:03 +02:00
tests.rs Fix few bugs in closure capture computation, and add tests 2024-08-24 22:35:49 +03:00
tls.rs Properly account for editions in names 2024-08-16 16:46:24 +03:00
traits.rs Properly account for editions in names 2024-08-16 16:46:24 +03:00
utils.rs fix: Correctly support #[rustc_deprecated_safe_2024] 2024-08-12 10:56:59 +02:00