rust/crates
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
..
base_db Complete editable private items 2021-07-23 19:57:16 +02:00
cfg internal: remove useless helpers 2021-08-09 15:58:21 +03:00
flycheck
hir Add reference here diagnostic 2021-08-08 10:12:40 +02:00
hir_def fix: avoid pathological macro expansions 2021-08-09 16:15:02 +03:00
hir_expand fix: avoid pathological macro expansions 2021-08-09 16:15:02 +03:00
hir_ty Increase chalk overflow depth 2021-08-08 18:40:28 +03:00
ide Fix typo in reference modifier description 2021-08-09 14:06:14 +03:00
ide_assists Merge #9735 2021-08-09 10:21:14 +00:00
ide_completion fix: avoid pathological macro expansions 2021-08-09 16:15:02 +03:00
ide_db Remove unused structs in ide_db 2021-08-05 12:04:37 +01:00
ide_diagnostics Merge #9810 2021-08-08 10:35:00 +00:00
ide_ssr fix: avoid pathological macro expansions 2021-08-09 16:15:02 +03:00
limit internal: add API to check what are the max limits in practice 2021-07-31 18:26:43 +03:00
mbe internal: remove useless helpers 2021-08-09 15:58:21 +03:00
parser Split the test 2021-08-04 03:01:48 -07:00
paths
proc_macro_api Replace useless types 2021-07-31 14:29:15 +02:00
proc_macro_srv Copy the proc_macro crate for the 1.56 ABI 2021-08-07 16:34:59 +01:00
proc_macro_test
profile internal: make non-zero times stand out in profile 2021-07-31 16:22:03 +03:00
project_model Rust project project model smoke tests 2021-08-01 15:00:34 -07:00
rust-analyzer internal: remove useless helpers 2021-08-09 15:58:21 +03:00
sourcegen
stdx
syntax Merge #9814 2021-08-08 22:30:37 +00:00
test_utils Update crates/test_utils/src/minicore.rs 2021-08-09 00:00:09 +02:00
text_edit minor: as per code-styple, add invariant comment 2021-08-09 13:13:02 +03:00
toolchain
tt
vfs
vfs-notify Downgrade notify and use RecommendedWatcher 2021-08-03 14:33:37 +03:00