Skip to content

Commit 6dc9d9c

Browse files
johnhubbardojeda
authored andcommitted
kbuild: rust-analyzer: better error handling
1) Provide a better error message for the "Rust not available" case. Without this patch, one gets various misleading messages, such as: "No rule to make target 'rust-analyzer'" Instead, run scripts/rust_is_available.sh directly, as a prerequisite, and let that script report the cause of any problems, as well as providing a link to the documentation. Thanks to Miguel Ojeda for the idea of just letting rust_is_available.sh report its results directly. The new output in the failure case looks like this: $ make rust-analyzer *** *** Rust compiler 'rustc' could not be found. *** *** *** Please see Documentation/rust/quick-start.rst for details *** on how to set up the Rust support. *** make[1]: *** [/kernel_work/linux-github/Makefile:1975: rust-analyzer] Error 1 make: *** [Makefile:240: __sub-make] Error 2 Reviewed-by: Finn Behrens <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Tested-by: Alice Ryhl <[email protected]> Signed-off-by: John Hubbard <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Reworded title. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent b63c455 commit 6dc9d9c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,7 @@ tags TAGS cscope gtags: FORCE
19691969
# IDE support targets
19701970
PHONY += rust-analyzer
19711971
rust-analyzer:
1972+
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh
19721973
$(Q)$(MAKE) $(build)=rust $@
19731974

19741975
# Script to generate missing namespace dependencies

0 commit comments

Comments
 (0)