Find a file
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
.cargo
.github Merge #9667 2021-07-21 18:38:51 +00:00
.vscode
assets
bench_data
crates fix: avoid pathological macro expansions 2021-08-09 16:15:02 +03:00
docs feat: filter out duplicate macro completions 2021-08-03 17:36:06 +03:00
editors/code Give better error message when the rust-analyzer binar path was set in the user's config but the binary is invalid 2021-08-03 14:03:49 +02:00
lib minor: publish la_arena 2021-07-20 14:33:08 +03:00
xtask minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
.gitattributes
.gitignore
bors.toml
Cargo.lock fix: avoid pathological macro expansions 2021-08-09 16:15:02 +03:00
Cargo.toml Build test-macros in a build script 2021-06-09 17:16:52 +02:00
LICENSE-APACHE
LICENSE-MIT
PRIVACY.md Consolidate the privacy notes 2021-06-15 20:07:59 +03:00
README.md Consolidate the privacy notes 2021-06-15 20:07:59 +03:00
rustfmt.toml

rust-analyzer logo

rust-analyzer is a modular compiler frontend for the Rust language. It is a part of a larger rls-2.0 effort to create excellent IDE support for Rust.

Work on rust-analyzer is sponsored by

Ferrous Systems

Quick Start

https://rust-analyzer.github.io/manual.html#installation

Documentation

If you want to contribute to rust-analyzer or are just curious about how things work under the hood, check the ./docs/dev folder.

If you want to use rust-analyzer's language server with your editor of choice, check the manual folder. It also contains some tips & tricks to help you be more productive when using rust-analyzer.

Security and Privacy

See the corresponding sections of the manual.

Communication

For usage and troubleshooting requests, please use "IDEs and Editors" category of the Rust forum:

https://users.rust-lang.org/c/ide/14

For questions about development and implementation, join rust-analyzer working group on Zulip:

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer

License

Rust analyzer is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.