What is the role of Send and Sync in libcore?
Sync and Send play a big role in the thread API from the standard library. However, they are also included in libcore. Within the latter, there are a few types that implement them, but I can't find any "consumers", that is, some API that would use those traits as bounds. Do they have some special behavior/meaning that the compiler knows about? Notice that they are lang items, so they are in some way special. Sync seems to be related to statics, but the link does not go into much detail. TL;DR: if Send and Sync are about thread-safety, what role do they fulfill in libcore where there is no notion of multi-threading? What semantics does the compiler assign to them as lang items?
if Send and Sync are about thread-safety, what role do they fulfill in libcore where there is no notion of multi-threading? libcore is about setting the core concepts of the language; Send and Sync are core to the language: the compiler knows and reasons about them1. The fact that libcore does not use multi-threading itself is orthogonal and has no incidence on this choice. As an aside, do consider that just because libcore does not have multi-threading does not mean that one cannot built an alternative standard library on top of libcore that does have multi-threading. That is, after all, the purpose of separating core from std. 1 As mentioned by #kennytm in comments, Rust has a user-accessible mechanism to allow automatically propagating marker traits based on whether said traits are implemented by all a structure fields, or not. This is slightly insufficient for Send and Sync, though, as it does not support &(Trait + Send), and therefore the compiler requires special knowledge about those two, which is why they are lang items.
The compiler will crash if you declare a static variable and no Sync trait exists. After all, just because we don't have libstd's implementation of threads in play doesn't mean there's no concurrent access going on (if you're bare metal, you probably have interrupt handlers to worry about). So, for static variables to be safe, the compiler needs to know if the static variable can be safely accessed concurrently or not.
How to represent shared mutable state?
Convert String to SocketAddr
Why is a Cell used to create unmovable objects?
“entry point could not be located” when running program on Windows
Does dereference equal to a function call?
Should I use Rust 1.0-alpha or the nightly version?
How to do a binary search on a Vec of floats?
Having a child modify its parent
How do I access the data sent over UDP?
How to idiomatically copy a slice?
Recursive types and arrays
Can I determine the zero value of generic types?
How to slice a large Vec<i32> as &[u8]?
How to parse i64 from a string? [duplicate]
Why is variable scope dependent on the definition order?
Warning on “unstable” directive