3 ms·
I really like that in Rust the API safety is defined by the language, not by each library individually. There are no gotchas to be found in small print in the
by pornel 4y ago
I really like that in Rust the API safety is defined by the language, not by each library individually.
There are no gotchas to be found in small print in the library documentation, no disclaimers that the code is meant only for single-threaded programs, or haggling over how rare the edge cases are. If it doesn't say `unsafe`, it has to meet Rust's universal requirements for safety.
- vilunov 4y agoThat holds only for properties which are describable by the Rust's type system, including mentioned thread- and memory-safeness. Things get worse when it comes to async and futures, since RAII doesn't really work with them, and you have to consider cancellation-safeness of libraries' futures, which are noted in documentation only.
- pornel 4y agoSafety includes everything that could cause UB. Things that cannot be safely expressed are forbidden. Async too: you're not allowed to make cancellation-unsafe futures that could keep using a buffer after being dropped. This is why io_uring abstractions only work with custom buffer pools and not slices.