about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/mbe
AgeCommit message (Collapse)AuthorLines
2025-07-31`cargo clippy --fix`Lukas Wirth-23/+21
2025-06-23Don't run doctestsChayim Refael Friedman-0/+1
2025-06-13Allow lifetime repeats in macros: $($x)'a*Tadeo Kondrak-8/+30
This works in rustc. This change isn't motivated by any real code. I just learned about it and decided to see why it doesn't work with rust-analyzer.
2025-06-12Use stable AST IDsChayim Refael Friedman-115/+117
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-05-30Add some more `hir_expand::files` conversionsLukas Wirth-1/+2
2025-05-05minor: Add a mbe test for parsing negative literalsLukas Wirth-0/+117
2025-04-21Remove unnecessary predefined symbol clonesChayim Refael Friedman-4/+4
Now that they're const it's no longer needed. Nothing manual was performed: only a regexp search of `sym::([\w][\w\d]*)\.clone\(\)` and replace by `sym::$1`.
2025-04-07Merge pull request #19511 from snprajwal/fixmesLukas Wirth-5/+6
chore: clean up some FIXMEs
2025-04-04chore: clean up some FIXMEsPrajwal S N-5/+6
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-04-01Fix a bug in MBE expansion that arose from incorrect fixing of an older bug ↵Chayim Refael Friedman-6/+14
in MBE Specifically, #18744 was the PR that was supposed to fix the old bug, but it fixed it incorrectly (and didn't add a test!) The underlying reason was that we marked metavariables in expansions as joint if they were joint in the macro call, which is incorrect. This wrong fix causes other bug, #19497, which this PR fixes by removing the old (incorrect) fix.
2025-03-23chore: Bump dependenciesLukas Wirth-1/+1
2025-03-23chore: Remove unused dependenciesLukas Wirth-3/+2
2025-03-17chore: Bump `Edition::CURRENT` to 2024Lukas Wirth-80/+80
2025-03-16internal: Render root syntax contexts more clearlyLukas Wirth-80/+80
2025-03-15cargo fmtBenjaminBrienen-22/+26
2025-03-15chore: Remove legacy `SyntaxContextId` re-exportLukas Wirth-14/+14
2025-03-10internal: port rust-analyzer to new SalsaDavid Barsky-80/+80
2025-03-08Fix syntax fixup producing invalid punctuation¨Florian-0/+17
Fixes #19206. Fixes #18244.
2025-02-27fix doc testsBenjaminBrienen-2/+2
2025-02-27enable doctestBenjaminBrienen-1/+0
2025-01-13Fix another bug when reaching macro expansion limit caused a stack overflowChayim Refael Friedman-0/+5
This time without missing bindings. Solve it by returning to the old ways, i.e. just throw the extra nodes away. In other words, I acknowledge defeat.
2025-01-09Merge pull request #18861 from ChayimFriedman2/await-editionLukas Wirth-85/+95
fix: Make edition per-token, not per-file
2025-01-09Make edition per-token, not per-fileChayim Refael Friedman-85/+95
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-07Fix a bug with missing binding in MBEChayim Refael Friedman-1/+4
We should immediately mark them as finished, on the first entry. The funny (or sad) part was that this bug was pre-existing, but previously to #18327, it was causing us to generate bindings non-stop, 65535 of them, until we get to the hardcoded repetition limit, and then throw it all away. And it was so Blazingly Fast that nobody noticed. With #18327 however, this is still what happens, except that now instead of *merging* the fragments into the result, we write them on-demand. Meaning that when we hit the limit, we've already written all previous entries. This is a minor change, I thought for myself when I was writing this, and it's actually for the better, so who cares. Minor change? Not so fast. This caused us to emit 65535 repetitions, all of which the MBE infra needs to handle when calling other macros with the expansion, and convert to rowan tree etc., which resulted a *massive* hang. The test (and also `analysis-stats`) used to crash with stack overflow on this macro, because we were dropping some crazily deep rowan tree. Now they work properly. Because I am lazy, and also because I could not find the exact conditions that causes a macro match but with a missing binding, I just copied all macros from tracing. Easy.
2025-01-07Drop unnecessary tracing::warnLukas Wirth-5/+0
We already emit an error
2025-01-06minor: New clippy lintsLukas Wirth-1/+1
2025-01-02Store token trees in contiguous `Vec` instead of as a treeChayim Refael Friedman-564/+433
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.
2024-12-24Remove dangling outdated test moduleLukas Wirth-101/+0
2024-10-21fix: FIx mbe bench tests being iteration order dependentLukas Wirth-5/+8
2024-10-21Update ide testsLukas Wirth-1/+1
2024-09-25Add missing rustc_privateLaurențiu Nicola-0/+2
2024-09-20Auto merge of #18151 - ChayimFriedman2:metavar-concat, r=Veykrilbors-5/+149
feat: Support the `${concat(...)}` metavariable expression I didn't follow rustc precisely, because I think it does some things wrongly (or they are FIXME), but I only allowed more code, not less. So we're all fine. Closes #18145.
2024-09-19When checking for forbidden expr kind matches, account for rawnessChayim Refael Friedman-1/+1
An expression starting with `r#const` etc. should be accepted even in edition <=2021.
2024-09-19Support the `${concat(...)}` metavariable expressionChayim Refael Friedman-5/+149
I didn't follow rustc precisely, because I think it does some things wrongly (or they are FIXME), but I only allowed more code, not less. So we're all fine.
2024-09-18Auto merge of #18131 - ChayimFriedman2:macro-expand-dollar-crate, r=Veykrilbors-2/+9
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-18Get rid of `$crate` in expansions shown to the userChayim Refael Friedman-2/+9
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-18feat: Implement `expr_2021`Shoyu Vanilla-21/+192
2024-09-01internal: Lay basic ground work for standalone mbe testsLukas Wirth-0/+182
2024-08-06Replace `[package.repository] = "…"` of published crates with ↵Vincent Esche-1/+1
`[package.repository.workspace] = true`
2024-08-06Add repository URL for published crates' missing `[package.repository]` fieldsVincent Esche-0/+1
2024-08-06Replace `"TBD"` with more helpful desciptions in published crates' ↵Vincent Esche-1/+1
`[package.description]` fields
2024-08-05Split out syntax-bridge into a separate crateLukas Wirth-1224/+9
2024-07-29Make basic use of spans for macro expansion errorsLukas Wirth-150/+152
2024-07-19Parse contextual dyn keyword properly in edition 2015Lukas Wirth-3/+2
2024-07-19Test macros doing edition dependent parsingLukas Wirth-39/+31
2024-07-18Encode edition within FileId in the hir layerLukas Wirth-2/+8
2024-07-17Add always disabled gen parse supportLukas Wirth-3/+8
2024-07-16Switch token trees to use SymbolsLukas Wirth-81/+90
2024-07-15Fix incorrect encoding of literals in the proc-macro-api on version 4Lukas Wirth-61/+4
2024-07-15Encode ident rawness and literal kind separately in tt::LeafLukas Wirth-78/+201