Also, if the perceived problem is that the Rust ecosystem is worse off for the amount of unsafe code in actix-web then forking isn't a rational solution.
Unsafe code in a popular library might be a bad thing for the ecosystem. Unsafe code in a popular library plus a warring fork is not likely to be any better.
Unsafe code is not the core of the problem, the language was designed with this feature for a reason. Even the standard library use unsafe, so nearly every Rust program contain parts of unsafe code.
The point is the unsafe code should be carefully used in safe abstractions to reduce the use to the maximum and the abstraction used by the actix maintainer were leaking.
It kind of has to, because someone has to interact with the OS and libc, and that can't be done in safe Rust. So it doesn't work as an example of the validity of unsafe code.
From what I've read, it seems a lot of the unsafe stuff that people use in Rust tend to be related more to performance than to actually being impossible in safe Rust.
Unsafe rust is not only used for interacting outside of rust. It is used all over the place for performance reasons that safe rust can’t know are actually fine. There’s over 1600 hits to unsafe in rust. FAR from all of those are interacting with the OS.
It’s slightly strange to me that rust doesn’t percolate up “unsafe” to the type so that the call sites know they are using unsafe code and all higher up functions know it as well. This would be similar in spirit to the IO monad from Haskell. I feel this could lead people to have a gauge on how much code they depend on is unsafe and in which circumstances.
Because then literally everything would be unsafe. At some point you have to have some unsafe code in order to interact with the system because the compiler cannot prove that the system will do as advertised.
Sorry for the late reply: the point of an unsafe block is to say "this is the correct level of abstraction at which to reason to prove that this operation is safe". It's not in the type because it wouldn't be composable; the idea is to build safe abstractions from unsafe operations. Once the safe abstraction is built you treat it as such.
Also, if the perceived problem is that the Rust ecosystem is worse off for the amount of unsafe code in actix-web then forking isn't a rational solution.
I think people who submit PRs and patches want the code, but also the author, to "better" from the submitter's perspective. Rejecting PRs is very fundamental form of disagreement I'm not sure most developers are equipped to handle.
So maybe wanting that fix is kind of undermining some of the freedom open source usually aims for. And the result may be that the freedom to reject PRs is more valuable than a single PR. And then you would not want the fix.
Security-minded people aren't investing their time and efforts into actix-web because of how deep in its DNA this anti-security mindset goes. From this point of view, actix-web is best understood as an attractive nuisance that could come to taint the wider Rust ecosystem by association.
So no language with an FFI, then? Or really, no language that compiles to a lower-level langues with less type safety, or interpreted by an interpreter written in a less safe language. Well, shit, that rules out all programs.
If you want safe code, someone at some point has to implement it in terms of unsafe code. Forbidding any kind of unsafe code in the language just means the only people who can implement features that require unsafe code are the maintainers of the language toolchain itself, which is how you end up with a language like JavaScript (as implemented in browsers) whose capabilities are severely crippled compared to just about any other language. Given the niche JavaScript fills, the limitations are reasonable, but most people want a language that allows them access to the full set of capabilities provided by their platform.
75
u/SirClueless Jan 17 '20
Also, if the perceived problem is that the Rust ecosystem is worse off for the amount of unsafe code in
actix-webthen forking isn't a rational solution.Unsafe code in a popular library might be a bad thing for the ecosystem. Unsafe code in a popular library plus a warring fork is not likely to be any better.