Re: [TECH TOPIC] Rust for Linux

Sasha Levin
2021-07-06T15:03:30Z

On Tue, Jul 06, 2021 at 04:30:06PM +0200, Miguel Ojeda wrote:
>On Tue, Jul 6, 2021 at 11:55 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>>
>> AFAIU the idea is to replace an entire piece of code in C with the
>> same piece in Rust, it's not like we are going to develop a second
>> kernel in Rust inside the kernel in C. So both/and not either/or.
>> I.e. you have to compile some pieces of the kernel written in
>> Rust to even get to a working kernel.
>
>Let me clarify this, since it is important: no, we are not replacing C
>code In fact, the Rust side is based on the C one.
>
>But that does not mean we are not rewriting a second kernel either --
>for instance, we have red-black trees "abstracted" in the Rust side by
>reusing C's API.
>
>In other words, what we are doing is "abstract" the C APIs into Rust
>APIs that can ensure as many invariants as possible statically, using
>Rust facilities for that. Thus Rust is one more consumer of the C
>APIs.

Does this mean that anyone who wishes to modify these C APIs must also
know Rust to fix up those abstractions too?

--
Thanks,
Sasha