Fix prettify_macro_expansion() when the node isn't the whole file

This commit is contained in:
Chayim Refael Friedman 2024-10-05 22:39:33 +03:00
parent 5982d9c420
commit c8540e7079
2 changed files with 34 additions and 1 deletions

View file

@ -8988,3 +8988,33 @@ mod m {
"#]],
);
}
#[test]
fn regression_18238() {
check(
r#"
macro_rules! foo {
($name:ident) => {
pub static $name = Foo::new(|| {
$crate;
});
};
}
foo!(BAR_$0);
"#,
expect![[r#"
*BAR_*
```rust
test
```
```rust
pub static BAR_: {error} = Foo::new(||{
crate;
})
```
"#]],
);
}