Re: [PATCH] rust: Add PowerPC support

Alice Ryhl
2026-02-04T13:36:53Z

On Wed, Feb 04, 2026 at 02:06:53PM +0100, Peter Zijlstra wrote:
> On Wed, Feb 04, 2026 at 12:55:17PM +0000, Alice Ryhl wrote:
>
> > Is there any reason to not make it Rust-only but for all Rust code?
> > Making the / operator work seems like it would be a good idea.
>
> Why would it be a good idea to have it work on non-native types in Rust?
>
> The reason we don't have them in C is because non-native divisions are
> expensive and doing them should be a conscious choice. The very same
> argument should be true for Rust code too.

I suppose that's fair. Perhaps one way to go about it could be to create
a clippy lint for 64-bit divisions telling you to use an explicit
division method?

This way cases such as `core` that use division can still use the slash
operator because the lint is not enabled when building core. And normal
kernel code would be told to use the explicit method instead. Or kernel
code could explicitly choose to silence the lint on a specific method if
they want to perform a lot of divisions and know what they are doing.

Alice