this post was submitted on 21 Feb 2025
298 points (99.7% liked)

Rust

6403 readers
22 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
 

So let me be very clear: if you as a maintainer feel that you control who or what can use your code, YOU ARE WRONG.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 11 points 2 days ago (2 children)
[–] [email protected] 9 points 1 day ago* (last edited 1 day ago)

That's a performance optimisation which llvm is likely to do for you anyways, jump tables aren't exactly rocket science. Gazing into my crystal ball, might have to turn your enum variant Foo(u8) with possible values 0..15 into Foo0 through Foo15 (or maybe better Foo(EnumWith16Variants)) so that the compiler doesn't have to evaluate code to figure out that it doesn't need to NOP the rest of the jump range out, or bail out of generating a jump table, whatever it would do.

[–] [email protected] 14 points 2 days ago

But is it used in the kernel?