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