rust-analyzer/crates/ide_ssr/src
Aleksey Kladov 3e5b155716 fix: avoid pathological macro expansions
Today, rust-analyzer (and rustc, and bat, and IntelliJ) fail badly on
some kinds of maliciously constructed code, like a deep sequence of
nested parenthesis.

"Who writes 100k nested parenthesis" you'd ask?

Well, in a language with macros, a run-away macro expansion might do
that (see the added tests)! Such expansion can be broad, rather than
deep, so it bypasses recursion check at the macro-expansion layer, but
triggers deep recursion in parser.

In the ideal world, the parser would just handle deeply nested structs
gracefully. We'll get there some day, but at the moment, let's try to be
simple, and just avoid expanding macros with unbalanced parenthesis in
the first place.

closes #9358
2021-08-09 16:15:02 +03:00
..
errors.rs 7526: Renamed create ssr to ide_ssr. 2021-02-23 00:59:16 +05:30
from_comment.rs add apply ssr assist 2021-03-10 06:02:15 -08:00
lib.rs don't clone types that are copy (clippy::clone_on_copy) 2021-03-17 01:56:31 +01:00
matching.rs Give TypeInfo fields and methods more appropriate names 2021-08-03 17:28:51 +02:00
nester.rs 7526: Renamed create ssr to ide_ssr. 2021-02-23 00:59:16 +05:30
parsing.rs clippy::complexity simplifications related to Iterators 2021-03-21 13:13:34 +01:00
replacing.rs clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
resolving.rs clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
search.rs clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
tests.rs fix: avoid pathological macro expansions 2021-08-09 16:15:02 +03:00