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