Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/macro_error.rs')
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/macro_error.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/macro_error.rs b/crates/ide-diagnostics/src/handlers/macro_error.rs index edf656ed04..99894fefef 100644 --- a/crates/ide-diagnostics/src/handlers/macro_error.rs +++ b/crates/ide-diagnostics/src/handlers/macro_error.rs @@ -291,4 +291,30 @@ mod prim_never {} "#, ); } + + #[test] + fn no_stack_overflow_for_missing_binding() { + check_diagnostics( + r#" +#[macro_export] +macro_rules! boom { + ( + $($code:literal),+, + $(param: $param:expr,)? + ) => {{ + let _ = $crate::boom!(@param $($param)*); + }}; + (@param) => { () }; + (@param $param:expr) => { $param }; +} + +fn it_works() { + // NOTE: there is an error, but RA crashes before showing it + boom!("RAND", param: c7.clone()); + // ^^^^^ error: expected literal +} + + "#, + ); + } } |