r/rust • • Aug 29 '24

One Of The Rust Linux Kernel Maintainers Steps Down - Cites "Nontechnical Nonsense"

https://www.phoronix.com/news/Rust-Linux-Maintainer-Step-Down
586 Upvotes

374 comments sorted by

View all comments

Show parent comments

10

u/ConvenientOcelot Aug 29 '24

What extra control does Zig allow you that Rust + unsafe does not?

-7

u/el_muchacho Aug 29 '24

Say for example @returnAdress returns the address of the next machine code instruction that will be executed when a function returns.

@prefetch tells the compiler to emit a prefetch instruction supported by the target CPU.

These asm level instructions, but still slightly more portable than going down to machine code. We are in fact lower level than C itself. It's not necessarily portable, but when it's supported, it can prove useful for optimization.

11

u/Plasma_000 Aug 29 '24 edited Aug 29 '24

Prefetch is present as a rust intrinsic also, so definitely doable. Return address isn't present, though I struggle to think of any example where I would need it and not be writing assembly anyway...

Edit: turns out you can just use an llvm intrinsic to get the return address in a portable way.