mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
fix: Fix macro transcriber emitting incorrect lifetime tokens
This commit is contained in:
parent
ddf105b646
commit
c990587593
4 changed files with 73 additions and 6 deletions
|
@ -1090,3 +1090,57 @@ fn main() {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn regression_16529() {
|
||||
check(
|
||||
r#"
|
||||
mod any {
|
||||
#[macro_export]
|
||||
macro_rules! nameable {
|
||||
{
|
||||
struct $name:ident[$a:lifetime]
|
||||
} => {
|
||||
$crate::any::nameable! {
|
||||
struct $name[$a]
|
||||
a
|
||||
}
|
||||
};
|
||||
{
|
||||
struct $name:ident[$a:lifetime]
|
||||
a
|
||||
} => {};
|
||||
}
|
||||
pub use nameable;
|
||||
|
||||
nameable! {
|
||||
Name['a]
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
mod any {
|
||||
#[macro_export]
|
||||
macro_rules! nameable {
|
||||
{
|
||||
struct $name:ident[$a:lifetime]
|
||||
} => {
|
||||
$crate::any::nameable! {
|
||||
struct $name[$a]
|
||||
a
|
||||
}
|
||||
};
|
||||
{
|
||||
struct $name:ident[$a:lifetime]
|
||||
a
|
||||
} => {};
|
||||
}
|
||||
pub use nameable;
|
||||
|
||||
/* error: unexpected token in input */$crate::any::nameable! {
|
||||
struct $name[$a]a
|
||||
}
|
||||
}
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue