mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Support macros in pattern position
This commit is contained in:
parent
bd675c8a8b
commit
e2c1da36f5
7 changed files with 88 additions and 10 deletions
|
@ -1185,6 +1185,32 @@ pub mod theitem {
|
|||
pub fn gimme() -> theitem::TheItem {
|
||||
theitem::TheItem
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn goto_ident_from_pat_macro() {
|
||||
check(
|
||||
r#"
|
||||
macro_rules! pat {
|
||||
($name:ident) => { Enum::Variant1($name) }
|
||||
}
|
||||
|
||||
enum Enum {
|
||||
Variant1(u8),
|
||||
Variant2,
|
||||
}
|
||||
|
||||
fn f(e: Enum) {
|
||||
match e {
|
||||
pat!(bind) => {
|
||||
//^^^^
|
||||
bind$0
|
||||
}
|
||||
Enum::Variant2 => {}
|
||||
}
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue