aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-03-21 14:43:48 +0000
committerEdwin Cheng <[email protected]>2020-03-21 14:43:48 +0000
commite1a9461806a4d6dd2ad58be2d6148c0e8fdb2299 (patch)
tree4bc77ef5e85876a4c5a164da97ceb0bdde9bdbb7 /crates/ra_ide
parent92b561b5c7da8303473792ba2bacb430614da2d1 (diff)
Add identity expansion checking
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/diagnostics.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index a10e642db..50106e31e 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -715,4 +715,34 @@ fn main() {
715 check_struct_shorthand_initialization, 715 check_struct_shorthand_initialization,
716 ); 716 );
717 } 717 }
718
719 #[test]
720 fn test_bad_macro_stackover() {
721 check_no_diagnostic(
722 r#"
723 //- /main.rs
724 #[macro_export]
725 macro_rules! match_ast {
726 (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
727
728 (match ($node:expr) {
729 $( ast::$ast:ident($it:ident) => $res:expr, )*
730 _ => $catch_all:expr $(,)?
731 }) => {{
732 $( if let Some($it) = ast::$ast::cast($node.clone()) { $res } else )*
733 { $catch_all }
734 }};
735 }
736
737 fn main() {
738 let anchor = match_ast! {
739 match parent {
740 as => {},
741 _ => return None
742 }
743 };
744 }
745 "#,
746 );
747 }
718} 748}