7 ms·
You're missing on a lot of things Rust (or any language with non-toy types) can provide. Lock ordering, better accessible complex structures, enforcement of enu
by viraptor 3y ago
You're missing on a lot of things Rust (or any language with non-toy types) can provide. Lock ordering, better accessible complex structures, enforcement of enumerated options, rich description of APIs, and many others. Atomic values are usable transparently https://github.com/AsahiLinux/linux/blob/97c628055904a7f2ef1f9318bb951b87f4cba21e/drivers/gpu/drm/asahi/queue/mod.rs#L400 https://github.com/AsahiLinux/linux/blob/97c628055904a7f2ef1... and multithreaded reference counting is easily enforced https://github.com/AsahiLinux/linux/blob/bd0a1a7d465fcb60685a2360565ed424bafff354/drivers/gpu/drm/asahi/channel.rs#L305 https://github.com/AsahiLinux/linux/blob/bd0a1a7d465fcb60685... also issues like type confusion https://www.vicarius.io/vsociety/posts/a-type-confusion-bug-in-nftseteleminit-leading-to-a-buffer-overflow https://www.vicarius.io/vsociety/posts/a-type-confusion-bug-... are less likely if you can easily use tagged unions checked by the compiler.
The best Rust can do is enforce a number of invariants which people extremely experienced in writing "trivial C" still miss every day.