@@ -18,11 +18,13 @@ All contributors are expected to follow the [Rust Code of Conduct].
1818 - [ Finding something to fix/improve] ( #finding-something-to-fiximprove )
1919 - [ Writing code] ( #writing-code )
2020 - [ Getting code-completion for rustc internals to work] ( #getting-code-completion-for-rustc-internals-to-work )
21+ - [ IntelliJ Rust] ( #intellij-rust )
22+ - [ Rust Analyzer] ( #rust-analyzer )
2123 - [ How Clippy works] ( #how-clippy-works )
22- - [ Syncing changes between Clippy and ` rust-lang/rust ` ] ( #syncing-changes-between-clippy-and-rust-langrust )
24+ - [ Syncing changes between Clippy and [ ` rust-lang/rust ` ] ]( #syncing-changes-between-clippy-and-rust-langrust )
2325 - [ Patching git-subtree to work with big repos] ( #patching-git-subtree-to-work-with-big-repos )
24- - [ Performing the sync from ` rust-lang/rust ` to Clippy] ( #performing-the-sync-from-rust-langrust-to-clippy )
25- - [ Performing the sync from Clippy to ` rust-lang/rust ` ] ( #performing-the-sync-from-clippy-to-rust-langrust )
26+ - [ Performing the sync from [ ` rust-lang/rust ` ] to Clippy] ( #performing-the-sync-from-rust-langrust-to-clippy )
27+ - [ Performing the sync from Clippy to [ ` rust-lang/rust ` ] ]( #performing-the-sync-from-clippy-to-rust-langrust )
2628 - [ Defining remotes] ( #defining-remotes )
2729 - [ Issue and PR triage] ( #issue-and-pr-triage )
2830 - [ Bors and Homu] ( #bors-and-homu )
@@ -105,21 +107,41 @@ quick read.
105107
106108## Getting code-completion for rustc internals to work
107109
108- Unfortunately, [ ` rust-analyzer ` ] [ ra_homepage ] does not (yet?) understand how Clippy uses compiler-internals
110+ ### IntelliJ Rust
111+ Unfortunately, [ ` IntelliJ Rust ` ] [ IntelliJ_rust_homepage ] does not (yet?) understand how Clippy uses compiler-internals
109112using ` extern crate ` and it also needs to be able to read the source files of the rustc-compiler which are not
110113available via a ` rustup ` component at the time of writing.
111114To work around this, you need to have a copy of the [ rustc-repo] [ rustc_repo ] available which can be obtained via
112115` git clone https://github.com/rust-lang/rust/ ` .
113116Then you can run a ` cargo dev ` command to automatically make Clippy use the rustc-repo via path-dependencies
114- which rust-analyzer will be able to understand.
115- Run ` cargo dev ra_setup --repo-path <repo-path> ` where ` <repo-path> ` is an absolute path to the rustc repo
117+ which ` IntelliJ Rust ` will be able to understand.
118+ Run ` cargo dev ide_setup --repo-path <repo-path> ` where ` <repo-path> ` is a path to the rustc repo
116119you just cloned.
117120The command will add path-dependencies pointing towards rustc-crates inside the rustc repo to
118121Clippys ` Cargo.toml ` s and should allow rust-analyzer to understand most of the types that Clippy uses.
119122Just make sure to remove the dependencies again before finally making a pull request!
120123
121- [ ra_homepage ] : https://rust-analyzer.github.io/
122124[ rustc_repo ] : https://github.com/rust-lang/rust/
125+ [ IntelliJ_rust_homepage ] : https://intellij-rust.github.io/
126+
127+ ### Rust Analyzer
128+ As of [ #6869 ] [ 6869 ] , [ ` rust-analyzer ` ] [ ra_homepage ] can understand that Clippy uses compiler-internals
129+ using ` extern crate ` when ` package.metadata.rust-analyzer.rustc_private ` is set to ` true ` in Clippys ` Cargo.toml. `
130+ You will required a ` nightly ` toolchain with the ` rustc-dev ` component installed.
131+ Make sure that in the ` rust-analyzer ` configuration, you set
132+ ```
133+ { "rust-analyzer.rustcSource": "discover" }
134+ ```
135+ and
136+ ```
137+ { "rust-analyzer.updates.channel": "nightly" }
138+ ```
139+ You should be able to see information on things like ` Expr ` or ` EarlyContext ` now if you hover them, also
140+ a lot more type hints.
141+ This will work with ` rust-analyzer 2021-03-15 ` shipped in nightly ` 1.52.0-nightly (107896c32 2021-03-15) ` or later.
142+
143+ [ ra_homepage ] : https://rust-analyzer.github.io/
144+ [ 6869 ] : https://github.com/rust-lang/rust-clippy/pull/6869
123145
124146## How Clippy works
125147
0 commit comments