3 ms·
> What sets it apart from other modern languages is that it does not have a garbage collector or runtime system of any kind. This is not strictly true. Most Ru
by davidhyde 7y ago
> What sets it apart from other modern languages is that it does not have a garbage collector or runtime system of any kind.
This is not strictly true. Most Rust programs, like most c programs, do have a runtime. See https://doc.rust-lang.org/0.12.0/guide-runtime.html https://doc.rust-lang.org/0.12.0/guide-runtime.html
However, this runtime can be replaced which is what makes Rust suitable for certain systems programming scenarios (like building operating system kernels). This is the realm of [no_std]
- Arnavion 7y ago>Most Rust programs, like most c programs, do have a runtime. See https://doc.rust-lang.org/0.12.0/guide-runtime.html https://doc.rust-lang.org/0.12.0/guide-runtime.html You've linked to the docs of a release from 2014, back when Rust did have a runtime. (Unfortunately it's very easy to get results for ancient Rust releases from search engines. Similarly there are three different versions of the Rust book and many of the search results are for the oldest one.) >However, this runtime can be replaced which is what makes Rust suitable for certain systems programming scenarios (like building operating system kernels). This is the realm of [no_std] What `no_std` allows you to do is not use libstd, ie the standard library. libstd is certainly a "runtime" in the sense that libc is the C runtime, but it doesn't mean it enforces green threading or garbage collection like the word "runtime" evokes for other languages and is used in the page you linked. This latter meaning is also what the sentence in the TFA was using.
- roblabla 7y agoYou're linking to an old version of the rust documentation from before it was even 1.0.0. Rust used to have a runtime before 1.0.0 to implement green threading. But this is not the case anymore. Rust can be entirely statically linked into a self-contained library that has no runtime requirements whatsoever.
- steveklabnik 7y agoI think you're being downvoted a bit unfairly. 1. Your link is incorrect, as the sibling comments say, but you're also correct that Rust has a runtime. It's about the same amount of runtime as C, but like C (as you say), it does exist. 2. no_std does not remove the runtime. I think the closest you can get is no_core, but to be honest, I'm not actually 100% sure.
- deleted 7y ago[deleted]