diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-14 17:32:43 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-14 17:32:43 +0100 |
commit | a50c64a4f13b47de7fa08eb3e6ff222a96389b28 (patch) | |
tree | 30e2cf89854d4f522896bdd7aaedb141f169ef83 /crates/ra_hir_def/src/nameres/tests/macros.rs | |
parent | ff6cf4f84914529f112b5bbefbefb2fb33c7f67a (diff) | |
parent | d47834ee1b8fce7956272e27c9403021940fec8e (diff) |
Merge #5379
5379: Guard against infinite macro expansions r=matklad a=matklad
closes #4463
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/nameres/tests/macros.rs')
-rw-r--r-- | crates/ra_hir_def/src/nameres/tests/macros.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/nameres/tests/macros.rs b/crates/ra_hir_def/src/nameres/tests/macros.rs index 84480d9f6..c52341a07 100644 --- a/crates/ra_hir_def/src/nameres/tests/macros.rs +++ b/crates/ra_hir_def/src/nameres/tests/macros.rs | |||
@@ -660,3 +660,27 @@ fn expand_multiple_derive() { | |||
660 | ); | 660 | ); |
661 | assert_eq!(map.modules[map.root].scope.impls().len(), 2); | 661 | assert_eq!(map.modules[map.root].scope.impls().len(), 2); |
662 | } | 662 | } |
663 | |||
664 | #[test] | ||
665 | fn macro_expansion_overflow() { | ||
666 | mark::check!(macro_expansion_overflow); | ||
667 | compute_crate_def_map( | ||
668 | " | ||
669 | macro_rules! a { | ||
670 | ($e:expr; $($t:tt)*) => { | ||
671 | b!($($t)*); | ||
672 | }; | ||
673 | () => {}; | ||
674 | } | ||
675 | |||
676 | macro_rules! b { | ||
677 | (static = $e:expr; $($t:tt)*) => { | ||
678 | a!($e; $($t)*); | ||
679 | }; | ||
680 | () => {}; | ||
681 | } | ||
682 | |||
683 | b! { static = #[] (); } | ||
684 | ", | ||
685 | ); | ||
686 | } | ||