Re: [PATCH 04/13] Kbuild: Rust support

From: Linus Torvalds
Date: Fri Apr 16 2021 - 13:05:40 EST


On Fri, Apr 16, 2021 at 6:38 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> AFAICT rust has try/throw/catch exception handling (like
> C++/Java/others) which is typically implemented with stack unwinding of
> its own.

I was assuming that the kernel side would never do that.

There's some kind of "catch_unwind()" thing that catches a Rust
"panic!" thing, but I think it's basically useless for the kernel.

Typical Rust error handling should match the regular kernel
IS_ERR/ERR_PTR/PTR_ERR model fairly well, although the syntax is
fairly different (and it's not limited to pointers).

Linus