Re: [PATCH] Makefile: rust-analyzer target: better error handling and comments
From: Greg KH
Date: Thu Jun 20 2024 - 04:49:32 EST
On Thu, Jun 20, 2024 at 10:31:53AM +0200, Miguel Ojeda wrote:
> On Thu, Jun 20, 2024 at 8:13 AM John Hubbard <jhubbard@xxxxxxxxxx> wrote:
> >
> > What exactly did you have in mind for how that should look? The
> > "make rustavailable" target has some leading *** and some bare
> > statements, so I'm not quite sure exactly how to lay it out:
>
> I was thinking something like:
>
> ***
> *** Rust is not available.
> ***
>
> (the `***` prefix is used also in other similar scripts and by Make itself).
>
> However, thinking about it a bit more, we should perhaps just let
> `rust_is_available.sh` tell the user why it fails, since it is likely
> the next step the user would do anyway:
>
> $ make LLVM=1 rust-analyzer
> ***
> *** Rust compiler 'rustc' is too old.
> *** Your version: 1.62.0
> *** Minimum version: 1.78.0
> ***
> ***
> *** Please see Documentation/rust/quick-start.rst for details
> *** on how to set up the Rust support.
> ***
> make[1]: *** [linux/Makefile:1973: rust-analyzer] Error 1
> make: *** [Makefile:240: __sub-make] Error 2
>
> What do you think? Then there is no need for extra output here and the
> patch becomes simpler too.
As someone who just ran into the "wait, how do I get rust to build on
this machine again?" problem, yes, having the link to the documentation
right there would be helpful. I did know where to find it, but others
might not, and it's free to add.
thanks,
greg k-h