127 Commits

Author SHA1 Message Date
Ed Page
f4d9018a48 feat(lexer): Allow including frontmatter with 'tokenize' 2025-07-09 16:42:27 -05:00
Chayim Refael Friedman
3e834add61 Support spans with proc macro servers from before the ast id changes
The only thing changed is the value of the fixup ast id, so we just swap it.
2025-06-12 16:08:48 +03:00
Chayim Refael Friedman
4bcf03e28b Use stable AST IDs
Instead of simple numbering, we hash important bits, like the name of the item.

This will allow for much better incrementality, e.g. when you add an item. Currently, this invalidates the IDs of all following items, which invalidates pretty much everything.
2025-06-12 08:47:22 +03:00
Chayim Refael Friedman
8ca5ad6bdd Fix proc macro server handling of strings with minuses
It used to decompose them thinking they were numbers.
2025-06-11 01:03:35 +03:00
Lukas Wirth
02a788bfaa Deduplicate code in proc-macro-srv 2025-06-05 07:25:15 +02:00
Chayim Refael Friedman
bf8d03c1b5 Correctly set the span of the proc_macro crate's Group delimiters
Previously only the open delimiter's span was set, and this caused... weird problems.
2025-05-21 18:31:14 +03:00
Laurențiu Nicola
96a253112c
Merge pull request #19826 from lnicola/sync-from-rust
minor: Sync from downstream
2025-05-20 07:15:48 +00:00
Laurențiu Nicola
9e86544698 Merge from rust-lang/rust 2025-05-20 10:01:00 +03:00
Lukas Wirth
04f88362af Remote dangling file 2025-05-19 13:08:29 +02:00
Pietro Albini
11328b0e4f
update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
Lukas Wirth
361a927a71 fix: Fix proc-macro API creating malformed negative literals 2025-05-05 14:10:42 +02:00
Lukas Wirth
cb18ead726 minor: Add more proc-macro tests for parsing negative literals 2025-05-05 13:44:45 +02:00
Laurențiu Nicola
6225bb9c44 Merge from rust-lang/rust 2025-04-28 11:06:53 +03:00
Mara Bos
963d076989 Disable some r-a tests in bootstrap. 2025-04-14 16:53:24 +02:00
Mara Bos
44885be61f Update rust-analyzer for new proc_macro span api. 2025-04-11 15:30:03 +02:00
BenjaminBrienen
2462624a7d prefer default over new 2025-04-04 15:49:50 +02:00
Prajwal S N
094407aba4
feat(proc-macro-srv): support metadata version 10
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-04-03 14:58:59 +05:30
Jakub Beránek
54811649e3 Support metadata version 10 in proc-macro-srv 2025-04-01 08:59:04 +02:00
Lukas Wirth
c6d3c4fc39 refactor: Shuffle some unsafety around in proc-macro-srv 2025-03-27 08:41:53 +01:00
Lukas Wirth
d4122434dd chore: Remove unused dependencies 2025-03-23 08:08:17 +01:00
Lukas Wirth
a505420751 chore: Bump Edition::CURRENT to 2024 2025-03-17 12:29:19 +01:00
Lukas Wirth
a06aadb9f0 internal: Render root syntax contexts more clearly 2025-03-16 16:26:07 +01:00
BenjaminBrienen
7535bb4661 cargo fmt 2025-03-15 21:32:01 +01:00
Lukas Wirth
02a793bd59 chore: Remove legacy SyntaxContextId re-export 2025-03-15 17:09:17 +01:00
Chayim Refael Friedman
c94e9efbef Salsify the crate graph
I.e. make it not one giant input but multiple, for incrementality and decreased memory usage for Salsa 3 reasons.
2025-03-12 21:02:30 +02:00
Lukas Wirth
5ec0057418 Use interior mutability for loaded ProcMacrorv::expanders 2025-02-05 12:01:57 +01:00
Chayim Refael Friedman
3f2fb17042 Make proc_macro span's line & column 1-indexed, as documented
That is, make the fake number that we return 1 and not 0.
2025-01-26 08:27:24 +02:00
Fabian Grünbichler
73fc468a8f proc-macro-srv: make usage of RTLD_DEEPBIND portable
the constant is wrong on some platforms (e.g., on mips64el it's 0x10, and 0x8
is RTLD_NOLOAD which makes all this functionality broken), the libc crate takes
care of those differences for us.

fallback to not setting the flag in non-glibc environments - some of them might
have support for it using a different value that we don't know about, and some
of them lack it entirely.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-01-20 10:19:24 +01:00
Lukas Wirth
bf669dab84 Re-implement rust string highlighting via tool attribute 2025-01-10 13:49:35 +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
Lukas Wirth
b6910ed1b2
Merge pull request #18327 from ChayimFriedman2/flat-tt
Store token trees in contiguous `Vec` instead of as a tree
2025-01-03 11:31:58 +00: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
Lukas Wirth
6b56af7688 Implement <RaSpanServer as SourceFile>::eq 2024-12-31 13:00:46 +01:00
Lukas Wirth
f5a6826137 Cleanup proc-macro dylib handling 2024-12-30 11:14:27 +01:00
Lukas Wirth
714b81bec1 Decouple proc-macro server protocol from the server implementation 2024-12-30 10:33:57 +01:00
Lukas Wirth
ed8227c649 internal: Workaround salsa cycles leaking 2024-12-26 14:55:20 +01:00
Lukas Wirth
6c6779e6f0 fix: Fix proc-macro dylib names on windows 2024-12-15 17:38:44 +01:00
Lukas Wirth
8a86fa01ac Fix clippy lints in proc-macro-srv 2024-12-12 13:30:42 +01:00
Lukas Wirth
c9314d4aff Only parse the object file once 2024-12-12 13:23:25 +01:00
Lukas Wirth
16c0f25579 Fix copied proc-macros not being cleaned up on exit 2024-12-11 10:17:33 +01:00
Lukas Wirth
f370550b0a Unload proc-macro dlls on changed timestamp 2024-12-11 09:34:27 +01:00
bjorn3
ad858841e7 Remove support for compressed dylib metadata from rust-analyzer 2024-10-31 12:48:09 +00:00
Lukas Wirth
abed6e24a8 fix: Fix TokenStream::to_string implementation dropping quotation marks 2024-08-29 08:45:35 +02:00
Lukas Wirth
d6666b16c4 fix: Fix proc-macro server crashing when parsing a non-lexable string into a TokenStream 2024-08-29 08:45:19 +02:00
bors
fbed308ebe Auto merge of #17799 - Veykril:syntax-bridge, r=Veykril
Split out syntax-bridge into a separate crate

This functionality is not really tied to mbe macros, so imo it has no place in that crate.
2024-08-05 12:31:45 +00:00
Lukas Wirth
188c577855 Newtype ErasedFileAstId 2024-08-05 13:46:47 +02:00
Lukas Wirth
d2dd4f6d5f Split out syntax-bridge into a separate crate 2024-08-05 13:45:00 +02:00
Lukas Wirth
5264f86242 Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
Lukas Wirth
7011094685 Add always disabled gen parse support 2024-07-17 10:49:12 +02:00
Lukas Wirth
93024ad411 Switch token trees to use Symbols 2024-07-16 10:11:59 +02:00