Commit graph

13 commits

Author SHA1 Message Date
Chayim Refael Friedman
4eb19df5e9 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 ti the previous analysis) are also fixed, e.g. overwriting of lint levels (i.e. `#[allow(lint)] mod foo { #[warn(lint)] mod bar; }`.
2024-09-12 15:24:38 +03:00
Lukas Wirth
c08d419fba HasGenericArgs syntax trait 2024-07-07 11:18:28 +02:00
hkalbasi
801c0ea478 Replace doc_comments_and_attrs with collect_attrs, 2nd round 2023-12-11 22:56:50 +03:30
hkalbasi
ac04bfd7a7 Add View Mir command and fix some bugs 2023-03-06 21:09:09 +03:30
Ryo Yoshida
cf0c8fe000
minor: import Either from either 2023-02-25 21:55:11 +09:00
Lukas Wirth
cc04cfc982 Reduce allocations in attribute collection 2022-01-30 22:18:32 +01:00
Lukas Wirth
08adce61a1 Better interface for doc comment and attribute processing 2022-01-07 14:14:33 +01:00
Lukas Wirth
69dbfc7754 Generate AnyHasDocComments node 2022-01-07 12:38:18 +01:00
Lukas Wirth
b6ed91a6de Rename *Owner traits to Has* 2021-09-27 12:54:24 +02:00
Lukas Wirth
ec824a92d0 Better handling of block doc comments 2021-03-17 14:48:57 +01:00
Lukas Wirth
acc6458390 Replace trait object boxing with extra AttrsOwnerNode 2021-03-16 19:06:58 +01:00
Lukas Wirth
b064f6da9e Keep doc attribute order 2020-12-07 20:38:28 +01:00
Aleksey Kladov
a1c187eef3 Rename ra_syntax -> syntax 2020-08-12 18:30:53 +02:00
Renamed from crates/ra_syntax/src/ast/traits.rs (Browse further)