From b5639d3fc0a52ed247973b15ff6fdbf36849bd3a Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 6 Jul 2022 11:39:46 -0700 Subject: [PATCH 1/2] Add rust-analyzer proxy. --- doc/src/concepts/components.md | 7 +++++-- doc/src/concepts/profiles.md | 2 +- doc/src/concepts/proxies.md | 4 +++- src/lib.rs | 15 ++++++++------- tests/cli-misc.rs | 5 ++++- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/doc/src/concepts/components.md b/doc/src/concepts/components.md index e6608ae4c1..ba74f96276 100644 --- a/doc/src/concepts/components.md +++ b/doc/src/concepts/components.md @@ -40,8 +40,10 @@ toolchains. The following is an overview of the different components: * `rust-docs` — This is a local copy of the [Rust documentation]. Use the `rustup doc` command to open the documentation in a web browser. Run `rustup doc --help` for more options. -* `rls` — [RLS] is a language server that provides support for editors and - IDEs. +* `rust-analyzer` — [rust-analyzer] is a language server that provides support + for editors and IDEs. +* `rls` — [RLS] is a language server that is deprecated and has been replaced + by rust-analyzer. * `clippy` — [Clippy] is a lint tool that provides extra checks for common mistakes and stylistic choices. * `miri` — [Miri] is an experimental Rust interpreter, which can be used for @@ -76,6 +78,7 @@ details. [build-std]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std [miri]: https://github.com/rust-lang/miri/ [RLS]: https://github.com/rust-lang/rls +[rust-analyzer]: https://rust-analyzer.github.io/ [rustdoc]: https://doc.rust-lang.org/rustdoc/ [cargo]: https://doc.rust-lang.org/cargo/ [clippy]: https://github.com/rust-lang/rust-clippy diff --git a/doc/src/concepts/profiles.md b/doc/src/concepts/profiles.md index eed7e35ef9..abb445991f 100644 --- a/doc/src/concepts/profiles.md +++ b/doc/src/concepts/profiles.md @@ -16,7 +16,7 @@ available at this time are `minimal`, `default`, and `complete`: `rustup`. This should never be used, as it includes *every* component ever included in the metadata and thus will almost always fail. If you are looking for a way to install devtools such as `miri` or IDE integration - tools (`rls`), you should use the `default` profile and + tools (`rust-analyzer`), you should use the `default` profile and install the needed additional components manually, either by using `rustup component add` or by using `-c` when installing the toolchain. diff --git a/doc/src/concepts/proxies.md b/doc/src/concepts/proxies.md index cbbba69e43..5bb96b3bab 100644 --- a/doc/src/concepts/proxies.md +++ b/doc/src/concepts/proxies.md @@ -16,8 +16,10 @@ The list of proxies is currently static in `rustup` and is as follows: - `rust-lldb`, `rust-gdb`, and `rust-gdbgui` are simple wrappers around the `lldb`, `gdb`, and `gdbgui` debuggers respectively. The wrappers enable some pretty-printing of Rust values and add some convenience features to the debuggers by means of their scripting interfaces. -- `rls` is part of the Rust IDE integration tooling. It implements the language-server protocol to permit IDEs and editors such as Visual Studio Code, ViM, or Emacs, access to the semantics of the Rust code you are editing. It comes from the `rls` component. +- `rust-analyzer` is part of the Rust IDE integration tooling. It implements the language-server protocol to permit IDEs and editors such as Visual Studio Code, ViM, or Emacs, access to the semantics of the Rust code you are editing. It comes from the `rust-analyzer` component. - `cargo-clippy` and `clippy-driver` are related to the `clippy` linting tool which provides extra checks for common mistakes and stylistic choices and it comes from the `clippy` component. - `cargo-miri` is an experimental interpreter for Rust's mid-level intermediate representation (MIR) and it comes from the `miri` component. + +- `rls` is a deprecated IDE tool that has been replaced by `rust-analyzer`. It comes from the `rls` component. diff --git a/src/lib.rs b/src/lib.rs index e29224264e..2cbbfb1177 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,6 +27,7 @@ pub static TOOLS: &[&str] = &[ "rust-gdb", "rust-gdbgui", "rls", + "rust-analyzer", "cargo-clippy", "clippy-driver", "cargo-miri", @@ -110,12 +111,12 @@ mod tests { for tool in DUP_TOOLS { assert!(is_proxyable_tools(tool).is_ok()); } - let message = &"unknown proxy name: 'unknown-tool'; valid proxy names are 'rustc', \ - 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', 'cargo-clippy', \ - 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'"; - assert!(is_proxyable_tools("unknown-tool") - .unwrap_err() - .to_string() - .eq(message)); + let message = "unknown proxy name: 'unknown-tool'; valid proxy names are 'rustc', \ + 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', 'rust-analyzer', \ + 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'"; + assert_eq!( + is_proxyable_tools("unknown-tool").unwrap_err().to_string(), + message + ); } } diff --git a/tests/cli-misc.rs b/tests/cli-misc.rs index bf199b451d..d7c8243614 100644 --- a/tests/cli-misc.rs +++ b/tests/cli-misc.rs @@ -411,7 +411,10 @@ fn rustup_failed_path_search() { expect_err( config, broken, - "unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'", + "unknown proxy name: 'fake_proxy'; valid proxy names are \ + 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', \ + 'rls', 'rust-analyzer', 'cargo-clippy', 'clippy-driver', 'cargo-miri', \ + 'rustfmt', 'cargo-fmt'", ); // Hardlink will be automatically cleaned up by test setup code From 0bfe6232a40dba83487e07d2a7cec73eaa151591 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 19 Jul 2022 07:22:39 -0700 Subject: [PATCH 2/2] Move rust-analyzer to DUP_TOOLS The rust-analyzer documentation includes the step `cargo install` into `~/.cargo/bin` when building from source. Since this has a chance of accidentally overriding the user's copy, move this to DUP_TOOLS. --- src/lib.rs | 7 +++---- tests/cli-misc.rs | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2cbbfb1177..6ba0f26e46 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,7 +27,6 @@ pub static TOOLS: &[&str] = &[ "rust-gdb", "rust-gdbgui", "rls", - "rust-analyzer", "cargo-clippy", "clippy-driver", "cargo-miri", @@ -36,7 +35,7 @@ pub static TOOLS: &[&str] = &[ // Tools which are commonly installed by Cargo as well as rustup. We take a bit // more care with these to ensure we don't overwrite the user's previous // installation. -pub static DUP_TOOLS: &[&str] = &["rustfmt", "cargo-fmt"]; +pub static DUP_TOOLS: &[&str] = &["rust-analyzer", "rustfmt", "cargo-fmt"]; // If the given name is one of the tools we proxy. pub fn is_proxyable_tools(tool: &str) -> Result<()> { @@ -112,8 +111,8 @@ mod tests { assert!(is_proxyable_tools(tool).is_ok()); } let message = "unknown proxy name: 'unknown-tool'; valid proxy names are 'rustc', \ - 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', 'rust-analyzer', \ - 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'"; + 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', \ + 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rust-analyzer', 'rustfmt', 'cargo-fmt'"; assert_eq!( is_proxyable_tools("unknown-tool").unwrap_err().to_string(), message diff --git a/tests/cli-misc.rs b/tests/cli-misc.rs index d7c8243614..08fe9ac6d6 100644 --- a/tests/cli-misc.rs +++ b/tests/cli-misc.rs @@ -413,8 +413,8 @@ fn rustup_failed_path_search() { broken, "unknown proxy name: 'fake_proxy'; valid proxy names are \ 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', \ - 'rls', 'rust-analyzer', 'cargo-clippy', 'clippy-driver', 'cargo-miri', \ - 'rustfmt', 'cargo-fmt'", + 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', \ + 'rust-analyzer', 'rustfmt', 'cargo-fmt'", ); // Hardlink will be automatically cleaned up by test setup code