Commit graph

512 commits

Author SHA1 Message Date
Lukas Wirth
4f35021ca9
Merge pull request #18907 from Veykril/push-uqlzpttmvurv
Implement `#[rust_analyzer::skip]` for bodies
2025-01-10 13:59:23 +00:00
Lukas Wirth
f209d50dcf Implement #[rust_analyzer::skip] for bodies 2025-01-10 14:41:27 +01:00
Lukas Wirth
bf669dab84 Re-implement rust string highlighting via tool attribute 2025-01-10 13:49:35 +01:00
Chayim Refael Friedman
bbcb71a403 Fix another issue with fixup reversing
We need to *remove* the whole subtree, but we don't advance `i` by this, because it hasn't gotten there yet (and never will).
2025-01-09 22:02:44 +02:00
Lukas Wirth
3fe50ef83c
Merge pull request #18861 from ChayimFriedman2/await-edition
fix: Make edition per-token, not per-file
2025-01-09 10:20:11 +00:00
Lukas Wirth
646e96f68d minor: Fixup macro error kinds 2025-01-09 09:38:58 +01:00
Chayim Refael Friedman
97afb7bfba Make edition per-token, not per-file
More correctly, *also* per-token. Because as it turns out, while the top-level edition affects parsing (I think), the per-token edition affects escaping of identifiers/keywords.
2025-01-09 05:43:08 +02:00
Laurențiu Nicola
f5e698d0b0 Merge from rust-lang/rust 2025-01-07 17:57:53 +02:00
Laurențiu Nicola
bfb81275fb
Merge pull request #18852 from ChayimFriedman2/proc-macro-panic
fix: Fix a bug that was caused by fixup reversing
2025-01-06 18:38:24 +00:00
Chayim Refael Friedman
f7c4833830 Fix a bug that was caused by fixup reversing 2025-01-06 20:06:20 +02:00
Lukas Wirth
4b6007115a minor: New clippy lints 2025-01-06 17:57:17 +01:00
Chayim Refael Friedman
ce323627c5 Support the new CoercePointee derive 2025-01-04 18:35:53 +02:00
Chayim Refael Friedman
ceba289f80 Store token trees in contiguous Vec instead of as a tree
I expected this to be faster (due to less allocations and better cache locality), but benchmarked it is not (neither it is slower). Memory usage, however, drops by ~50mb (of `analysis-stats .`). I guess tt construction is just not hot.

This also simplifies using even less memory for token trees by compressing equal span, which I plan to do right after.

Some workflows are more easily expressed with a flat tt, while some are better expressed with a tree. With the right helpers, though (which was mostly a matter of trial and error), even the worst workflows become very easy indeed.
2025-01-02 19:21:46 +02:00
bors
485f5e80e6 Auto merge of #134681 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-12-23 12:18:14 +00:00
Laurențiu Nicola
a2a5b72c47 Merge from rust-lang/rust 2024-12-23 11:27:07 +02:00
Zalathar
aeec9ba525 Revert "Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser"
This reverts commit 1d35638dc38dbfbf1cc2a9823135dfcf3c650169, reversing
changes made to f23a80a4c2fbca593b64e70f5970368824b4c5e9.
2024-12-23 12:30:37 +11:00
Chayim Refael Friedman
02d47f3a81 Fix a case where completion was unable to expand a macro
Which caused the macros of the popular `tracing` crate to not offer completions.

The reason is rather complicated: it boils down to macro ignoring their input and completion always choosing the first expansion.
2024-12-20 13:14:59 +02:00
ltdk
c180e41198 Stabilize #[coverage] attribute 2024-12-16 21:07:06 -05:00
Lukas Wirth
6aadbae022
Merge pull request #18674 from Veykril/push-lrxotqknvxvr
Show expansion errors in expand_macro feature
2024-12-13 08:50:45 +00:00
Lukas Wirth
28fbecff42 Show expansion errors in expand_macro feature 2024-12-13 09:36:03 +01:00
Lukas Wirth
f748eb510e internal: Implement naked_asm! builtin 2024-12-12 17:43:27 +01:00
Laurențiu Nicola
30262281eb Merge from rust-lang/rust 2024-12-11 11:49:08 +02:00
Ben Kimock
0843b6f308 Remove polymorphization 2024-12-06 16:42:09 -05:00
Lukas Wirth
f499faf72b
Merge pull request #18611 from ChayimFriedman2/proc-macro-warn
fix: Do not report warnings from proc macros, ever
2024-12-04 16:39:54 +00:00
Chayim Refael Friedman
33c7e81e90 Do not report warnings from proc macros, ever 2024-12-04 15:25:01 +02:00
Chayim Refael Friedman
5f25ae3d1b Lay the foundation for diagnostics in ty lowering, and implement a first diagnostic
The diagnostic implemented is a simple one (E0109). It serves as a test for the new foundation.

This commit only implements diagnostics for type in bodies and body-carrying signatures; the next commit will include diagnostics in the rest of the things.

