docs: update rust-analyzer command
Subsystems (3)
Onur Özkan
reviewerPATCH 1/1 docs: update rust-analyzer command
On a fresh checkout, generating rust-project.json alone is not enough for rust-analyzer to work reliably. The issue only becomes apparent later when the LSP fails on a proc macro or binding types/functions.
Recommend running prepare together with the rust-analyzer target so the generated files expected by rust-analyzer are available from the start.
--- Documentation/rust/quick-start.rst | 2 +- Documentation/translations/zh_CN/rust/quick-start.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/rust/quick-start.rst +1 -1
@@ -314,7 +314,7 @@ definition, and other features. ``rust-analyzer`` needs a configuration file, ``rust-project.json``, which can be generated by the ``rust-analyzer`` Make target:: - make LLVM=1 rust-analyzer + make LLVM=1 prepare rust-analyzer Configuration
Documentation/translations/zh_CN/rust/quick-start.rst +1 -1
@@ -291,7 +291,7 @@ rust-analyzer ``rust-analyzer`` 需要一个配置文件, ``rust-project.json``, 它可以由 ``rust-analyzer`` Make 目标生成:: - make LLVM=1 rust-analyzer + make LLVM=1 prepare rust-analyzer 配置
Signature · 1 line
2.51.2
Documentation/rust/quick-start.rst definition, and other features. · line 317
Quoted 11 lines · Onur Özkan
Documentation/rust/quick-start.rst +1
-1@@ -314,7 +314,7 @@ definition, and other features. ``rust-analyzer`` needs a configuration file, ``rust-project.json``, which can be generated by the ``rust-analyzer`` Make target:: - make LLVM=1 rust-analyzer + make LLVM=1 prepare rust-analyzer
Perhaps we should add a brief sentence after this code block explaining why the prepare is there, e.g. adapted from the commit message:
For the best experience, it is recommended to make ``prepare`` together with the ``rust-analyzer`` target so that all generated files (e.g. proc macros) are available.
Cc'ing Tamir and Jesung.
Cheers,
Miguel
Gary Guo
reviewerQuoted 6 lines · Onur Özkan
On a fresh checkout, generating rust-project.json alone is not enough for rust-analyzer to work reliably. The issue only becomes apparent later when the LSP fails on a proc macro or binding types/functions.
Recommend running prepare together with the rust-analyzer target so the generated files expected by rust-analyzer are available from the start.
This should be fixed by marking prepare as a dependency of rust-analyzer instead.
Best,
Gary
Quoted 34 lines
Signed-off-by Onur Özkan <[email protected]>--- Documentation/rust/quick-start.rst | 2 +- Documentation/translations/zh_CN/rust/quick-start.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)Documentation/rust/quick-start.rst +1
-1@@ -314,7 +314,7 @@ definition, and other features. ``rust-analyzer`` needs a configuration file, ``rust-project.json``, which can be generated by the ``rust-analyzer`` Make target:: - make LLVM=1 rust-analyzer + make LLVM=1 prepare rust-analyzer ConfigurationDocumentation/translations/zh_CN/rust/quick-start.rst +1
-1@@ -291,7 +291,7 @@ rust-analyzer ``rust-analyzer`` 需要一个配置文件, ``rust-project.json``, 它可以由 ``rust-analyzer`` Make 目标生成:: - make LLVM=1 rust-analyzer + make LLVM=1 prepare rust-analyzer 配置
Quoted 3 lines · Gary Guo
This should be fixed by marking
prepareas a dependency ofrust-analyzerinstead.
Onur suggested that in Zulip, but it is not a real dependency (in the sense of generating the file) nor a hard one (in the sense that rust-analyzer works to some degree without a build).
I am not opposed to it to make the target about "setup rust-analyzer" rather than "just generate the file", since I think that is what most people want, but I wonder if someone out there may be already relying on generating the file without building.
Another alternative is an informational message about it as a middle ground between "just in the docs" and "not being possible to avoid part of the build" (and without introducing yet one more target, which is another option too).
Cheers,
Miguel
Gary Guo
reviewerQuoted 5 lines · Miguel Ojeda
Quoted 3 lines · Gary Guo
This should be fixed by marking
prepareas a dependency ofrust-analyzerinstead.
Quoted 8 lines
Onur suggested that in Zulip, but it is not a real dependency (in the sense of generating the file) nor a hard one (in the sense that rust-analyzer works to some degree without a build).
I am not opposed to it to make the target about "setup rust-analyzer" rather than "just generate the file", since I think that is what most people want, but I wonder if someone out there may be already relying on generating the file without building.
Well, to me I have always run it in a build directory, as it expects a .config file so I cannot run it just source tree only. Running it would also sync the config, which would invoke rustc and others already due to rustc-option, so arguably it's already running part of the build.
The only issue with "prepare" dependency is that it also builds the kernel crate. But I suppose with the new build system update this won't be necessary?
Best,
Gary
Quoted 8 lines
Another alternative is an informational message about it as a middle ground between "just in the docs" and "not being possible to avoid part of the build" (and without introducing yet one more target, which is another option too).
Cheers,
Miguel