Does Rust implement auto-threading?

I'm brand new to Rust and very excited to be learning this. I really think Rust has a lot of potential.

I'm reading through all these rules regarding ownership, borrowing, and lifetimes and it occurs to me that automatic multi-threading should be relatively easy for the rust compiler to implement, right? Am I missing something?

Does Rust implement something like this?

I'm assuming the answer is no, due to this section and it slightly being pretty new:
However, I could still see cases where you would want to explicitly spawn threads.

There are some compilers that are doing this for other languages.

Rust has no built-in auto-threading, and I'm unaware of tools that make it possible. While Rust would be a good candidate for auto-threading, it's in fact a hard and unsolved problem, not everything that is parallelizable is worth parallelizing. Here is an explanation of this for an even more parallelizable language, Haskell. Read the second paragraph. Rust has a philosophy of only implementing features that have been tried and proven elsewhere, auto-threading is not there yet.

1 Like

In addition to what @leodasvacas said, as a systems language, Rust is all about control. So "auto"-anything needs to have a high bar. For example, I could see "within this code section, please try to do as much as you can", but not for the language generally.

Rust runs in kernel contexts where you may be the one actually implementing threading!

Makes sense, I do intend to take care of parallelizing the parts that are readily parallelized and for my app considering I'll have many independent threads, it likely wouldn't see any speed up. But just curious.

It would indeed be interesting to be able to mark some code as to be autoparallized someday,though I don't see it as a priority.

LLVM which is used by Rust only sometimes autovectorize code, but this isn't autothreading.