Rust types have markers (Send, Sync) that tell the compiler whether they can be moved across threads, and whether they can be simultaneously accessed across threads.
These markers are irrelevant in a single-threaded scenario.
These markers are irrelevant in a single-threaded scenario.
I’ve googled everywhere but I can’t find a single source of information that completely explains this, possibly showing realistic source code and elaborating the way it could generate memory errors or be miscompiled in case of multiple mutable references.
The TL;DR is: iterator invalidation can happen even without threads.
Another example is if someone tried to use a Vec x inside the closure passed to x.drain.
> doesn’t Rust refuse to compile even when you use non-concurrency safe objects in a single thread?
and given that most types (Vec, HashMap, etc.) aren't "concurrency-safe" (thread-safe?), your answer
> yes
is rather perplexing.