Also fix one weird bug that was detected when implementing this that caused `Fn::(A, B) -> C` (which is a valid, if bizarre, alternative syntax to `Fn(A, B) -> C` to lower incorrectly.

And also fix a maybe-bug where parentheses were sneaked into a code string needlessly; this was not detected until now because the parentheses were removed (by the make-AST family API), but with a change in this commit they are now inserted. So fix that too.
2024-12-04 14:22:56 +02:00
Lukas Wirth
e7b96dd2de fix: Fix syntax fixup inserting unnecessary semicolons 2024-12-02 13:35:58 +01:00
Lukas Wirth
36d68c5d0f Support new #[rustc_intrinsic] attribute and fallback bodies 2024-11-04 13:33:55 +01:00
Lukas Wirth
80e9d014be
Merge pull request #18074 from ChayimFriedman2/typeref-source-map
internal: Build source map for `hir_def::TypeRef`s
2024-10-28 11:01:12 +00:00
Chayim Refael Friedman
f4585ea023 Split macro-error diagnostic so users can ignore only parts of it
Split it into `macro-error`, `proc-macros-disabled` and `proc-macro-disabled`.
2024-10-27 02:24:15 +02:00
Chayim Refael Friedman
bccf0062b7 Do not allocate attributes entry if there are no attributes
This saves 8mb.
2024-10-25 06:15:06 +03:00
Chayim Refael Friedman
8adcbdcc49 Implement semitransparent hygiene
Or macro_rules hygiene, or mixed site hygiene. In other words, hygiene for variables and labels but not items.

The realization that made me implement this was that while "full" hygiene (aka. def site hygiene) is really hard for us to implement, and will likely involve intrusive changes and performance losses, since every `Name` will have to carry hygiene, mixed site hygiene is very local: it applies only to bodies, and we very well can save it in a side map with minor losses.

This fixes one diagnostic in r-a that was about `izip!()` using hygiene (yay!) but it introduces a huge number of others, because of #18262. Up until now this issue wasn't a major problem because it only affected few cases, but with hygiene identifiers referred by macros like that are not resolved at all. The next commit will fix that.
2024-10-22 21:26:56 +03:00
Lukas Wirth
6c23f25e7f Fix new nightly lints 2024-10-22 11:48:41 +02:00
Lukas Wirth
d878b8caad fix: Fix token downmapping failing for include! inputs 2024-10-21 17:22:18 +02:00
Wei Xu
cfa5df107a
Increase TOKEN_LIMIT for hir-expand 2024-10-18 17:36:24 -07:00
David Barsky
ccee36e8dd chore: rename salsa to ra_salsa 2024-10-14 10:09:22 -04:00
David Richey
3d6acb3d60 Skip #[test_case] expansion 2024-10-09 19:34:08 -05:00
Chayim Refael Friedman
c8540e7079 Fix prettify_macro_expansion() when the node isn't the whole file 2024-10-05 22:39:33 +03:00
bors
510f72e12c Auto merge of #18234 - Veykril:veykril/push-vzynqtlxmrnl, r=Veykril
internal: Filter out opaque tokens in some IDE feature macro descensions
2024-10-04 10:26:04 +00:00
Lukas Wirth
24d65bb7cf internal: Filter out opaque tokens in some of IDE feature macro descensions 2024-10-04 11:53:12 +02:00
Chayim Refael Friedman
4a06675e9c Gate #[test] expansion under cfg(test).
This will mean users opting to not activate `cfg(test)` will lose IDE experience on them, which is quite unfortunate, but this is unavoidable if we want to avoid false positives on e.g. diagnostics. The real fix is to provide IDE experience even for cfg'ed out code, but this is out of scope for this PR.
2024-09-30 00:12:45 +03:00
Laurențiu Nicola
37f7190b3e Merge from rust-lang/rust 2024-09-25 09:00:53 +03:00
Chayim Refael Friedman
82124f33b5 Handle lint attributes that are under #[cfg_attr] 2024-09-19 22:21:48 +03:00
bors
990c48cb0d Auto merge of #18131 - ChayimFriedman2:macro-expand-dollar-crate, r=Veykril
fix: Get rid of `$crate` in expansions shown to the user

Be it "Expand Macro Recursively", "Inline macro" or few other things.

We replace it with the crate name, as should've always been.

Probably fixes some issues, but I don't know what they are.
2024-09-18 20:17:21 +00:00
Chayim Refael Friedman
cfb701ac78 Get rid of $crate in expansions shown to the user
Be it "Expand Macro Recursively", "Inline macro" or few other things.

We replace it with the crate name, as should've always been.
2024-09-18 18:30:59 +03:00
Chayim Refael Friedman
35e171aa01 Always cache macro expansions' root node in Semantics
Previously some expansions were not cached, but were cached in the expansion cache, which caused panics when later queries tried to lookup the node from the expansion cache.
2024-09-17 00:19:39 +03:00
bors
cfe8e376c9 Auto merge of #18080 - Veykril:dedup, r=Veykril
Remove crate graph deduplication logic

Fixes https://github.com/rust-lang/rust-analyzer/issues/17748
2024-09-11 11:47:17 +00:00
bors
14a18b4849 Auto merge of #18078 - cuishuang:master, r=Veykril
Remove unnecessary symbols and add missing symbols
2024-09-11 11:32:46 +00:00
Lukas Wirth
c2258d8880 Properly set the working directory for proc-macro execution 2024-09-11 12:23:12 +02:00
Lukas Wirth
db04f514f2 Lift out workspace related data into a separate query to preserve crategraph deduplication 2024-09-11 12:16:41 +02:00