News for hackers. Stuff that matters.
Re:Announcing Rust 1.20 by jandrese on Thursday August 31, 2017 @02:47PM (#15142755)
Isn't all data (outside of unsafe blocks) in Rust already threadsafe? Isn't that one of the big selling points of the language?
Re:Announcing Rust 1.20 by wahern on Thursday August 31, 2017 @03:38PM (#15143215)
Rust isn't inherently thread-safe; not like in the way Java is thread-safe because of how the JVM's memory model is defined.

Rust makes it really difficult to share mutable data. But once you do that, such as by smuggling a pointer _through_ an unsafe block, all bets are off, even for code outside an unsafe block.

Also, as with Java there will always be bugs in the compiler and runtime. Rust programs were susceptible to StackClash just as much as C applications.

No matter what language you use, if you minimize shared mutable data you'll minimize thread-safety issues.

Re:Announcing Rust 1.20 by CrystalGamma on Thursday August 31, 2017 @03:56PM (#15143361)
If you use a C FFI in any language, including Java, all kinds of safety are off. Unsafe Rust is equivalent to C (with a lot of mandatory lints) in terms of safety, so Rust is not really less safe.
Re:Announcing Rust 1.20 by alphaalpha101 on Friday September 01, 2017 @02:39AM (#15146616)
Not necessarily. There is no actual reason that you couldn't be required to prove to the compiler that your code is safe.

That proof might be parameterised by a proof that some external FFI function was safe, which you might not be able to actually prove and have to assume, but then you would have your assumptions well-documented.

As it is, you have to justify the safety of your unsafe blocks to other programmers using comments, which kind of sucks.

Still better than every other fast language in this area though so I can't complain much.

Re:Announcing Rust 1.20 by jandrese on Thursday August 31, 2017 @04:02PM (#15143418)
I get that all bets are off once an unsafe() block is in play, but in the intended use case it seems like it should be safe.
Re:Announcing Rust 1.20 by kibwen on Thursday August 31, 2017 @04:15PM (#15143524)
You are correct there. Though we can quibble over the definition of "thread safety", concurrent memory safety is a subset of memory safety, which safe Rust enforces (or at least intends to enforce, modulo bugs).
Re:Announcing Rust 1.20 by steveklabnik on Thursday August 31, 2017 @03:49PM (#15143301)
It is data-race free. That's one definition of "threadsafe", but there could be others; it's a pretty broad term.