Re: [PATCH v2 1/2] Makefile: rust-analyzer target: better error handling

From: Alice Ryhl
Date: Wed Jun 26 2024 - 04:00:41 EST


On Thu, Jun 20, 2024 at 10:55 PM John Hubbard <jhubbard@xxxxxxxxxx> wrote:
>
> 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
>
> Cc: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> Acked-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
> Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Tested-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>