]> git.lizzy.rs Git - rust.git/blob - README.md
Merge #521
[rust.git] / README.md
1 # Rust Analyzer
2
3 [![Build Status](https://travis-ci.org/rust-analyzer/rust-analyzer.svg?branch=master)](https://travis-ci.org/rust-analyzer/rust-analyzer)
4
5 Rust Analyzer is an **experimental** modular compiler frontend for the Rust
6 language, which aims to lay a foundation for excellent IDE support.
7
8 It doesn't implement much of compiler functionality yet, but the white-space
9 preserving Rust parser works, and there are significant chunks of overall
10 architecture (indexing, on-demand & lazy computation, snapshotable world view)
11 in place. Some basic IDE functionality is provided via a language server.
12
13 Work on the Rust Analyzer is sponsored by
14
15 [![Ferrous Systems](https://ferrous-systems.com/images/ferrous-logo-text.svg)](https://ferrous-systems.com/)
16
17
18 ## Quick Start
19
20 Rust analyzer builds on Rust >= 1.31.0 and uses the 2018 edition.
21
22 ```
23 # run tests
24 $ cargo test
25
26 # show syntax tree of a Rust file
27 $ cargo run --package ra_cli parse < crates/ra_syntax/src/lib.rs
28
29 # show symbols of a Rust file
30 $ cargo run --package ra_cli symbols < crates/ra_syntax/src/lib.rs
31
32 # install the language server
33 $ cargo install --path crates/ra_lsp_server
34 ```
35
36 See [these instructions](./editors/README.md) for VS Code setup and the list of
37 features (some of which are VS Code specific).
38
39 ## Current Status and Plans
40
41 Rust analyzer aims to fill the same niche as the official [Rust Language
42 Server](https://github.com/rust-lang-nursery/rls), but uses a significantly
43 different architecture. More details can be found [in this
44 thread](https://internals.rust-lang.org/t/2019-strategy-for-rustc-and-the-rls/8361),
45 but the core issue is that RLS works in the "wait until user stops typing, run
46 the build process, save the results of the analysis" mode, which arguably is the
47 wrong foundation for IDE.
48
49 Rust Analyzer is an experimental project at the moment, there's exactly zero
50 guarantees that it becomes production-ready one day.
51
52 The near/mid term plan is to work independently of the main rustc compiler and
53 implement at least simplistic versions of name resolution, macro expansion and
54 type inference. The purpose is two fold:
55
56 * to quickly bootstrap usable and useful language server: solution that covers
57   80% of Rust code will be useful for IDEs, and will be vastly simpler than 100%
58   solution.
59
60 * to understand how the consumer-side of compiler API should look like
61   (especially it's on-demand aspects). If you have `get_expression_type`
62   function, you can write a ton of purely-IDE features on top of it, even if the
63   function is only partially correct. Pluging in the precise function afterwards
64   should just make IDE features more reliable.
65
66 The long term plan is to merge with the mainline rustc compiler, probably around
67 the HIR boundary? That is, use rust analyzer for parsing, macro expansion and
68 related bits of name resolution, but leave the rest (including type inference
69 and trait selection) to the existing rustc.
70
71 ## Getting in touch
72
73 We have a Discord server dedicated to compilers and language servers
74 implemented in Rust: [https://discord.gg/sx3RQZB](https://discord.gg/sx3RQZB).
75
76 ## Contributing
77
78 See [CONTRIBUTING.md](./CONTRIBUTING.md) and [ARCHITECTURE.md](./ARCHITECTURE.md)
79
80
81 ## License
82
83 Rust analyzer is primarily distributed under the terms of both the MIT
84 license and the Apache License (Version 2.0).
85
86 See LICENSE-APACHE and LICENSE-MIT for details.