feat: Support extract variable in macro call#21487
feat: Support extract variable in macro call#21487ChayimFriedman2 merged 2 commits intorust-lang:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
f5af86e to
4149dd8
Compare
This comment has been minimized.
This comment has been minimized.
4149dd8 to
d8eb024
Compare
Implement based first and last token mappings
Example
---
```rust
macro_rules! foo {
(= $($t:tt)*) => { $($t)* };
}
fn main() {
let x = foo!(= $02 + 3$0 + 4);
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
macro_rules! foo {
(= $($t:tt)*) => { $($t)* };
}
fn main() {
let $0var_name = 2+3;
let x = foo!(= var_name + 4);
}
```
d8eb024 to
144cce8
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
At present, it only supports extraction into outside of macros, and there may be improvements in the future |
|
Then test that it's not applicable in a macro? |
|
At least for small macro calls, extracting to outside the macro is very practical Supporting extraction to inside the macros may disrupt mappings |
|
I'm just saying that whatever the current behavior is, it's good to test it, so we won't have surprises now or in the future. |
Oh, I have already pushed the test |
Implement based first and last token mappings
Example
Before this PR
Assist not applicable
After this PR