Re: [PATCH 13/17] docs: add Rust documentation

Miguel Ojeda
2021-07-14T20:08:42Z

On Wed, Jul 14, 2021 at 8:38 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> Is rust-analyzer necessary to talk about? I think most kernel
> developers aren't using LSP clients, so it doesn't seem necessary to
> talk about for kernel development IMO. If a developer would like to
> use an LSP client, they should refer to the documentation of their LSP
> client.

I think it is fair to advertise it given we have support for
generating its configuration.

Otherwise, people might miss the script and spend time generating a
configuration by hand (which takes quite some time and would not carry
the `CONFIG_*` settings etc.).

And they may start using it if they did not hear about it! :)

> Should Documentation/process/changes.rst be updated to note which
> versions of all of these tools are currently supported?

For the ones required for building, they are already there (i.e.
`rustc` and `bindgen`).

For the rest, most come with the Rust toolchain, so I think there is
no need to list them explicitly. For `rust-analyzer`, it is "rolling",
so it does not make much sense to put it in any case.

> For the compat table, for 32b ARM, why is v6 supported but not v7? Why
> only when optimizations are enabled?

For arch support, we only have a few fixed Rust target files for the
moment as examples (thus we picked v6) -- we will generate those with
a script later on.

For particular restrictions (such as the optimization level), we will
look into solving those bits later on. In any case, it is not a
priority, since less than `-O2` is intended only for kernel hacking.

> Doesn't this also depend on rustc having support for a given target
> triple? Just because LLVM has a backend for a given architecture
> doesn't mean rustc can target it, right?

No -- currently we use custom target files instead of particular
triples (see previous point), which are basically the settings `rustc`
forwards to LLVM for codegen.

Cheers,
Miguel