Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/rename.rs')
| -rw-r--r-- | crates/ide/src/rename.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/crates/ide/src/rename.rs b/crates/ide/src/rename.rs index 6d1e141d21..5d86ad5077 100644 --- a/crates/ide/src/rename.rs +++ b/crates/ide/src/rename.rs @@ -4079,4 +4079,51 @@ impl<'a, T> Foo<'a, T> {} "#, ); } + + #[test] + fn test_rename_mut_pattern_with_macro() { + check( + "new", + r#" +macro_rules! pat_macro { + ($pat:pat) => { + $pat + }; +} +enum CustomOption<T> { + None, + Some(T), +} + +pub fn main() { + match CustomOption::None { + pat_macro!(CustomOption::Some(mut old$0)) => { + old += 1, + } + None => {} + } +} +"#, + r#" +macro_rules! pat_macro { + ($pat:pat) => { + $pat + }; +} +enum CustomOption<T> { + None, + Some(T), +} + +pub fn main() { + match CustomOption::None { + pat_macro!(CustomOption::Some(mut new)) => { + new += 1, + } + None => {} + } +} +"#, + ); + } } |