| ▲ | drnick1 7 hours ago |
| Every system under the Sun has a C compiler. This isn't remotely true for Rust. Rust is more modern than C, but has it's own issues, among others very slow compilation times. My guess is that C will be around long after people will have moved on from Rust to another newfangled alternative. |
|
| ▲ | jcranmer 7 hours ago | parent | next [-] |
| There is a set of languages which are essentially required to be available on any viable system. At present, these are probably C, C++, Perl, Python, Java, and Bash (with a degree of asterisks on the last two). Rust I don't think has made it through that door yet, but on current trends, it's at the threshold and will almost certainly step through. Leaving this set of mandatory languages is difficult (I think Fortran, and BASIC-with-an-asterisk, are the only languages to really have done so), and Perl is the only one I would risk money on departing in my lifetime. I do firmly expect that we're less than a decade out from seeing some reference algorithm be implemented in Rust rather than C, probably a cryptographic algorithm or a media codec. Although you might argue that the egg library for e-graphs already qualifies. |
| |
| ▲ | account42 an hour ago | parent | next [-] | | Java hasn't ever been essential outside enterprise-y servers and those don't care about "any viable system". | |
| ▲ | qalmakka 4 hours ago | parent | prev | next [-] | | We're already at the point where in order to have a "decent" desktop software experience you _need_ Rust too. For instance, Rust doesn't support some niche architectures because LLVM doesn't support them (those architectures are now exceedingly rare) and this means no Firefox for instance. | |
| ▲ | tormeh 4 hours ago | parent | prev | next [-] | | A system only needs one programming language to be useful, and when there's only one it's basically always C. | | |
| ▲ | an hour ago | parent | next [-] | | [deleted] | |
| ▲ | trinix912 3 hours ago | parent | prev [-] | | A C compiler is also relatively easy to implement (compared to a Rust compiler) if you're making your own hobby OS with its own C compiler and libc. |
| |
| ▲ | eru an hour ago | parent | prev | next [-] | | > Rust I don't think has made it through that door yet, but on current trends, it's at the threshold and will almost certainly step through. I suspect what we are going to see isn't so much Rust making it through that door, but LLVM. Rust and friends will come along for the ride. | |
| ▲ | bmicraft an hour ago | parent | prev | next [-] | | Removing Java from my desktop Arch system only prompts to remove two gui apps I barely use. I could do it right now and not notice for months. | |
| ▲ | teruakohatu 2 hours ago | parent | prev | next [-] | | > There is a set of languages which are essentially required to be available on any viable system. At present, these are probably C, C++, Perl, Python, Java, and Bash Java, really? I don’t think Java has been essential for a long time. Is Perl still critical? | | | |
| ▲ | oblio 2 hours ago | parent | prev | next [-] | | Even Perl... It's not in POSIX (I'm fairly sure) and I can't imagine there is some critical utility written in Perl that can't be rewritten in Python or something else (and probably already has been). As much as I like Java, Java is also not critical for OS utilities. Bash shouldn't be, per se, but a lot of scripts are actually Bash scripts, not POSIX shell scripts and there usually isn't much appetite for rewriting them. | |
| ▲ | jfjfnfjrh 2 hours ago | parent | prev | next [-] | | Debian and Ubuntu enter the chat..... | |
| ▲ | pantalaimon 2 hours ago | parent | prev [-] | | I don't think Perl comes pre installed on any modern system anymore | | |
| ▲ | pjmlp 2 hours ago | parent [-] | | I am yet to find one without it, unless you include Windows, consoles, or table/phone OSes, embedded RTOS, which aren't anyway proper UNIX derivatives. | | |
| ▲ | bmacho an hour ago | parent [-] | | According to the internet (can't check now) Alpine doesn't come with perl installed. | | |
|
|
|
|
| ▲ | brokencode 7 hours ago | parent | prev | next [-] |
| What other newfangled alternative to C was ever adopted in the Linux kernel? I have no doubt C will be around for a long time, but I think Rust also has a lot of staying power and won’t soon be replaced. |
| |
| ▲ | ottah 6 hours ago | parent [-] | | I wouldn't be surprised to see zig in the kernel at some point | | |
| ▲ | eru an hour ago | parent | next [-] | | I would be. Mostly because while Zig is better than C, it doesn't really provide all that much benefit, if you already have Rust. | |
| ▲ | littlestymaar 5 hours ago | parent | prev [-] | | IMHO Zig doesn't bring enough value of its own to be worth bearing the cost of another language in the kernel. Rust is different because it both: - significantly improve the security of the kernel by removing the nastiest class of security vulnerabilities. - And reduce cognitive burden for contributors by allowing to encode in thr typesystem the invariants that must be upheld. That doesn't mean Zig is a bad language for a particular project, just that it's not worth adding to an already massive project like the Linux kernel. (Especially a project that already have two languages, C and now Rust). | | |
| ▲ | sayamqazi 5 hours ago | parent | next [-] | | Pardon my ignorance but I find the claim "removing the nastiest cla ss of security vulnerabilities" to be a bold claim. Is there ZERO use of "unsafe" rust in kernel code?? | | |
| ▲ | vlovich123 4 hours ago | parent | next [-] | | Aside from the minimal use of unsafe being heavily audited and the only entry point for those vulnerabilities, it allows for expressing kernel rules explicitly and structurally whereas at best there was a code comment somewhere on how to use the API correctly. This was true because there was discussion precisely about how to implement Rust wrappers for certain APIs because it was ambiguous how those APIs were intended to work. So aside from being like 1-5% unsafe code vs 100% unsafe for C, it’s also more difficult to misuse existing abstractions than it was in the kernel (not to mention that in addition to memory safety you also get all sorts of thread safety protections). In essence it’s about an order of magnitude fewer defects of the kind that are particularly exploitable (based on research in other projects like Android) | |
| ▲ | bmicraft an hour ago | parent | prev | next [-] | | "Unsafe" rust still upholds more guarantees than C code. The rust compiler still enforces the borrow checker (including aliasing rules) and type system. | |
| ▲ | bonzini 4 hours ago | parent | prev | next [-] | | You can absolutely write drivers with zero unsafe Rust. The bridge from Rust to C is where unsafe code lies. | |
| ▲ | Ygg2 42 minutes ago | parent | prev | next [-] | | It removes a class of security vulnerabilities, modulo any unsound unsafe (in compiler, std/core and added dependency). In practice you see several orders of magnitude fewer segfaults (like in Google Android CVE). You can compare Deno and Bun issue trackers for segfaults to see it in action. As mentioned a billion times, seatbelts don't prevent death, but they do reduce the likelihood of dying in a traffic accident. Unsafe isn't a magic bullet, but it's a decent caliber round. | |
| ▲ | littlestymaar 4 hours ago | parent | prev [-] | | Not zero, but Rust-based kernels (see redox, hubris, asterinas, or blog_os) have demonstrated that you only need a small fraction of unsafe code to make a kernel (3-10%) and it's also the least likely places to make a memory-related error in a C-based kernel in the first place (you're more likely to make a memory-related error when working on the implementation of an otherwise challenging algorithm that has nothing to do with memory management itself, than you are when you are explicitly focused on the memory-management part). So while there could definitely be an exploitable memory bug in the unsafe part of the kernel, expect those to be at least two orders of magnitude less frequent than with C (as an anecdotal evidence, the Android team found memory defects to be between 3 and 4 orders of magnitude less in practice over the past few years). |
| |
| ▲ | brabel 4 hours ago | parent | prev [-] | | Zig as a language is not worth, but as a build system it's amazing. I wouldn't be surprised if Zig gets in just because of the much better build system than C ever had (you can cross compile not only across OS, but also across architecture and C stlib versions, including musl). And with that comes the testing system and seamless interop with C, which make it really easy to start writing some auxiliary code in Zig... and eventually it may just be accepted for any development. | | |
| ▲ | littlestymaar an hour ago | parent [-] | | I agree with you that it's much more interesting than the language, but I don't think it matters for a project like the Kernel that already had its build system sorted out. (Especially since no matter how nice and convenient Zig makes cross-compilation if you start a project from scratch, even in Rust thanks to cargo-zigbuild, it would require a lot of efforts to migrate the Linux build system to Zig, only to realize it doesn't support all the needs of the kernel at the start). |
|
|
|
|
|
| ▲ | pjmlp 2 hours ago | parent | prev | next [-] |
| As mentioned in another thread, POSIX requires the presence of a C compiler, https://pubs.opengroup.org/onlinepubs/9799919799/utilities/c... |
| |
| ▲ | eru an hour ago | parent [-] | | Though to be fair, POSIX is increasingly outdated. | | |
| ▲ | pjmlp an hour ago | parent [-] | | GNU/Linux isn't the only system out there, POSIX last update was in 2024 (when C requirement got upgraded to C17), and yes some parts of it are outdated in modern platforms, especially Apple, Google, Microsoft OSes and Cloud infrastructure. Still, who supports POSIX is expected to have a C compiler available if applying for the OpenGroup stamp. |
|
|
|
| ▲ | vlovich123 7 hours ago | parent | prev | next [-] |
| I can’t think of many real world production systems which don’t have a rust target. Also I’m hopeful the GCC backend for rustc makes some progress and can become an option for the more esoteric ones |
| |
| ▲ | phire 6 hours ago | parent | next [-] | | There aren't really any "systems programming" platforms anywhere near production that doesn't have a workable rust target. It's "embedded programming" where you often start to run into weird platforms (or sub-platforms) that only have a c compiler, or the rust compiler that does exist is somewhat borderline. We are sometimes talking about devices which don't even have a gcc port (or the port is based on a very old version of gcc).
Which is a shame, because IMO, rust actually excels as an embedded programming language. Linux is a bit marginal, as it crosses the boundary and is often used as a kernel for embedded devices (especially ones that need to do networking). The 68k people have been hit quite hard by this, linux on 68k is still a semi-common usecase, and while there is a prototype rust back end, it's still not production ready. | | |
| ▲ | vlovich123 5 hours ago | parent [-] | | There’s also I believe an effort to target C as the mid level although I don’t know the state / how well it’ll work in an embedded space anyway where performance really matters and these compilers have super old optimizers that haven’t been updated in 3 decades. |
| |
| ▲ | MobiusHorizons 6 hours ago | parent | prev | next [-] | | It's mostly embedded / microcontroller stuff. Things that you would use something like SDCC or a vendor toolchain for. Things like the 8051, stm8, PIC or oddball things like the 4 cent Padauk micros everyone was raving about a few years ago. 8051 especially still seems to come up from time to time in things like the ch554 usb controller, or some NRF 2.4ghz wireless chips. | | |
| ▲ | vlovich123 5 hours ago | parent [-] | | Those don’t really support C in any real stretch, talking about general experience with microcontrollers and closed vendor toolchains; it’s a frozen dialect of C from decades ago which isn’t what people think of when they say C (usually people mean at least the 26 year old C99 standard but these often at best support C89 or even come with their own limitations) |
| |
| ▲ | pjmlp 2 hours ago | parent | prev [-] | | Commercial embedded OSes, game consoles, for example. | | |
| ▲ | vlovich123 42 minutes ago | parent [-] | | Seems like game consoles for example has been accomplished by at least one dedicated team even if the vendor nor upstream provide official support: https://www.reddit.com/r/rust/comments/78bowa/hey_this_is_ky... I’m sure if Rust becomes more popular in the game dev community, game consoles support will be a solved problem since these consoles are generally just running stock PC architectures with a normal OS and there’s probably almost nothing wrong with the stock toolchain in terms of generating working binaries: PlayStation and Switch are FreeBSD (x86 vs ARM respectively) and Xbox is x86 Windows, all of which are supported platforms. | | |
| ▲ | pjmlp 13 minutes ago | parent | next [-] | | Being supported on a games console means that you can produce binaries that are able to go through the whole approval process, and there is day 1 support for anything that is provided by the console vendor. Otherwise is yak shaving instead of working on the actual game code. Some people like to do that, that is how new languages like Rust get adoption, however they are usually not the majority, hence why mainstream adoption without backing from killer projects or companies support is so hard, and very few make it. Also you will seldom see anyone throw away the confort of Unreal, Unity or even Godot tooling, to use Rust instead, unless they are more focused on proving the point the game can be made in Rust, than the actual game design experience. | |
| ▲ | bob1029 3 minutes ago | parent | prev [-] | | > Switch Good luck shipping arbitrary binaries to this target. The most productive way for an indie to ship to Nintendo in 2025 is to create the game Unity and build via the special Nintendo version of the toolchain. How long do we think it would take to fully penetrate all of these pipeline stages with rust? Particularly Nintendo, who famously adopts the latest technology trends on day 1. Do we think it's even worthwhile to create, locate, awaken and then fight this dragon? C# with incremental GC seems to be more than sufficient for a vast majority of titles today. |
|
|
|
|
| ▲ | thayne 7 hours ago | parent | prev | next [-] |
| > very slow compilation times That isn't always the case. Slow compilations are usually because of procedural macros and/or heavy use of generics. And even then compile times are often comparable to languages like typescript and scala. |
| |
| ▲ | timow1337 17 minutes ago | parent | next [-] | | Compared to C, rust compiles much slower. This might not matter on performant systems, but when resources are constrained you definitely notice it.
And if the whole world is rewritten in Rust, this will have a non-significant impact on the total build time of a bunch of projects. | |
| ▲ | Yiin 4 hours ago | parent | prev [-] | | typescript transpilation to js is nearly instant, it's not comparable | | |
| ▲ | baq 2 hours ago | parent [-] | | Good to know, my $DAYJOB project unfortunately isn’t as well informed and we have to use esbuild just to survive. |
|
|
|
| ▲ | blintz 6 hours ago | parent | prev | next [-] |
| Doesn’t rustc emit LLVM IR? Are there a lot of systems that LLVM doesn’t support? |
| |
| ▲ | loeg 4 hours ago | parent | next [-] | | There are a number of oddball platforms LLVM doesn't support, yeah. | |
| ▲ | aw1621107 5 hours ago | parent | prev | next [-] | | rustc can use a few different backends. By my understanding, the LLVM backend is fully supported, the Cranelift backend is either fully supported or nearly so, and there's a GCC backend in the works. In addition, there's a separate project to create an independent Rust frontend as part of GCC. Even then, there are still some systems that will support C but won't support Rust any time soon. Systems with old compilers/compiler forks, systems with unusual data types which violate Rust's assumptions (like 8 bit bytes IIRC) | |
| ▲ | einpoklum 3 hours ago | parent | prev [-] | | Many organizations and environments will not switch themselves to LLVM to hamfist compiled Rust code. Nor is the fact of LLVM supporting something in principle means that it's installed on the relevant OS distribution. | | |
| ▲ | simonask an hour ago | parent | next [-] | | Using LLVM somewhere in the build doesn't require that you compile everything with LLVM. It generates object files, just like GCC, and you can link together object files compiled with each compiler, as long as they don't use compiler-specific runtime libraries (like the C++ standard library, or a polyfill compiler-rt library). `clang-cl` does this with `cl.exe` on Windows. | |
| ▲ | oblio an hour ago | parent | prev [-] | | If you're developing, you generally have control over the development environment (+/-) and you can install things. Plus that already reduces the audience: set of people with oddball hardware (as someone here put it) intersected with the set of people with locked down development environments. Let alone the fact that conceptually people with locked down environments are precisely those would really want the extra safety offered by Rust. I know that real life is messy but if we don't keep pressing, nothing improves. |
|
|
|
| ▲ | AceJohnny2 3 hours ago | parent | prev | next [-] |
| > My guess is that C will be around long after people will have moved on from Rust to another newfangled alternative. if only due to the Lindy Effect https://en.wikipedia.org/wiki/Lindy_effect |
|
| ▲ | mustache_kimono 5 hours ago | parent | prev [-] |
| > Every system under the Sun has a C compiler... My guess is that C will be around long after people will have moved on from Rust to another newfangled alternative. This is still the worst possible argument for C. If C persists in places no one uses, then who cares? |
| |
| ▲ | jazzyjackson 5 hours ago | parent | next [-] | | I think you didn't catch their drift C will continue to be used because it always has been and always will be available everywhere, not only places no one uses :/ | | |
| ▲ | mustache_kimono 4 hours ago | parent | next [-] | | > C will continue to be used because it always has been and always will be available everywhere Yes, you can use it everywhere. Is that what you consider a success? | | |
| ▲ | mrweasel 2 hours ago | parent | next [-] | | I'm curious as to which other metric you'd use to define successful? If it actual usage, C still wins. Number of new lines pushed into production each year, or new project started, C is still high up the list, would be my guess. Languages like Rust a probably more successful in terms of age vs. adoption speed. There's just a good number of platforms which aren't even supported, and where you have no other choice than C. Rust can't target most platforms, and it compiles on even less. Unless Linux want's to drop support for a good number of platforms, Rust adoption can only go so far. | |
| ▲ | AceJohnny2 3 hours ago | parent | prev [-] | | ... yes? |
| |
| ▲ | bigyabai 3 hours ago | parent | prev [-] | | > it always has been and always will be available everywhere "Always has been" is pushing it. Half of C's history is written with outdated, proprietary compilers that died alongside their architecture. It's easy to take modern tech like LLVM for granted. | | |
| ▲ | baq 2 hours ago | parent [-] | | This might actually be a solved problem soonish, LLMs are unreasonably effective at writing compilers and C is designed to be easy to write a compiler for, which also helps. I don’t know if anyone tried, but there’s been related work posted here on HN recently: a revived Java compiler and the N64 decompilation project. Mashed together you can almost expect to be able to generate C compilers for obscure architectures on demand given just some docs and binary firmware dumps. |
|
| |
| ▲ | johncolanduoni 4 hours ago | parent | prev [-] | | You almost certainly have a bunch of devices containing a microcontroller that runs an architecture not targeted by LLVM. The embedded space is still incredibly fragmented. That said, only a handful of those architectures are actually so weird that they would be hard to write a LLVM backend for. I understand why the project hasn’t established a stable backend plugin API, but it would help support these ancillary architectures that nobody wants to have to actively maintain as part of the LLVM project. Right now, you usually need to use a fork of the whole LLVM project when using experimental backends. | | |
| ▲ | mustache_kimono 4 hours ago | parent [-] | | > You almost certainly have a bunch of devices containing a microcontroller that runs an architecture not targeted by LLVM. This is exactly what I'm saying. Do you think HW drives SW or the other way around? When Rust is in the Linux kernel, my guess is it will be very hard to find new HW worth using, which doesn't have some Rust support. | | |
| ▲ | johncolanduoni an hour ago | parent [-] | | In embedded, HW drives SW much more than the other way around. Most microcontrollers are not capable of running a Linux kernel as it is, even with NoMMU. The ones that are capable of this are overwhelmingly ARM or RISC-V these days. There’s not a long list of architectures supported by the modern Linux kernel but not LLVM/Rust. |
|
|
|