Settings

Theme

Rust in the kernel is no longer experimental

lwn.net

957 points by rascul 5 days ago · 843 comments

Reader

weinzierl 4 days ago

That is so good to hear. I feel Rust support came a long way in the past two years and you can do a functional Rust kernel module now with almost no boilerplate.

Removing the "experimental" tag is certainly a milestone to celebrate.

I'm looking forward to distros shipping a default kernel with Rust support enabled. That, to me, will be the real point of no return, where Rust is so prevalent that there will be no going back to a C only Linux.

  • pta2002 4 days ago

    A few distros already do that. Of the top of my head, both NixOS and Arch enable the QR code kernel panic screen, which is written in Rust. Granted, those are rather bleeding edge, but I know a few more traditional distros have that enabled (I _think_ fedora has it? But not sure).

    • embedding-shape 4 days ago

      > both NixOS and Arch enable the QR code kernel panic screen

      Interesting, I use both (NixOS on servers, Arch for desktop) and never seen that. Seems you're referring to this: https://rust-for-linux.com/drm-panic-qr-code-generator (which looks like this: https://github.com/kdj0c/panic_report/issues/1)

      Too bad NixOS and Arch is so stable I can't remember the last time any full system straight up panicked.

      • pta2002 4 days ago

        Yep, that's what I'm referring to.

        For now there aren't many popular drivers that use Rust, but there are currently 3 in-development GPU drivers that use it, and I suspect that when those get merged that'll be the real point of no return:

        - Asahi Linux's driver for Apple GPUs - https://rust-for-linux.com/apple-agx-gpu-driver

        - The Nova GPU driver for NVIDIA GPUs - https://rust-for-linux.com/nova-gpu-driver

        - The Tyr GPU driver for Arm Mali GPUs - https://rust-for-linux.com/tyr-gpu-driver

        I suspect the first one of those to be actually used in production will be the Tyr driver, especially since Google's part of it and they'll probably want to deploy it on Android, but for the desktop (and server!) Linux use-case, the Nova driver is likely to be the major one.

        • jabl 4 days ago

          I believe Google has developed a Rust implementation of the binder driver which was recently merged, and they are apparently planning to remove the original C implementation. Considering binder is essential for Android that would be a major step too.

        • jackokring 4 days ago

          I can confirm that the ChromeOS debian container now has defaulted to turn off GPU acceleration, perhaps to turn on other acceleration on this Mali.

      • stusmall 4 days ago

        You can force a panic with echo c | /proc/sysrq-trigger

      • krick 3 days ago

        This is so cool! I love things like that, it feels like fresh air after years and years of anachronistic retro-vibes that seem to be a part of C-programming culture.

      • udev4096 4 days ago

        Arch never failed me. The only time I remember it panicked was when I naively stopped an upgrade in the middle which failed to generate initramfs but quickly fixed it by chroot'ing and running mkinitcpio. Back up in no time

  • tremon 4 days ago

    > I'm looking forward to distros shipping a default kernel with Rust support enabled

    What does this mean? The kernel has no specific support for Rust userspace -- the syscall API does not suddenly change because some parts of the kernel are compiled with rustc.

    • steveklabnik 4 days ago

      They aren’t talking about userspace.

      As I understand it, the kernel has a flag, no by default, to enable building rust code as part of the kernel. They’re saying they’d like to see a distributed choosing to default this flag to yes for the kernels they build.

  • GuB-42 4 days ago

    Will it be possible until Rust gets full GCC support, with all its platforms?

  • mos87 2 days ago

    This is genuinely funny. In a dark way but still made me chuckle. Thanks.

  • EMM_386 4 days ago

    I think Fedora 43 is compiled with CONFIG_RUST=y.

N_Lens 4 days ago

After all the resistance to Rust in the Linux Kernel, it's finally official. Kudos to the Linux Rust team!

  • trueno 4 days ago

    wasn't there like a drive by maintainer rejection of something rust related that kind of disrupted the asahi project ? i can't say i followed the developments much but i do recall it being some of that classic linux kernel on broadway theater. i also wonder if that was a first domino falling of sorts for asahi, i legitimately can't tell if that project lives on anymore

    • iurbwdj 4 days ago

      It involved large parts of the Rust community, and the famous Rust developer Hector Martin (with an alter ego of Asahi Lina, a female vtuber, which he appears irrationally embarrassed about), harassing others.

      Even Linus Torvalds called out Hector Martin.

      https://lkml.org/lkml/2025/2/6/1292

      > On Thu, 6 Feb 2025 at 01:19, Hector Martin <marcan@marcan.st> wrote:

      > > If shaming on social media does not work, then tell me what does, because I'm out of ideas.

      > How about you accept the fact that maybe the problem is you.

      > You think you know better. But the current process works.

      > It has problems, but problems are a fact of life. There is no perfect.

      > However, I will say that the social media brigading just makes me not want to have anything at all to do with your approach.

      > Because if we have issues in the kernel development model, then social media sure as hell isn't the solution. The same way it sure as hell wasn't the solution to politics.

      > Technical patches and discussions matter. Social media brigading - no than\k you.

      > Linus

      https://archive.md/uLiWX

      https://archive.md/rESxe

      • CursedSilicon 4 days ago

        Is there any evidence "Asahi Lina" is Hector?

        • glenstein 4 days ago

          Thank you for asking this. It was presented matter of fact and I would not have appreciated that it was something less than settled. The best I can find from googling was rumors and speculation (insert comment in reply with more rumors and speculation). I also don't necessarily think it means someone is a Bad Guy if true. I want people to be able to have anonymous alter egos online if that's what they want and they're not doing any harm.

          • CursedSilicon 4 days ago

            Being called a "concern troll" for daring to question such a bizarre accusation makes me think it's just a bunch of weird losers

        • xphos 4 days ago

          Isn't Asahi Lina Married to some other japanese Vtubber now? I mean maybe you'd fake all that but I doubt it. Both are more likely real people who are different. The people have totally different eccentricties its really hard to fake that type difference for a long time.

          [source] https://x.com/Lina_Hoshino/status/1862840998897861007

        • dplm 8 hours ago

          Yes. This forum has collated the evidence that Asahi Lina is the VTuber alter ego of Hector Martin:

          https://archive.today/dcc3I#-asahi-lina

        • amiga386 4 days ago

          There is. You can easily find by googling "hector martin" "asahi lina" and you will soon find a pile of obsessively archived evidence.

          My view, now that Hector has resigned from the LKML both as himself and as Lina, is there is no problem any more. If Hector wants to project a persona, or decide his identity is the persona, or maybe multiple personas, that is fine on social media. People do that. So long as he's not sockpuppeting Linux kernel maintenance, it's fine.

        • leadingthenet 4 days ago

          At this point I suspect anyone who even asks that question of concern trolling. The evidence is overwhelming.

        • mos87 2 days ago

          oh no not again.

          yes, like 99.(9)%

      • iknowstuff 3 days ago

        Linus Torvalds rips into Hellwig for blocking Rust for Linux:

        https://lore.kernel.org/rust-for-linux/CAHk-=wgLbz1Bm8QhmJ4d...

    • bayindirh 4 days ago

      IIRC, it was not about Rust vs. C, but a commotion rooted from patch quality and not pushing people around about things.

      Linux Kernel team has this habit of a forceful pushback which breaks souls and hearts when prodded too much.

      Looks like Hector has deleted his Mastodon account, so I can't look back what he said exactly.

      Oh, I still have the relevant tab open. It's about code quality: https://news.ycombinator.com/item?id=43043312

      • chippiewill 4 days ago

        That was a single message in a very large thread. It absolutely was not just about code quality.

        • bayindirh 4 days ago

          Yes, that's the entry of the rabbit hole, and reader is advised to dig their own tunnel.

          I remember following the tension for a bit. Yes, there are other subjects about how things are done, but after reading it, I remember framing "code quality" as the base issue.

          In high-stakes software development environments, egos run high generally, and when people clash and doesn't back up, sparks happen. If this warning is ignored, then something has to give.

          If I'm mistaken, I can enjoy a good explanation and be gladly stand corrected.

          This is what happened here. This is probably the second or third time I witness this over 20+ years. Most famous one was over CPU schedulers, namely BFS, again IIRC.

          • seba_dos1 4 days ago

            marcan has even publicly ranted about having to send patches as e-mails. This rage quit simply concluded that journey.

      • iurbwdj 4 days ago

        > Looks like Hector has deleted his Mastodon account, so I can't look back what he said exactly.

        https://archive.md/uLiWX

        https://archive.md/rESxe

      • iurbwdj 4 days ago
        • bayindirh 4 days ago

          Some pretext: I'm a Rust skeptic and tired of Rust Evangelism Task Force and Rewrite in Rust movements.

          ---

          Yes. I remember that message.

          Also let's not forget what marcan said [0] [1].

          In short, a developer didn't want their C codebase littered with Rust code, which I can understand, then the Rust team said that they can maintain that part, not complicating his life further (Kudos to them), and the developer lashing out to them to GTFO of "his" lawn (which I understand again, not condone. I'd have acted differently).

          This again boils down to code quality matters. Rust is a small child when compared to the whole codebase, and weariness from old timers is normal. We can discuss behaviors till the eternity, but humans are humans. You can't just standardize everything.

          Coming to marcan, how he behaved is a big no in my book, too. Because it's not healthy. Yes, the LKML is not healthy, but this is one of the things which makes you wrong even when you're right.

          I'm also following a similar discussion list, which has a similar level of friction in some matters, and the correct thing is to taking some time off and touching grass when feeling tired and being close to burnout. Not running like a lit torch between flammable people.

          One needs to try to be the better example esp. when the environment is not in an ideal shape. It's the hardest thing to do, but it's the most correct path at the same time.

          [0]: https://web.archive.org/web/20250205004552mp_/https://lwn.ne...

          [1]: https://lkml.org/lkml/2025/2/6/404

          • iurbwdj 4 days ago

            One perspective is that Rust appears to be forced into the Linux kernel through harassment and pressure. Instead of Rust being pulled, carefully, organically and friendly, and while taking good care of any significant objections. Objections like, getting the relevant features from unstable Rust into stable Rust, or getting a second compiler like gccrs (Linux kernel uses gcc for C) fully up and running, or ensuring that there is a specification (the specification donated by/from Ferrous Systems, might have significant issues), or prioritizing the kernel higher than Rust.

            If I had been enthusiastic about Rust, and wanted to see if it could maybe make sense for Rust to be part of the Linux kernel[0], I would probably had turned my attention to gccrs.

            What is then extra strange is that there have been some public hostility against gccrs (WIP Rust compiler for gcc) from the rustc (sole main Rust compiler primarily based on LLVM) camp.

            It feels somewhat like a corporate takeover, not something where good and benign technology is most important.

            And money is at stake as well, the Rust Foundation has a large focus on fundraising, like how their progenitors at Mozilla/Firefox have or had a large focus on fundraising. And then there are major Rust proponents who openly claim, also here on Hacker News, that software and politics are inherently entwined.

            [0]: And also not have it as a strict goal to get Rust into the kernel, for there might be the possibility that Rust was discovered not to be a good fit; and then one could work on that lack of fit after discovery and maybe later make Rust a good fit.

            • jacquesm 4 days ago

              I think the main issue is that it never was about how rust programmers should write more rust. Just like a religion it is about what other people should do. That's why you see so many abandoned very ambitious rust projects to tackle x,y or z now written in C to do them all over again (and throw away many years of hardening and bug fixes). The idea is that the original authors can be somehow manipulated into taking these grand gifts and then to throw away their old code. I'm waiting for the SQLite rewrite in rust any day now. And it is not just the language itself, you also get a package manager that you will have to incorporate into your workflow (with risks that are entirely its own), new control flow models, terminology and so on.

              Rust should have done exactly one thing and do that as good as possible: be a C replacement and do that while sticking as close as possible to the C syntax. Now we have something that is a halfway house between C, C++, JavaScript (Node.js, actually), Java and possibly even Ruby with a syntax that makes perl look good and with a bunch of instability thrown in for good measure.

              It's as if the Jehova's witnesses decided to get into tech and to convince the world of the error of its ways.

              • dralley 4 days ago

                >I think the main issue is that it never was about how rust programmers should write more rust. Just like a religion it is about what other people should do.

                >Rust should have done exactly one thing and do that as good as possible: be a C replacement and do that while sticking as close as possible to the C syntax.

                Irony.

              • sunshowers 4 days ago

                > Rust should have done exactly one thing and do that as good as possible: be a C replacement and do that while sticking as close as possible to the C syntax.

                The goal of Rust is to build reliable systems software like the kind I've worked on for the last many years, not to be a better C, the original goal of which was to be portable assembler for the PDP-11.

                > Now we have something that is a halfway house between C, C++, JavaScript (Node.js, actually), Java and possibly even Ruby with a syntax that makes perl look good and with a bunch of instability thrown in for good measure.

                I think Rust's syntax and semantics are both the best by some margin across any industrial language, and they are certainly much better than any of the ones you listed. Also, you missed Haskell.

                • jacquesm 3 days ago

                  Haskell is interesting, it is probably one of the best programming languages ever devised but it just can't seem to gain traction. There are some isolated pockets where it does well (both business wise as well as geographically).

                  • sh34r 2 days ago

                    I like Haskell, but I never want to work with Haskellers, ever again. I’ll do personal / solo Haskell projects. But never professionally on a team. Haskellers are not team players.

                    Rustaceans should really take Haskell as a cautionary tale. It doesn’t matter how good your tech is, if your community is actively hostile to newcomers, if you try to haze every newcomer by making them recite your favorite monad definition before giving them the time of day.

                    Rustaceans are already working their way onto my shitlist for proliferating X years’ Rust experience all over the place. And no, that’s not HR’s fault. HR has no idea what Rust is. It’s rustaceans corrupting the hiring process to reward their fellow cultists.

                    It’s idiotic to be so insular and so tribalistic, if you want to increase adoption of your favorite language. Programming languages are like natural languages. The more people that use them, the more valuable it is to speak it. Imagine if someone tried to get you to learn mandarin by shitting on your native language. You catch a lot more flies with honey than vinegar.

                    I’d rather be stuck in JS hell forever, than have to deal with such toxic, dramatic, dogmatic people. And I really dislike writing JavaScript… but the community and ecosystem around the language are way more important than the syntax and semantics. You want the engineers and builders to vastly outnumber the radioactive PL theorists.

                    • tome a day ago

                      That's a rather drastic generalization! As a counterpoint I've worked on professional teams with, what, 20 or 30 different Haskellers over the years and the number of "toxic, dramatic, dogmatic people" in that set is zero (or one if I really stretch the definition, and then only dogmatic, not toxic or dramatic). None were poor at their jobs, and the proportion of truly excellent software engineers with deep capability in the hard and soft skills needed to get code shipped was far greater than 50%.

                      That said, if toxic behavior occurs it can be more visible in smaller communities, just by how the numbers work out, so I don't doubt you've had a hard time interacting with some Haskellers, and I sympathize with you. Please point me to any toxic behavior you see in the public Haskell community and I'll do my best to address it with whatever authority I have.

                  • sunshowers 3 days ago

                    True!

              • blub 3 days ago

                Interesting, I was also thinking of the similarities with Jehovah’s witnesses. It’s as if they somehow got into the building, were offered a job and now want to convince everyone of the merits of technical salvation.

                Rust the technology is not bad, even though it is still complicated like C++, has rather poor usability (also like C++) and is vulnerable to supply-chain attacks. But some of the people can be very irritating and the bad apples really spoil the barrel. There’s a commenter below gleefully writing that “C++ developers are spinning in their graves”. Probably slightly trolling and mentioning C++ doesn’t make sense in this kernel context, but such hostile, petty comments are not unheard of.

            • vablings 4 days ago

              >One perspective is that Rust appears to be forced into the Linux kernel through harassment and pressure. Instead of Rust being pulled, carefully, organically and friendly, and while taking good care of any significant objections. Objections like, getting the relevant features from unstable Rust into stable Rust, or getting a second compiler like gccrs (Linux kernel uses gcc for C) fully up and running, or ensuring that there is a specification (the specification donated by/from Ferrous Systems, might have significant issues), or prioritizing the kernel higher than Rust.

              On the flip side there have been many downright sycophants of only C in the Linux kernel and have done every possible action to throttle and sideline the Rust for Linux movement.

              There have been multiple very public statements made by other maintainers that they actively reject Rust in the kernel rather than coming in with open hearts and minds.

              Why are active maintainers rejecting parts of code that are under the remit of responsibility?

            • bayindirh 4 days ago

              Personally, I observe that Rust is forced everywhere in the Linux ecosystem. One of my biggest concerns is uutils, mostly because of the permissive license it bears. The Linux kernel and immediate userspace shall be GPL licensed to protect the OS in my opinion.

              I have a personal principle of not using LLVM-based languages (equal parts I don't like how LLVM people behave against GCC and I support free software first and foremost), so I personally watch gccrs closely, and my personal ban on Rust will be lifted the day gccrs becomes an alternative compiler.

              This brings me to the second biggest reservation about Rust. The language is moving too fast, without any apparent plan or maturing process. Things are labeled unstable, there's no spec, and apparently nobody is working on these very seriously, which you also noted.

              I don't understand why people are hostile against gccrs? Can you point me to some discussions?

              > It feels somewhat like a corporate takeover, not something where good and benign technology is most important.

              As I noted above, the whole Rust ecosystem feels like it's on a crusade, esp. against C++. I write C++, and I play with pointers a lot, and I understand the gotchas, and also the team dynamics and how it's becoming harder to write good software with larger teams regardless of programming language, but the way Rust propels itself forward leaves a very bad taste in the mouth, and I personally don't like to be forced into something. So, while gccrs will remove my personal ban, I'm not sure I'll take the language enthusiastically. On the other hand, another language Rust people apparently hate, Go, ticks all the right boxes as a programming language. Yes, they made some mistakes and turned back from some of them at the last moment, but the whole ordeal looks tidier and better than Rust.

              In short, being able to borrow-check things is not a license to push people around like this, and they are building themselves a good countering force with all this enthusiasm they're pumping around.

              Oh, I'll only thank them for making other programming languages improve much faster. Like how LLVM has stirred GCC devs into action and made GCC a much better compiler in no time.

              • rowanG077 4 days ago

                The language is moving too fast? The language is moving extremely slowly imo, too slowly for a lot of features. C++ is moving faster at this point.

              • umanwizard 4 days ago

                LLVM is free software. You appear to be making the common mistake of confusing the permissive vs. copyleft distinction with the open source vs. free software distinction.

                Open source and free software mean almost exactly the same set of software; the only difference between the two terms, according to RMS and other free software advocates, is the emphasis. Sort of like the difference between the Gulf of America and the Gulf of Mexico: they mean the same body of water, but reflect a different viewpoint about it.

                This confusion arises because RMS prefers the term "free software" over "open source", and also prefers copyleft over permissive licenses, so people sort of get the idea that they are the same distinction.

                • uplifter 4 days ago

                  At least concerning Richard M. Stallman's take on this subject, this characterization is completely wrong.

                  RMS certainly does not consider the difference between open source and free software to be merely one of 'emphasis.' According to him they are completely different animals. Here are his words on their difference[0]:

                  > 'When we call software “free,” we mean it respects the users’ essential freedoms: the freedom to run it, to study and change it, and to redistribute copies with or without changes (see http://www.gnu.org/philosophy/free-sw.html). This is a matter of freedom, not price, so think of “free speech,” not “free beer.” ... Nearly all open source software is free software; the two terms describe almost the same category of software. But they stand for views based on fundamentally different values. Open source is a development methodology; free software is a social movement. For the free software movement, free soft- ware is an ethical imperative, because only free software respects the users’ freedom. By contrast, the philosophy of open source considers issues in terms of how to make software “better”—in a practical sense only. It says that non-free software is a suboptimal solution. For the free software movement, however, non-free software [including non-free open source software] is a social problem, and moving to free software is the solution.'

                  [emphasis and square brackets mine]

                  It's not that RMS 'prefers the term "free software" over "open source"' but that he prefer software be free instead of non-free. The source being open is just an incomplete precondition for being free.

                  [0] https://courses.cs.duke.edu/common/compsci092/papers/open/st...

                  • the_why_of_y 4 days ago

                    > Open source and free software mean almost exactly the same set of software

                    > Nearly all open source software is free software; the two terms describe almost the same category of software.

                    I see no disagreement, how is GP "completely wrong"?

                    • uplifter 4 days ago

                      Edit: I'm wrong on my first reply, as pointed out here: https://news.ycombinator.com/item?id=46226602

                      LLVM is free software, and it is a confusion to equate copyleft and free software, though I still maintain that free and open source are very distinct concepts which refer to different categories of licenses. That contrast is better stated by RMS in the article on the subject above which I linked above.

                      Original reply:

                      Primarily its this first line here:

                      >LLVM is free software. You appear to be making the common mistake of confusing the permissive vs. copyleft distinction with the open source vs. free software distinction.

                      LLVM is NOT free software because it is released under the Apache license, which is an open source license but not a free software license. This is opposed to the linux kernel and GCC which are free software because their source is available under the GPL license. Further it is not really a confusion to equate permissive licensing with open source as distinguished from copyleft and free software. In this context, free is equivalent in meaning to copyleft, as distinguished from the more permissive open source licenses.

                      • steveklabnik 4 days ago

                        > LLVM is NOT free software because it is released under the Apache license, which is an open source license but not a free software license.

                        GNU disagrees with you: https://www.gnu.org/licenses/license-list.html

                        > Apache License, Version 2.0 - This is a free software license, compatible with version 3 of the GNU GPL.

                        Furthermore:

                        > Further it is not really a confusion to equate permissive licensing with open source as distinguished from copyleft and free software.

                        You are in disagreement with the FSF on this issue. "permissive" licenses also follow the Four Essential Freedoms, none of which require viral licensing.

                • pessimizer 4 days ago

                  This is nonsense, and I have no idea why you need to believe it.

                  Open Source can be used as Free Software because Open Source can be used as proprietary software or anything else, as long as you include the license or mention the author somewhere or whatever. But these are both standards for actual licenses, and the actual licenses are different. Copyleft software can not be included in your proprietary software.

                  Copyleft software is restrictive. You are required to allow people to access it, and required to redistribute it in source form if you are redistributing it in compiled form (or over the network for modern copyleft licenses.) You are also required to include all of the changes that you have made to the things that you have compiled within that source distribution, and to also distribute other code that is required to to make your software package work under the same licensing.

                  The confusion is only in people spreading misinformation trying to confuse the two things. You clearly seem to know that RMS can prefer copyleft over permissive licenses, but still need to pretend that there's no difference between the two. If you know that someone can prefer white chocolate to dark chocolate, there's obviously something wrong with you if you in the same breath say that there is no difference between white chocolate and dark chocolate. Why deceive people? What's the point?

                  If they're all exactly the same, everybody should be using the GPL in Linux then. Shouldn't even be a thought. Why waste time forcing corporate-friendly licenses if it doesn't matter and some people are against them? Shouldn't parsimony rule then?

              • biggoodwolf 4 days ago

                Wait till you see the vulnerabilities introduced... Makes you wonder how organic it really is

            • estebank 4 days ago

              > What is then extra strange is that there have been some public hostility against gccrs (WIP Rust compiler for gcc) from the rustc (sole main Rust compiler primarily based on LLVM) camp.

              Could you point at a single quote from a member of the compiler team, current or former, that can be construed as hostility?

              • steveklabnik 4 days ago

                For what it’s worth, I perceived hostility here a long time ago, but those people have pretty explicitly come around since. That said I also think the parent is just wrong to focus on gcc vs llvm as the source of that, and also to bring it up at this point regardless.

                • estebank 4 days ago

                  The only thing I could ever see misconstrued of as "hostility" with my earshot from anyone in t-compiler is myself saying something along the lines of "that sounds like a lot of effort that doesn't gain much over rustc_codegen_gcc, and I am not interested in contributing to a cpp codebase". Note that nowhere in my position I state anything like "this shouldn't exist" or "they should stop" or "we shouldn't cooperate". If anything, the communication channels with them are quite open and friendly. During the RustNL Q&A for the gccrs talk people from t-lang and t-compiler asked point blank "what can we do to help make your life easier". Beyond some minor concerns about the potential for language divergence and gccisms becoming a thing, which they have been very vocal about wanting to avoid, my opinion on the project is that it is net positive and I am impressed with them, and I'll help in any way I can, short of writing code on my spare free time for yet another rust compiler—one is a handful already for me :)

                  • steveklabnik 4 days ago

                    Yes, I'm being vague here because I don't think it's productive to bring up some old stuff, but I bring up at at all because I was trying to agree with you: at this point, it appears to be very fine and healthy, even if I didn't think that was 100% the case at one point.

                    If you really want to know, we can email about it, but I don't think it matters, because whatever it was is clearly under the bridge by now.

                  • nextaccountic 4 days ago

                    There's another point of hostility when it was expressed - not sure by who - that internals.rust-lang.org wasn't an appropriate forum to discuss gccrs

                    Generally speaking I think that Rust channels should be open to all implementations

          • duped 4 days ago

            > In short, a developer didn't want their C codebase littered with Rust code

            from reading those threads at the time, the developer in question was deliberately misunderstanding things. "their" codebase wasn't to be "littered" with Rust code - it wasn't touched at all.

            • jonkoops 3 days ago

              Yes, this is it. The Rust code would be in an entirely different part of the project, not touching any of his code, only providing an abstraction for the Rust code to interact with it. The only thing the Rust team asked is to be notified of API changes that they would have to update their bindings for.

    • iknowstuff 3 days ago

      Yes.

      Linus Torvalds rips into Hellwig for blocking Rust for Linux:

      https://lore.kernel.org/rust-for-linux/CAHk-=wgLbz1Bm8QhmJ4d...

          The fact is, the pull request you objected to DID NOT TOUCH THE DMA LAYER AT ALL.
          It was literally just another user of it, in a completely separate subdirectory, that didn't change the code you maintain in _any_ way, shape, or form.
          I find it distressing that you are complaining about new users of your code, and then you keep bringing up these kinds of complete garbage arguments.
          Honestly, what you have been doing is basically saying "as a DMA maintainer I control what the DMA code is used for".
          And that is not how *any* of this works.
      
      The other person who replied to you is purposefully referencing a different incident.
  • drtgh 4 days ago

    https://www.phoronix.com/news/Alex-Gaynor-Rust-Maintainer

        << Alex Gaynor recently announced he is formally stepping down as one of the maintainers of the Rust for Linux kernel code with the removal patch now queued for merging in Linux 6.19. Alex Gaynor was one of the original developers to experiment with Rust code for Linux kernel modules. He's drifted away from Rust Linux kernel development for a while due to lack of time and is now formally stepping down as a listed co-maintainer of the Rust code. After Wedson Almeida Filho stepped down last year as a Rust co-maintainer, this now leaves Rust For Linux project leader Miguel Ojeda as the sole official maintainer of the code while there are several Rust code reviewers. >>
    • metaltyphoon 4 days ago

      What are you trying to imply?

    • mainecoder 4 days ago

      we shall C the resolve of the RUST maintainers they are working on borrowed time ....

    • meindnoch 4 days ago

      "Yay, we got Rust in the Kernel! ^_^ Ok, now it's your code! Bye!"

      • veber-alex 4 days ago

        1. He left before Rust stopped being experimental.

        2. Maintainers come and go all the time, this is how open source works.

        3. The only reason Phoronix reports on this is because anytime they mention Rust it attracts rage bait clicks, for example, your comment.

      • vablings 4 days ago

        Then another maintainer will take care of it? This is how kernel development works....

      • dlahoda 4 days ago

        high quality educational material

  • mos87 2 days ago

    Due process including fitness for purpose assessment isn't "resistance".

dcrazy 4 days ago

Does the removal of “experimental” now mean that all maintainers are now obligated to not break Rust code?

  • chippiewill 4 days ago

    I believe the removal of the "experimental" nomenclature is just an indication that Rust is "here to stay" in the kernel (which essentially means that developers can have confidence investing in writing Rust based drivers).

    The overall rules haven't changed.

    Strictly speaking they've always been obligated to not break the Rust code, but the R4L developers have agreed to fix it on some subsystems behalf IIRC so Rust can be broken in the individual subsystem trees. But I think it's been the case all along that you can't send it to Linus if it breaks the Rust build, and you probably shouldn't send it to linux-next either.

  • teekert 4 days ago

    Yeah I was wondering about that one angry bearded guy in that movie. He will be very upset.

    • bpavuk 4 days ago

      I am missing some context, did not follow the Linux/Rust drama. which guy?

      • mewse-hn 4 days ago

        Ted T'so: "Here’s the thing: you’re not going to force all of us to learn Rust."

        https://arstechnica.com/gadgets/2024/09/rust-in-linux-lead-r...

        https://youtu.be/WiPp9YEBV0Q?t=1529

        • bonzini 4 days ago

          That was way way blown out of proportion. https://lwn.net/Articles/991062/ has a much less somber quote from just three months later:

          > Ted Ts'o said that the Rust developers have been trying to avoid scaring kernel maintainers, and have been saying that "all you need is to learn a little Rust". But a little Rust is not enough to understand filesystem abstractions, which have to deal with that subsystem's complex locking rules. There is a need for documentation and tutorials on how to write filesystem code in idiomatic Rust. He said that he has a lot to learn; he is willing to do that, but needs help on what to learn

        • dralley 4 days ago

          Ted was being an asshole, nobody was asking him to learn Rust, he completely misinterpreted the point being made and then proceeded to go on an angry rant for like 5 minutes in the middle of a presentation which just is kind of disrespectful.

        • teekert 3 days ago

          Yes that was it indeed thanx for finding it. I kept coming to this video but couldn't find the time index.

      • grimgrin 4 days ago

        linus torvalds

        • GuB-42 4 days ago

          Linus Torvalds greenlit Rust in the kernel, and as a BDFL, he is the one to decide. He has no reason to be upset with any decision because ultimately, all decisions are his own.

          If he didn't want Rust in the kernel, he would have said it, and there would have been no Rust in the kernel. It is also the reason why there is no C++ in the kernel, Linus doesn't like C++. It is that simple.

          And I respect that, Linux is hugely successful under Linus direction, so I trust his decisions, whatever opinion I have about them.

          • grimgrin 4 days ago

            I only typed Linus Torvald not realizing the person was asking for a "movie character" quite literally, lol. I thought "you mean the guy famous for (among many things..) his behavior?"

            This is the first time I've had a comment hit -3 which, I mean, I get it!!

            • teekert 3 days ago

              My bad perhaps, in my language Movie and Video and sometimes (Film) are (or can) all be the same word.

        • teekert 4 days ago

          I can't find the movie, but there was a guy angry that stated that he should not have to learn Rust, nobody should. And Rust should not be in the kernel.

          • xphos 4 days ago

            Its in a talk about File systems in Rust for Linux. Basically the rust maintainer who I think stepped down was talking about how the C-code base for VFS has a lot of documented but complex orderings where you have to call a lock, or pin before accessing an Inode(or something) one way but not the other. They made a bunch of Rust Types so you basically could not produce an illegal ordering and got heckled pretty hard by the "bearded guy". They basically run out the presentation time with heckling and I think the Rust maintainer quit a few months later (over many similar instances of this. don't quote me time line here)

            [source] https://www.youtube.com/watch?v=WiPp9YEBV0Q

            • dralley 4 days ago

              IIRC, the point was actually that they were undocumented in many cases, and that the Rust developers were willing to take on a lot of work, but they would need help with understanding all of the hidden and implicit "rules", but that they had received pushback for simply asking questions or asking for documentation to be comprehensive.

              • xphos 3 days ago

                Okay I felt that they were undocumented but I was trying to be charitable to the bearded man :D. I didn't have time to watch the video again haha. But Yeah the push back at the suggestion was very surprising.

  • veidelis 4 days ago

    Is rust code part of user space?

    • josephg 4 days ago

      This is the Linux kernel. User space can do whatever it wants.

    • dxroshan 4 days ago

      Projects like GNOME are increasingly using Rust.

      • veidelis 4 days ago

        From kernel side, I meant - I wasn't clear. Now I understand what's the meaning of "don't break rust code". Happy that rust's journey in the kernel is successful so far. The pace seems strong.

  • mort96 4 days ago

    No maintainer is obligated to not break any part of Linux other than the user space API, there are no stable in-kernel APIs

    • simonask 4 days ago

      What they mean is that the Linux kernel has a long-standing policy to keep the whole kernel compilable on every commit, so any commit that changes an internal API must also fix up _all_ the places where that internal API is used.

      While Rust in the kernel was experimental, this rule was relaxed somewhat to avoid introducing a barrier for programmers who didn't know Rust, so their work could proceed unimpeded while the experiment ran. In other words, the Rust code was allowed to be temporarily broken while the Rust maintainers fixed up uses of APIs that were changed in C code.

      • Imustaskforhelp 4 days ago

        So does this mean that the C developers might need to learn Rust or cooperate more with the rust developer team basically?

        • eru 4 days ago

          I guess in practice you'd want to have Rust installed as part of your local build and test environment. But I don't think you have to learn Rust any more (or any less) than you have to learn Perl or how the config script works.

          As long as you can detect if/when you break it, you can then either quickly pick up enough to get by (if it's trivial), or you ask around.

          • jacquesm 4 days ago

            The proof of the pudding will be in the eating, the rust community better step up in terms of long term commitment to the code they produce because that is the thing that will keep this code in the kernel. This is just first base.

            • simonask 4 days ago

              No matter how hard you try to paint it as such, Rust is not a tribe. This is such a weird characterization.

              Rust contributions to the Linux kernel were made by individuals, and are very obviously subject to the exact same expectations as other kernel contributions. Maintainers have responsibilities, not “communities”.

              • estebank 4 days ago

                Not only that, those individuals were already Linux kernel contributors. This is not an amorphous external group forcing their will on Linux, it's Linux itself choosing to use Rust.

        • weebull 4 days ago

          Learn rust to a level where all cross language implications are understood, which includes all `unsafe` behaviour (...because you're interfacing with C).

          Yes it does.

        • cogman10 4 days ago

          Depends on the change being made.

          If they completely replace an API then sure, probably.

          But for most changes, like adding a param to a function or a struct, they basically have to learn nothing.

          Rust isn't unlike C either. You can write a lot of it in a pretty C like fashion.

          • FpUser 4 days ago

            >"Rust isn't unlike C either. You can write a lot of it in a pretty C like fashion."

            I think that with all of the Rust's borrowing rules the statement is very iffy.

            • simonask 4 days ago

              C has a lot of the same borrowing rules, though, with some differences around strict aliasing versus the shared/exclusive difference in Rust.

              Most of the things people stub their toe on in Rust coming from C are already UB in C.

            • cogman10 4 days ago

              Rust's borrowing rules might force you to make different architecture choices than you would with C. But that's not what I was thinking about.

              For a given rust function, where you might expect a C programmer to need to interact due to a change in the the C code, most of the lifetime rules will have already been hammered out before the needed updates to the rust code. It's possible, but unlikely, that the C programmer is going to need to significantly change what is being allocated and how.

              • FpUser 4 days ago

                Not talking allocations, more like actual borrowing, aliasing, passing as parameters.

        • bmicraft 4 days ago

          That's exactly the original question.

    • dwattttt 4 days ago

      There is, I understand, an expectation that if you do make breaking changes to kernel APIs, you fix the callers of such APIs. Which has been a point of contention, that if a maintainer doesn't know Rust, how would they fix Rust users of an API?

      The Rust for Linux folks have offered that they would fix up such changes, at least during the experimental period. I guess what this arrangement looks like long term will be discussed ~now.

      • jacquesm 4 days ago

        Without a very hard commitment that is going to be a huge hurdle to continued adoption, and kernel work is really the one place where rust has an actual place. Everywhere else you are most likely better off using either Go or Java.

        • hollerith 4 days ago

          Aren't large parts of a web browser and a runtime for a programming language also better written in Rust than in Go or Java?

          • cestith 3 days ago

            Rust is being used a lot in video and audio processing where C and C++ had been the main players. Fixed-latency streaming is not really the best place for Go, Java, or Python.

          • jacquesm 4 days ago

            I'd say no, access to a larger pool of programmers is an important ingredient in the decision of what you want to write something in. Netscape pre-dated Java which is why it was written in C/C++ and that is why we have rust in the first place. But today we do have Java which has all of the rust safety guarantees and then some, is insanely performant for network code and has a massive amount of mindshare and available programmers. For Go the situation is a bit less good but if you really need that extra bit of performance (and you almost never really do) then it might be a good choice.

            • lII1lIlI11ll 4 days ago

              > But today we do have Java which has all of the rust safety guarantees and then some, is insanely performant for network code and has a massive amount of mindshare and available programmers.

              I'm not entirely convinced that Java has much mindshare among system programmers. During my 15 years career in the field I haven't heard "Boy I wish we wrote this <network driver | user-space offload networking application | NIC firmware> in Java" once.

              • jacquesm 4 days ago

                I've seen plenty of networking code in Java, including very large scale video delivery platforms, near real time packet analysis and all kinds of stuff that I would have bet were not even possible in Java. If there is one thing that I'm really impressed by then it is how far Java has come performance wise, from absolutely dog slow to being an insignificant fraction away from low level languages. And I'm not a fan (to put it mildly) so you can take that as 'grudging respect'.

                The 'factory factory' era of Java spoiled the language thoroughly for me.

                • lII1lIlI11ll 4 days ago

                  I never said it is due to performance considerations (although developers in a projects like you described tend to always become experts in things like tuning Java GC). It is more like "If we wanted to write this in a shitty verbose OOP language we would just use C++".

            • nicoburns 4 days ago

              While it might be possible to get the performance required for a web rendering engine out of Java, I think you'd miserable writing Java in the style you'd need to get that kind of performance. And you'd likely still end up with issues around memory usage, app bundle size (remember that browsers ship to client devices), GC pauses, and integrating with the JavaScript engine.

            • hollerith 4 days ago

              All the mainstream browsers do their own low-level graphics rendering (e.g., of text and icons and such). Is Java performant enough to do that?

              • jacquesm 4 days ago

                Absolutely. Again, not a fan of the language. But you can transcode 10's of video streams on a single machine into a whole pile of different output resolutions and saturate two NICs while you're at it. Java has been 'fast enough' for almost all purposes for the last 10 years at least if not longer.

                The weak point will always be the startup time of the JVM which is why you won't see it be used for short lived processes. But for a long lived process like a browser I see no obstacles.

                • NetMageSCW 4 days ago

                  It’s only fast enough if it is as fast or faster than the alternatives. Otherwise it is wasting battery power, making older/cheaper computers feel sluggish and increasingly inefficient.

                • tracker1 4 days ago

                  Are the streams actually transcoded in Java, or is Java just orchestrating FFMpeg (and likely platform accelerators)?

            • umanwizard 4 days ago

              > which has all of the rust safety guarantees and then some

              That's not really true. Data races are possible in Java.

              • zozbot234 4 days ago

                Data races are possible on some types, specifically `long` when not declared as `volatile` - but these do not directly cause memory unsafety.

                • ivell 4 days ago

                  Not just some types - any object with members. Shared references are a thing in Java and if not careful can cause data races left and right.

                  Rust controls that quite a bit.

            • tracker1 4 days ago

              Browsers already eat up GBs of ram... I don't want to know how bad it would get written in Java.

          • marcosdumay 4 days ago

            The runtime for a programming language, yes. The web browser thing is really not clear to me, but it certainly beats C++.

        • ChadNauseam 4 days ago

          I'm using it for frontend web development and it's perfect. Much better than Go or Java would be. It's pretty wild that the language I use in the browser is also in the kernel.

amiga386 4 days ago

Does this mean that all architectures that Linux supports but Rust doesn't are straight in the bin?

  • vincentkriek 4 days ago

    No, Rust is in the kernel for driver subsystems. Core linux parts can't be written in Rust yet for the problem you mention. But new drivers *can* be written in Rust

  • bmicraft 4 days ago

    Which ones would that be?

    • muvlon 4 days ago

      In order to figure this out I took the list of platforms supported by Rust from https://doc.rust-lang.org/nightly/rustc/platform-support.htm... and those supported by Linux from https://docs.kernel.org/arch/index.html, cleaned them up so they can be compared like for like and then put them into this python script:

        linux = { "alpha", "arc", "arm", "aarch64", "csky", "hexagon",
          "loongarch", "m68k", "microblaze", "mips", "mips64", "nios2",
          "openrisc", "parisc", "powerpc", "powerpc64", "riscv",
          "s390", "s390x", "sh", "sparc", "sparc64", "x86", "x86_64",
          "xtensa" }
        
        rust = { "arm", "aarch64", "amdcgn", "avr", "bpfeb", "bpfel",
          "csky", "hexagon", "x86", "x86_64", "loongarch", "m68k",
          "mips", "mips64", "msp430", "nvptx", "powerpc", "powerpc64",
          "riscv", "s390x", "sparc", "sparc64", "wasm32", "wasm64",
          "xtensa" }
        
        print(f"Both: {linux.intersection(rust)}")
        print(f"Linux, but not Rust: {linux.difference(rust)}")
        print(f"Rust, but not Linux: {rust.difference(linux)}")
      
      Which yields:

      Both: {'aarch64', 'xtensa', 'sparc', 'm68k', 'mips64', 'sparc64', 'csky', 'riscv', 'powerpc64', 's390x', 'x86', 'powerpc', 'loongarch', 'mips', 'hexagon', 'arm', 'x86_64'}

      Linux, but not Rust: {'nios2', 'microblaze', 'arc', 'openrisc', 'parisc', 's390', 'alpha', 'sh'}

      Rust, but not Linux: {'avr', 'bpfel', 'amdcgn', 'wasm32', 'msp430', 'bpfeb', 'nvptx', 'wasm64'}

      Personally, I've never used a computer from the "Linux, but not Rust" list, although I have gotten close to a DEC Alpha that was on display somewhere, and I know somebody who had a Sega Dreamcast (`sh`) at some point.

      • bmicraft 4 days ago

        Well, GCC 15 already ended support for the nios2 soft-core. The successor to it is Nios V which runs RISC-V. If users want us update the kernel, they'll also need to update their FPGA.

        Microblaze also is a soft-core, based on RISC-V, presumably it could support actual RISC-V if anyone cared.

        All others haven't received new hardware within the last 10 years, everybody using these will already be running an LTS kernel on there.

        It looks like there really are no reasons not to require rust for new versions of the kernel from now on then!

        • ijustlovemath 4 days ago

          Is this the same NIOS that runs on FPGA? We wrote some code for it during digital design in university, and even an a.out was terribly slow, can't imagine running a full kernel. Though that could have been the fault of the hardware or IP we were using.

        • dmitrygr 4 days ago

          You fell into the trap I predicted a few years ago when the renaming happened. Microblaze refers to the old microblaze soft core, not the new one that they named the same thing and that is based on RISCV.

      • acdha 4 days ago

        It’s an interesting list from the perspective of what kind of project Linux is. Things like PA-RISC and Alpha were dead even in the 90s (thanks to the successful Itanium marketing push convincing executives not to invest in their own architectures), and SuperH was only relevant in the 90s due to the Dreamcast pushing volume. That creates an interesting dynamic where Linux as a hobbyist OS has people who want to support those architectures, but Linux as the dominant server and mobile OS doesn’t want to hold back 99.999999+% of the running kernels in the world.

        • jacquesm 4 days ago

          There was a time when it came to 64 bit support Alpha really was the only game in town where you could buy a server without adding a sixth zero to the bill. It was AMD, not Itanium that killed Alpha.

          • acdha 4 days ago

            I remember that time being before 64-bit became a requirement for most people (I worked with some computational scientists who did buy Alphas for that reason since they needed the flat memory space without remapping hacks). The Alpha was indeed great but Intel did enough of a job convincing most manufacturers that the only future was Itanium that only a few niche workstation manufacturers picked up the Alpha, and they had 64-bit competition from SPARC, MIPS, and POWER pretty quickly.

            I do agree that it was AMD which really made 64-bit mainstream. There’s an interesting what-if game about how the 90s might’ve gone if Intel’s marketing had been less successful or if Rick Belluzo hadn’t bought into it since he killed PA-RISC and HPUX before moving to SGI where he killed both MIPS and Irix and gave the high-end graphics business to nVidia.

          • cestith 3 days ago

            HP owned Compaq already, which had previously bought DEC, when the Alpha was killed. HP chose Itanium for their servers. They settled some patent issues with Intel partly by killing Alpha instead of a more traditional cross-licensing agreement.

            AMD killed Itanium. HP was pretty far along killing Alpha all on their own.

          • nikanj 4 days ago

            AMD, and the addition of PAE to the Pentium Pro which allowed 32-bit systems to reasonably have huge (for that time) amounts of memory

      • pornel 4 days ago

        There's Rust for Dreamcast (https://dreamcast.rs) via Rust's GCC backend.

      • seba_dos1 4 days ago

        You probably shouldn't include Rust's Tier 3 in this list. If you have to, at least make it separate.

      • Palomides 4 days ago

        some of the platforms on that list are not supported well enough to say they actually have usable rust, e.g m68k

      • NoGravitas 4 days ago

        I've certainly used parisc and alpha, though not for some years now.

    • amiga386 4 days ago

      https://lwn.net/Articles/1045363/

      > Rust, which has been cited as a cause for concern around ensuring continuing support for old architectures, supports 14 of the kernel's 20-ish architectures, the exceptions being Alpha, Nios II, OpenRISC, PARISC, and SuperH.

      • embedding-shape 4 days ago

        > supports 14 of the kernel's 20-ish architectures

        That's a lot better than I expected to be honest, I was thinking maybe Rust supported 6-7 architectures in total, but seems Rust already has pretty wide support. If you start considering all tiers, the scope of support seems enormous: https://doc.rust-lang.org/nightly/rustc/platform-support.htm...

        • chippiewill 4 days ago

          They probably get a few for "free" from LLVM supporting them

          • estebank 4 days ago

            LLVM platform support is neither sufficient (rustc needs to be taught about the platform) not technically necessary (you could write a rustc backend that targets a platform that LLVM doesn't, like modifying cranelift or once the gcc backend reaches maturity).

          • morkalork 4 days ago

            Wasn't that a whole tent pole of LLVM?

      • Lariscus 4 days ago

        Its strange to me that Linux dropped Itanium two years ago but they decided to keep supporting Alpha and PA-RISC.

        • ndiddy 4 days ago

          Itanium was mainly dropped because it was impeding work in the EFI subsystem. EFI was originally developed for Itanium before being ported to other platforms, so the EFI maintainers had to build and test their changes to shared code on Itanium. They eventually decided that this wasn't worth the effort when there was basically nobody running modern Linux on Itanium besides a few hobbyists. I imagine that alpha and hppa will get dropped in the future if they ever also create an undue maintenance burden. There's more context here if you're interested: https://lwn.net/Articles/950466/

        • Daishiman 4 days ago

          I do wonder how many humans beings are running the latest linux kernel on Alpha.

    • eru 4 days ago

      And more specifically which ones that anyone would use a new kernel on?

    • kykat 4 days ago

      Some people talk about 68k not being supported being a problem

      • pornel 4 days ago

        m68k Linux is supported by Rust, even in the LLVM backend.

        Rust also has an experimental GCC-based codegen backend (based on libgccjit (which isn't used as a JIT)).

        So platforms that don't have either LLVM nor recent GCC are screwed.

        • sakompella 4 days ago

          how on earth is linux being compiled for platforms without a GCC?

          additionally, I believe the GCC backend is incomplete. the `core` library is able to compile, but rust's `std` cannot be.

          • dessimus 4 days ago

            >nor recent GCC are screwed.

            Not having a recent GCC and not having GCC are different things. There may be architectures that have older GCC versions, but are no longer supported for more current C specs like C11, C23, etc.

          • dwattttt 4 days ago

            I don't believe Rust for Linux use std. I'm not sure how much of Rust for Linux the GCC/Rust effort(s) are able to compile, but if it was "all of it" I'm sure we'd have heard about it.

  • hexo 4 days ago

    Yes. Cooked.

epohs 5 days ago

This seems big. Is this big?

jlrubin 4 days ago

@dang title has been changed to "The (successful) end of the kernel Rust experiment", since there were complaints in the articles comments from the committee members that that was a sensationalization of what actually happened.

  • dang 4 days ago

    Thanks! This is cromulent.

    From https://news.ycombinator.com/newsguidelines.html: "Please use the original title, unless it is misleading or linkbait". Therefore: when misleading please edit.

  • 9rx 4 days ago

    Isn't successful already implied?

    Unsuccessful experiments have no end unless motivation to keep trying runs out — but Rust seems to have no end to motivation behind it. Besides, if it were to ever reach the point of there being no remaining motivation, there would be no remaining motivation for those who have given up to announce that they have given up, so we'd never see the headline to begin with.

    • dang 4 days ago

      We've done unsuccessful experiments on HN over the years, in the sense that they failed to achieve anything we'd hoped for and caused enough damage that we had to call them off.

      • 9rx 4 days ago

        Isn't that ultimately a loss of motivation? With enough buy in there would be a lot of reason to keep iterating towards the desired outcome despite any setbacks. That is the nature of experiments, after all. Things going horribly wrong while you are in the iteration process is an expected part of experimentation.

        Imagine a world where the Rust experiment hand't been going well. There is absolutely nothing stopping someone from keeping at it to prove why Rust should be there. The experiment can always live as long as someone wants to keep working on it. Experiments fundamentally can only end when successful, or when everyone gives up (leaving nobody to make the announcement).

        That said, consider me interested to read the announcements HN has about those abandoned experiments. Where should I look to find them?

  • jwatte 4 days ago

    "Linux kernel devs tried Rust in the kernel -- you won't BELIEVE the reaction!"

Eikon 4 days ago

I'm mostly interested in being able to interact with the vfs and build a 9p rust client (in addition to the current v9fs) to support my 9p server [0].

Does anyone know what's the current state / what is the current timeline for something like this to be feasible?

[0] https://github.com/Barre/ZeroFS

qwm 3 days ago

What does this practically mean for Linux? Will core parts of it depend on Rust? How closely linked are drivers?

Rust in Linux always worried me because there is currently only one stable backend (LLVM) and only one compiler implementation that doesn't yet have a spec. I like that you can at least compile Linux with Clang and GCC, but there aren't even two options for Rust right now.

irusensei 4 days ago

Happy to hear. We should embrace new things.

  • integralid 4 days ago

    Why? New things are less stable, immature and require a lot of effort to understand.

    Don't get me wrong, rust in the kernel is good, because the memory safety and expressiveness it brings makes it worth it DESPITE the huge effort required to introduce it. But I disagree that new things are inherently good.

    • dwattttt 4 days ago

      > I disagree that new things are inherently good.

      New things aren't automatically good. But you don't get new things that are good without trying new things.

      By avoiding new things, you're guaranteed to not experience less stable, immature, and confusing things. But also any new things that are good.

  • t43562 4 days ago

    Great. Python in the kernel!

shevy-java 4 days ago

So what is written in Rust so far therein?

  • gred 4 days ago

    > Linux's DRM Panic "Screen of Death"

    > "There is no particular reason to do it in rust, I just wanted to learn rust, and see if it can work in the kernel."

    https://www.phoronix.com/news/Linux-DRM-Panic-QR-Codes

  • dxroshan 4 days ago

    Mostly GPU drivers

    • ramon156 4 days ago

      Rightfully so, its probably the place where you'll het most ROI

      • weebull 4 days ago

        I don't understand why. Working with hardware you're going to have to do various things with `unsafe`. Interfacing to C (the rest of the kernel) you'll have to be using `unsafe`.

        In my mind, the reasoning for rust in this situation seems flawed.

        • viraptor 4 days ago

          The amount of unsafe is pretty small and limited to where the interfacing with io or relevant stuff is actually happening. For example (random selection) https://lkml.org/lkml/2023/3/7/764 has a few unsafes, but either: a) trivial structure access, or b) documented regarding why it's valid. The rest of the code still benefits.

          But that's not the only reason Rust is useful - see the end of the write-up from the module author https://asahilinux.org/2022/11/tales-of-the-m1-gpu/ ("Rust is magical!" section)

        • maccard 4 days ago

          I’ve done a decent amount of low level code - (never written a driver but I’m still young). The vast majority of it can be safe, and call into unsafe wrapped when needed. My experience is that a very very small amount of stuff actually needs unsafe and the only reason the unsafe C code is used is because it’s possible not because it’s necessary.

          • jacquesm 4 days ago

            It is interesting how many very experienced programmers have not yet learned your lesson, so you may be young but you are doing very well indeed. Kudos.

            • maccard 4 days ago

              Hah I’m not that young - it’s a figure of speech!

              • jacquesm 4 days ago

                Either way, the point you are making is an excellent one. Discipline makes for better programming, and to not use the features available to you is very often the right choice.

        • maximilianburke 4 days ago

          Unsafe in Rust doesn't mean anything goes. Specifically it means that you are going to 1) dereference a raw pointer; or 2) call an unsafe function/method; or 3) access/modify a mutable static variable; or 4) implement an unsafe trait; or 5) access fields of a union.

          You still get the safety guarantees of Rust in unsafe code like bounds checking and lifetimes.

        • umanwizard 4 days ago

          Why does that matter? Rust with some "unsafe" is still much nicer to use than C.

          In fact one of the main points of Rust is the ability to build safe abstractions on top of unsafe code, rather than every line in the entire program always being unsafe and possibly invoking UB.

        • phyzome 4 days ago

          The point is that lots of the code won't be `unsafe`, and therefore you benefit from memory safety in those parts.

rzerowan 4 days ago

Hmm seeing as this looks to be the path forward as far as inkernel Linux drivers are concerned , adnfor BSDs like FreeBSD that port said drivers to their own kernel. Are we going to see the same oxidation of the BSD's or resistance and bifurcation.

ykonstant 4 days ago

I need to check the rust parts of the kernel, I presume there is significant amounts of unsafe. Is unsafe Rust a bit better nowadays? I remember a couple of years ago people complained that unsafe is really hard to write and very "un-ergonomic".

  • jenadine 4 days ago

    The idea is that most of the unsafe code to interact with the C API of the kernel is abstracted in the kernel crate, and the drivers themselves should use very little amount of unsafe code, if any.

  • IshKebab 4 days ago

    I don't think unsafe Rust has gotten any easier to write, but I'd also be surprised if there was much unsafe except in the low-level stuff (hard to write Vec without unsafe), and to interface with C which is actually not hard to write.

    Mostly Rust has been used for drivers so far. Here's the first Rust driver I found:

    https://github.com/torvalds/linux/blob/2137cb863b80187103151...

    It has one trivial use of `unsafe` - to support Send & Sync for a type - and that is apparently temporary. Everything else uses safe APIs.

    • johncolanduoni 4 days ago

      Drivers are interesting from a safety perspective, because on systems without an IOMMU sending the wrong command to devices can potentially overwrite most of RAM. For example, if the safe wrappers let you write arbitrary data to a PCIe network card’s registers you could retarget a receive queue to the middle of a kernel memory page.

      • josephg 4 days ago

        > if the safe wrappers let you write arbitrary data to a PCIe network card’s registers

        Functions like that can and should be marked unsafe in rust. The unsafe keyword in rust is used both to say “I want this block to have access to unsafe rust’s power” and to mark a function as being only callable from an unsafe context. This sounds like a perfect use for the latter.

        • viraptor 4 days ago

          > Functions like that can and should be marked unsafe in rust.

          That's not how it works. You don't mark them unsafe unless it's actually required for some reason. And even then, you can limit that scope to a line or two in majority of cases. You mark blocks unsafe if you have to access raw memory and there's no way around it.

          • aw1621107 4 days ago

            It is how it's supposed to work. `unsafe` is intended to be used on functions where the caller must uphold some precondition(s) in order to not invoke UB, even if the keyword is not strictly required to get the code to compile.

            The general rule of thumb is that safe code must not be able to invoke UB.

            • viraptor 4 days ago

              Yes. I was objecting to the parent poster's "can and should be" which sounds like they think people just randomly choose where to use the unsafe decoration.

              • dwattttt 4 days ago

                The situation seems reminiscent of "using File::open to modify /proc/self/mem". It's safe to work with files, except there's this file that lets you directly violate memory safety.

              • aw1621107 4 days ago

                I can't say I got the same feeling. To me, the "Functions like that" lead-in indicated the opposite if anything since it implies some kind of reasoned consideration of what the function is doing.

        • weebull 4 days ago

          So if you're writing a device driver in rust...

          - Hardware access is unsafe - Kernel interface is unsafe

          How much remains in the layer in-between that's actually safe?

          • viraptor 4 days ago

            All logic, all state management, all per-device state machines, all command parsing and translation, all data queues, etc. Look at the examples people posted in other comments.

            • josephg 4 days ago

              Yep. Its kind of remarkable just how little unsafe code you often need in cases like this.

              I ported a C skip list implementation to rust a few years ago. Skip lists are like linked lists, but where instead of a single "next" pointer, each node contains an array of them. As you can imagine, the C code is packed full of fiddly pointer manipulation.

              The rust port certainly makes use of a fair bit of unsafe code. But the unsafe blocks still make up a surprisingly small minority of the code.

              Porting this package was one of my first experiences working with rust, and it was a big "aha!" moment for me. Debugging the C implementation was a nightmare, because a lot of bugs caused obscure memory corruption problems. They're always a headache to track down. When I first ported the C code to rust, one of my tests segfaulted. At first I was confused - rust doesn't segfault! Then I realised it could only segfault from a bug in an unsafe block. There were only two unsafe functions it could be, and one obvious candidate. I had a read of the code, and spotted the error nearly immediately. The same bug would probably have taken me hours to fix in C because it could have been anywhere. But in rust I found and fixed the problem in a few minutes.

      • umanwizard 4 days ago

        In normal user-mode rust, not running inside the kernel at all, you can open /dev/mem and write whatever you want to any process's memory (assuming you are root). This does not require "unsafe" at all.

        Another thing you can do from rust without "unsafe": output some buggy source code that invokes UB in a language like C to a file, then shell out to the compiler to compile that file and run it.

        • johncolanduoni 4 days ago

          Sure, but those are non-central to what the program is doing. Writing to the wrong register offset and hosing main memory is a thing that happens when developing drivers (though usually it breaks obviously during testing).

          • umanwizard 3 days ago

            Right, you're not wrong that this is a possible failure mode which Rust's guarantees don't prevent.

            I'm just pointing out that "your program manipulates the external system in such a way that UB is caused" is outside the scope of Rust's guarantees, and kernel development doesn't fundamentally change that (even though it might make it easier to trigger). Rust's guarantees are only about what the Rust code does; anything else would be hard or impossible to guarantee and Rust doesn't try to do so.

  • jdub 4 days ago

        unsafe {
            // this is normal Rust code, you can write as much of it as you like!
            // (and you can bend some crucial safety rules)
            // but try to limit and document what you put inside an unsafe block.
            // then wrap it in a safe interface so no one has to look at it again
        }
  • Cthulhu_ 4 days ago

    Wouldn't that be by design? If it isn't pleasant, people will avoid using it if they can.

    (but as others pointed out, unsafe should only be used at the 'edges', the vast majority should never need to use unsafe)

m00dy 5 days ago

C++ devs are spinning in their graves now.

  • pjmlp 4 days ago

    Why should they?

    Other platforms don't have a leader that hates C++, and then accepts a language that is also quite complex, even has two macro systems of Lisp like wizardy, see Serde.

    OSes have been being written with C++ on the kernel, since the late 1990's, and AI is being powered by hardware (CUDA) that was designed specifically to accomodate C++ memory model.

    Also Rust compiler depends on a compiler framework written in C++, without it there is no Rust compiler, and apparently they are in no hurry to bootstrap it.

  • blub 3 days ago

    C++ devs don’t care what the Linux kernel’s written in.

    But I did see an interesting comment from another user here which also reflects my feelings: Rust is pushed aggressively with different pressure tactics. Another comment pointed out that Rust is not about Rust programmers writing more Rust, but “Just like a religion it is about what other people should do.”.

    I’ve been reading about this Rust-in-the-kernel topic since the beginning, without getting involved. One thing that struck me is the obvious militant approach of the rustafarians, criticizing existing maintainers (particularly Ts’o and other objectors), implying they’re preventing progress or out of touch.

    The story feels more like a hostile takeover attempt than technology. I also think that many C or C++ programmers don’t bother posting in this topics, so they’re at least partially echo chambers.

    • qwm 3 days ago

      That's how it feels to me. There are crucial issues, namely that there is no spec and there is only one implementation. I don't know why Linus is ok with this. I'd be fine with it if those issues were resolved, but they aren't.

      • aw1621107 3 days ago

        > There are crucial issues, namely that there is no spec and there is only one implementation. I don't know why Linus is ok with this.

        I can try to provide a (weak) steelman argument:

        Strictly speaking, neither the lack of a spec nor a single implementation have been blockers for Linux's use of stuff, either now or in the past. Non-standard GCC extensions and flags aren't exactly rare in the kernel, and Linus has been perfectly fine with the single non-standard implementation of those. Linus has also stated in the past (paraphrasing) that what works in practice is more important than what standards dictate [0]. Perhaps Linus feels that what Rust does in practice is good enough, especially given its (currently) limited role in the kernel.

        Granted, not having a spec for individual flags/features is not equivalent to not having a spec for the language, so it's not the strongest argument as I said. I do think there's a point nestled in there though - perhaps what happens on the ground is the most important factor. It probably helps that there is work being done on both the spec and multiple implementation fronts.

        [0]: https://lkml.org/lkml/2018/6/5/769

  • sho_hn 5 days ago

    Or installing Haiku!

  • RGBCube 4 days ago

    The C++ that have the humility to realize are using Rust.

    • pjmlp 4 days ago

      Nah, they just smile when they see LLVM and GCC on Rust build dependencies. :)

      • josephg 4 days ago

        Yeah they’re all just tools. From a technical perspective, rust, C and C++ work together pretty well. Swift too. LLVM LTO can even do cross language inlining.

        I don’t think C++ is going anywhere any time soon. Not with it powering all the large game engines, llvm, 30 million lines of google chrome and so on. It’s an absolute workhorse.

  • lII1lIlI11ll 4 days ago

    The kernel is mostly C code, not C++.

    • 9rx 4 days ago

      Hence the previous comment. If Linux was (partially) written in C++, it would no longer work.

shmerl 4 days ago

The title sounded worse than it is.

markus_zhang 5 days ago

Not a system programmer -- at this point, does C hold any significant advantage over Rust? Is it inevitable that everything written in C is going to be gradually converted to safer languages?

  • jcranmer 5 days ago

    C currently remains the language of system ABIs, and there remains functionality that C can express that Rust cannot (principally bitfields).

    Furthermore, in terms of extensions to the language to support more obtuse architecture, Rust has made a couple of decisions that make it hard for some of those architectures to be supported well. For example, Rust has decided that the array index type, the object size type, and the pointer size type are all the same type, which is not the case for a couple of architectures; it's also the case that things like segmented pointers don't really work in Rust (of course, they barely work in C, but barely is more than nothing).

    • raggi 5 days ago

      That first sentence though. Bitfields and ABI alongside each other.

      Bitfield packing rules get pretty wild. Sure the user facing API in the language is convenient, but the ABI it produces is terrible (particularly in evolution).

      • mjevans 4 days ago

        I would like a revision to bitfields and structs to make them behave the way a programmer things, with the compiler free to suggest changes which optimize the layout. As well as some flag that indicates the compiler should not, it's a finalized structure.

    • vlovich123 4 days ago

      Can you expand on bitfields? There’s crates that implement bitfield structs via macros so while not being baked into the language I’m not sure what in practice Rust isn’t able to do on that front.

      • structural 4 days ago

        Now, try and use two or more libraries that expose data structures with bitfields, and they have all chosen different crates for this (or even the same crate but different, non-ABI-compatible-versions of it).

        There's a ton of standardization work that really should be done before these are safe for library APIs. Mostly fine to just write an application that uses one of these crates though.

      • ZeWaka 4 days ago

        Yeah, not sure what they're saying... I use bitfields in multiple of my rust projects using those macros.

        • maweki 4 days ago

          I'm not a rust or systems programmer but I think it meant that as an ABI or foreign function interface bitfields are not stable or not intuitive to use, as they can't be declared granularily enough.

          • SAI_Peregrinus 4 days ago

            C's bit-fields ABI isn't great either. In particular, the order of allocation of bit-fields within a unit and alignment of non-bit-field structure members are implementation defined (6.7.2.1). And bit-fields of types other than `_Bool`, `signed int` and `unsigned int` are extensions to the standard, so that somewhat limits what types can have bitfields.

        • pjmlp 4 days ago

          Across binary libraries ABI, regardless of static or dynamically linked?

          • bigstrat2003 4 days ago

            Dynamic linking is not something you do in general in Rust. It's possible, but the compiler currently does not guarantee a stable ABI so it's not something one generally does.

    • kbolino 5 days ago

      I'm genuinely surprised that usize <=> pointer convertibility exists. Even Go has different types for pointer-width integers (uintptr) and sizes of things (int/uint). I can only guess that Rust's choice was seen as a harmless simplification at the time. Is it something that can be fixed with editions? My guess is no, or at least not easily.

      • jcranmer 4 days ago

        There is a cost to having multiple language-level types that represent the exact same set of values, as C has (and is really noticeable in C++). Rust made an early, fairly explicit decision that a) usize is a distinct fundamental type from the other types, and not merely a target-specific typedef, and b) not to introduce more types for things like uindex or uaddr or uptr, which are the same as usize on nearly every platform.

        Rust worded in its initial guarantee that usize was sufficient to roundtrip a pointer (making it effectively uptr), and there remains concern among several of the maintainers about breaking that guarantee, despite the fact that people on the only target that would be affected basically saying they'd rather see that guarantee broken. Sort of the more fundamental problem is that many crates are perfectly happy opting out of compiling for weirder platform--I've designed some stuff that relies on 64-bit system properties, and I'd rather like to have the ability to say "no compile for you on platform where usize-is-not-u64" and get impl From<usize> for u64 and impl From<u64> for usize. If you've got something like that, it also provides a neat way to say "I don't want to opt out of [or into] compiling for usize≠uptr" and keeping backwards compatibility.

        If you want to see some long, gory debates on the topic, https://internals.rust-lang.org/t/pre-rfc-usize-is-not-size-... is a good starting point.

        • zozbot234 4 days ago

          > ...not to introduce more types for things like uindex or uaddr or uptr, which are the same as usize on nearly every platform. ... there remains concern among several of the maintainers about breaking that guarantee, despite the fact that people on the only target that would be affected basically saying they'd rather see that guarantee broken.

          The proper approach to resolving this in an elegant way is to make the guarantee target-dependent. Require all depended-upon crates to acknowledge that usize might differ from uptr in order to unlock building for "exotic" architectures, much like how no-std works today. That way "nearly every platform" can still rely on the guarantee with no rise in complexity.

        • kbolino 4 days ago

          I brought up Go because it was designed around the same time and, while it gets a lot of flack for some of its other design decisions, this particular one seems prescient. However, I would be remiss if I gave the impression that the reasoning behind the decision was anticipation of some yet unseen future; the reality was that int and uint (which are not aliases for sized intN or uintN) were not initially the same as ptrdiff_t and size_t (respectively) on all platforms. Early versions of Go for 64-bit systems had 32-bit int and uint, so naturally uintptr had to be different (and it's also not an alias). It was only later that int and uint became machine-word-sized on all platforms and so made uintptr seem a bit redundant. However, this distinction is fortuitous for CHERI etc. support. Still, Go on CHERI with 128-bit uintptr might break some code, however such code is likely in violation of the unsafe pointer rules anyway: https://pkg.go.dev/unsafe#Pointer

          Yet Rust is not Go and this solution is probably not the right one for Rust. As laid out in a link on a sibling comment, one possibility is to do away with pointer <=> integer conversions entirely, and use methods on pointers to access and mutate their addresses (which may be the only thing they represent on some platforms, but is just a part of their representation on others). The broader issue is really about evolving the language and ecosystem away from the mentality that "pointers are just integers with fancy sigil names".

        • torginus 4 days ago

          I'd say, that even more than pointer sizes, the idea that a pointer is just a number really needs to die, and is in no way a forward looking decision expected of a modern language.

          Pointers should at no point be converted into numbers and back as that trips up many assumptions (special runtimes, static/dynamic analysis tools, compiler optimizations).

          Additionally, I would make it a priority that writing FFIs should be as easy as possible, and requires as little human deliberation as possible. Even if Rust is safe, its safety can only be assumed as long as the underlying external code upholds the invariants.

          Which is a huge risk factor for Rust, especially in today's context of the Linux kernel. If I have an object created/handled by external native code, how do I make sure that it respects Rust's lifetime/aliasing rules?

          What's the exact list of rules my C code must conform to?

          Are there any static analysis/fuzzing tools that can verify that my code is indeed compliant?

          • kevin_thibedeau 4 days ago

            C doesn't require convertibility to an integer and recognizes that pointers may have atypical representations. Casting to integer types has always been implementation defined. [u]intptr_t is optional specifically to allow such platforms to claim standard conformance.

            • torginus 4 days ago

              I know, but from what you wrote, Rust kinda assumes pointers are ints (because they are the same type as array indices)

              So as to not only hate on Rust, I want to remark, that baking in the idea that pointers can be used for arithmetic isn't a good one as well.

          • jpc0 4 days ago

            > Which is a huge risk factor for Rust, especially in today's context of the Linux kernel. If I have an object created/handled by external native code, how do I make sure that it respects Rust's lifetime/aliasing rules?

            Can you expand on this point? Like are you worried about whether the external code is going to free the memory out from under you? That is part of a guarantee, the compiler cannot guarantee what happens at runtime no matter what the author of a language wants, the CPU will do what it's told, it couldn't care about Rusts guarantees even if you built your code entirely with rust.

            When you are interacting with the real world and real things you need to work with different assumptions, if you don't trust that the data will remain unmodified then copy it.

            No matter how many abstractions you put on top of it there is still lighting in a rock messing with 1s and 0s.

      • aw1621107 4 days ago

        > Is it something that can be fixed with editions? My guess is no, or at least not easily.

        Assuming I'm reading these blog posts [0, 1] correctly, it seems that the size_of::<usize>() == size_of::<*mut u8>() assumption is changeable across editions.

        Or at the very least, if that change (or a similarly workable one) isn't possible, both blog posts do a pretty good job of pointedly not saying so.

        [0]: https://faultlore.com/blah/fix-rust-pointers/#redefining-usi...

        [1]: https://tratt.net/laurie/blog/2022/making_rust_a_better_fit_...

        • kbolino 4 days ago

          Great info!

          Personally, I like 3.1.2 from your link [0] best, which involves getting rid of pointer <=> integer casts entirely, and just adding methods to pointers, like addr and with_addr. This needs no new types and no new syntax, though it does make pointer arithmetic a little more cumbersome. However, it also makes it much clearer that pointers have provenance.

          I think the answer to "can this be solved with editions" is more "kinda" rather than "no"; you can make hard breaks with a new edition, but since the old editions must still be supported and interoperable, the best you can do with those is issue warnings. Those warnings can then be upgraded to errors on a per-project basis with compiler flags and/or Cargo.toml options.

          • aw1621107 4 days ago

            > Personally, I like 3.1.2 from your link [0] best, which involves getting rid of pointer <=> integer casts entirely, and just adding methods to pointers, like addr and with_addr. This needs no new types and no new syntax, though it does make pointer arithmetic a little more cumbersome. However, it also makes it much clearer that pointers have provenance.

            Provenance-related work seems to be progressing at a decent pace, with some provenance-related APIs stabilized in Rust 1.84 [0, 1].

            [0]: https://blog.rust-lang.org/2025/01/09/Rust-1.84.0/

            [1]: https://doc.rust-lang.org/std/ptr/index.html#provenance

            • kbolino 4 days ago

              Indeed, the only missing piece really then is the ability to warn/error when exposed provenance and/or as-casts are used.

          • zozbot234 4 days ago

            AIUI, this particular change would only impact some newly supported architectures going forward. These don't need to be buildable with older editions.

            • kbolino 4 days ago

              This feels antithetical to two of the main goals of editions.

              One of those goals is that code which was written for an older edition will continue to work. You should never be forced to upgrade editions, especially if you have a large codebase which would require significant modifications.

              The other goal is that editions are interoperable, i.e. that code written for one edition can rely on code written for a different edition. Editions are set on a per-crate basis, this seems to be the case for both rustc [1] and of course cargo.

              As I see it, what you're saying would mean that code written for this new edition initially couldn't use most of the crates on crates.io as dependencies. This would then create pressure on those crates' authors to update their edition. And all of this would be kind of pointless fragmentation and angst, since most of those crates wouldn't be doing funny operations on pointers anyway. It might also have the knock-on effect of making new editions much more conservative, since nobody would want to go through that headache again, thus undermining another goal of editions.

              [1]: https://rustc-dev-guide.rust-lang.org/guides/editions.html

              • zozbot234 4 days ago

                If the part about how "most of those crates wouldn't be doing funny operations on pointers" can be verified automatically in a way that preserves safety guarantees when usize != uaddr/uptr, these crates can continue to build without transitioning to a newer edition. Otherwise, upgrading these crates is the right move. Other code targeting earlier editions of Rust would still build, they would simply need a compiler version update when depending on the newly-upgraded crates.

    • gf000 4 days ago

      > that C can express that Rust cannot

      The reverse is probably more true, though. Rust has native SIMD support for example, while in standard C there is no way to express that.

      'C is not a low-level language' is a great blog post about the topic.

      • exDM69 4 days ago

        > Rust has native SIMD support

        std::simd is nightly only.

        > while in standard C there is no way to express that.

        In ISO Standard C(++) there's no SIMD.

        But in practice C vector extensions are available in Clang and GCC which are very similar to Rust std::simd (can use normal arithmetic operations).

        Unless you're talking about CPU specific intrinsics, which are available to in both languages (core::arch intrinsics vs. xmmintrin.h) in all big compilers.

      • ndiddy 4 days ago

        AFAIK std::simd is still nightly only. You can use the raw intrinsics in std::arch, but that's not any better than "#include <immintrin.h>".

      • kristianp 4 days ago

        So use the fairly common SIMD extensions in C, that's not much of an argument.

    • dataflow 5 days ago

      In what architecture are those types different? Is there a good reason for it there architecturally, or is it just a toolchain idiosyncrasy in terms of how it's exposed (like LP64 vs. LLP64 etc.)?

      • jcranmer 5 days ago

        CHERI has 64-bit object size but 128-bit pointers (because the pointer values also carry pointer provenance metadata in addition to an address). I know some of the pointer types on GPUs (e.g., texture pointers) also have wildly different sizes for the address size versus the pointer size. Far pointers on segmented i386 would be 16-bit object and index size but 32-bit address and pointer size.

        There was one accelerator architecture we were working that discussed making the entire datapath be 32-bit (taking less space) and having a 32-bit index type with a 64-bit pointer size, but this was eventually rejected as too hard to get working.

        • sroussey 4 days ago

          I guess today, instead of 128bit pointers we have 64bit pointers and secret provenance data inside the cpu, at least on the most recent shipped iPhones and Macs.

          In the end, I’m not sure that’s better, or maybe we should have had extra large pointers again (in that way back 32bit was so large we stuffed other stuff in there) like CHERI proposes (though I think it still has secret sidecar of data about the pointers).

          Would love to Apple get closer to Cheri. They could make a big change as they are vertically integrated, though I think their Apple Silicon for Mac moment would have been the time.

          I wonder what big pointers does to performance.

    • yencabulator 3 days ago

      > For example, Rust has decided that the array index type, the object size type, and the pointer size type are all the same type, [...]

      Not really, at least not anymore: https://doc.rust-lang.org/std/ptr/index.html#provenance

      This is also how Rust will work on CHERI. You can run your pointer-fiddling code in Miri today to check that you're following the rules.

    • throw_a_grenade 4 days ago

      Also you can't do self-referential strutcs.

      Double-linked lists are also pain to implement, and they're are heavily used in kernel.

      • K0nserv 4 days ago

        > Also you can't do self-referential strutcs.

        You mean in safe rust? You can definitely do self-referential structs with unsafe and Pin to make a safe API. Heck every future generated by the compiler relies on this.

    • qwm 3 days ago

      Correct. C has a mostly standardized ABI, Rust does not. C has a spec, Rust does not. That matters in things like kernels.

  • drnick1 5 days 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 5 days ago

      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 4 days ago

        Java hasn't ever been essential outside enterprise-y servers and those don't care about "any viable system".

      • qalmakka 4 days ago

        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 days ago

        A system only needs one programming language to be useful, and when there's only one it's basically always C.

        • trinix912 4 days ago

          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.

      • teruakohatu 4 days ago

        > 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?

      • eru 4 days ago

        > 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 4 days ago

        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.

      • oblio 4 days ago

        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 4 days ago

        Debian and Ubuntu enter the chat.....

      • pantalaimon 4 days ago

        I don't think Perl comes pre installed on any modern system anymore

    • brokencode 5 days ago

      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 4 days ago

        I wouldn't be surprised to see zig in the kernel at some point

        • eru 4 days ago

          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.

          • weebull 4 days ago

            I personally feel the Zig is a much better fit to the kernel. It's C interoperability is far better than Rust's, it has a lower barrier to entry for existing C devs and it doesn't have the constraints the Rust does. All whilst still bringing a lot of the advantages.

            ...to the extent I could see it pushing Rust out of the kernel in the long run. Rust feels like a sledgehammer to me where the kernel is concerned.

            It's problem right now is that it's not stable enough. Language changes still happen, so it's the wrong time to try.

            • agentultra 4 days ago

              From a safety perspective there isn't a huge benefit to choosing Zig over C with the caveat, as others have pointed out, that you need to enable more tooling in C to get to a comparable level. You should be using -Wall and -fsanitize=address among others in your debug builds.

              You do get some creature comforts like slices (fat pointers) and defer (goto replacement). But you also get forced to write a lot of explicit conversions (I personally think this is a good thing).

              The C interop is good but the compiler is doing a lot of work under the hood for you to make it happen. And if you export Zig code to C... well you're restricted by the ABI so you end up writing C-in-Zig which you may as well be writing C.

              It might be an easier fit than Rust in terms of ergonomics for C developers, no doubt there.

              But I think long-term things like the borrow checker could still prove useful for kernel code. Currently you have to specify invariants like that in a separate language from C, if at all, and it's difficult to verify. Bringing that into a language whose compiler can check it for you is very powerful. I wouldn't discount it.

            • brokencode 4 days ago

              I’m not so sure. The big selling point for Rust is making memory management safe without significant overhead.

              Zig, for all its ergonomic benefits, doesn’t make memory management safe like Rust does.

              I kind of doubt the Linux maintainers would want to introduce a third language to the codebase.

              And it seems unlikely they’d go through all the effort of porting safer Rust code into less safe Zig code just for ergonomics.

              • weebull 3 days ago

                > Zig, for all its ergonomic benefits, doesn’t make memory management safe like Rust does.

                Not like Rust does, no, but that's the point. It brings both non-nullable pointers and bounded pointers (slices). They solve a lot of problem by themselves. Tracking allocations is still a manual process, but with `defer` semantics there are many fewer foot guns.

                > I kind of doubt the Linux maintainers would want to introduce a third language to the codebase.

                The jump from 2 to 3 is smaller than the jump from 1 to 2, but I generally agree.

              • eru 4 days ago

                > I kind of doubt the Linux maintainers would want to introduce a third language to the codebase.

                That was where my argument was supposed to go. Especially a third language whose benefits over C are close enough to Rust's benefits over C.

                I can picture an alternate universe where we'd have C and Zig in the kernel, then it would be really hard to argue for Rust inclusion.

                (However, to be fair, the Linux kernel has more than C and Rust, depending on how you count, there are quite a few more languages used in various roles.)

        • littlestymaar 4 days ago

          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 4 days ago

            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 days ago

              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)

            • littlestymaar 4 days ago

              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).

            • Ygg2 4 days ago

              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.

              • NetMageSCW 4 days ago

                “by removing the nastiest class of security vulnerabilities” and “reduce the likelihood” don’t seem to be in the same neighborhood.

                • brokencode 4 days ago

                  If you are reducing the likelihood of something by 99%, you are basically eliminating it. Not fully, but it’s still a huge improvement.

                  It reminds me of this fun question:

                  What’s the difference between a million dollars and a billion dollars? A billion dollars.

                  A million dollars is a lot of money to most people, but it’s effectively nothing compared to a billion dollars.

                • littlestymaar 4 days ago

                  Dividing their number by 1000[1] is technically the later but in practice it's pretty much the former.

                  [1]: this the order of magnitude presented in the recent Android blog post: https://security.googleblog.com/2025/11/rust-in-android-move...

                  > Our historical data for C and C++ shows a density of closer to 1,000 memory safety vulnerabilities per MLOC. Our Rust code is currently tracking at a density orders of magnitude lower: a more than 1000x reduction.

                • Ygg2 4 days ago

                  In theory they are the same statement; in practice there is 0.01% chance someone wrote unsound code.

            • bmicraft 4 days ago

              "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 days ago

              You can absolutely write drivers with zero unsafe Rust. The bridge from Rust to C is where unsafe code lies.

              • weebull 4 days ago

                And hardware access. You absolutely can't write a hardware driver without unsafe.

                • bonzini 4 days ago

                  There are devices that do not have access to memory, and you can write a safe description of such a device's registers. The only thing that is inherently unsafe is building DMA descriptors.

          • brabel 4 days ago

            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 4 days ago

              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).

    • vlovich123 5 days ago

      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 5 days ago

        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 4 days ago

          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 5 days ago

        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 4 days ago

          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)

          • MobiusHorizons 4 days ago

            It’s still C though, and rust is not an option. What else would you call it? Lots of c libraries for embedded target C89 syntax for exactly these reasons. Also for what it’s worth, SDCC seems to support very modern versions of C (up to C23), so I also don’t think that critique is very valid for the 8051 or stm8. I would argue that c was built with targets like this in mind and it is where many of its quirks that seem so anachronistic today come from (for example int being different sizes on different targets)

      • pjmlp 4 days ago

        Commercial embedded OSes, game consoles, for example.

        • vlovich123 4 days ago

          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 4 days ago

            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 4 days ago

            > 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.

            • pjmlp 4 days ago

              Not only Unity, Capcom is using their own fork of .NET in their game engine.

              Devil May Cry for the Playstation 5 was shipped with it.

    • pjmlp 4 days ago

      As mentioned in another thread, POSIX requires the presence of a C compiler,

      https://pubs.opengroup.org/onlinepubs/9799919799/utilities/c...

      • eru 4 days ago

        Though to be fair, POSIX is increasingly outdated.

        • pjmlp 4 days ago

          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.

          • eru 4 days ago

            > GNU/Linux isn't the only system out there, [...]

            Yes? I'm especially keen on the project to make just 'Linux' without any Gnu components. Jokes aside, yes, other operating systems exist.

            > [...] and yes some parts of it are outdated in modern platforms, especially Apple, Google, Microsoft OSes and Cloud infrastructure.

            Well, also on modern hardware in general. POSIX's idea about storage abstractions don't gel well with modern hardware. Well, not just modern hardware: atime has been cast aside since time immemorial. But lots of the other ideas are also dropping by the wayside.

            In practice, we get something like 'POSIX-y' or 'close-enough-to-POSIX', which doesn't get a stamp from OpenGroup. I think Linux largely falls in that boat.

            But regardless of that distinction, a C compiler is very much part of the informal 'close-enough-to-POSIX' class.

            It's a bit of a shame that Unix has retarded operating system research for so long. Fortunately, the proliferation of virtual machines and hypervisors have re-invigorated the field. Just pretend that your hypervisor is your nano-kernel and your VMs are your processes. No need to run a full on Linux kernel in your VM, you can just have enough code running for your webserver or database etc, no general kernel needed. See eg https://mirage.io/

    • thayne 5 days ago

      > 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 4 days ago

        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.

        • dwattttt 4 days ago

          It's been mentioned obliquely, but what's considered "part of the compilation process" is different between Rust and C.

          Most of the examples of "this is what makes Rust compilation slow" are code generation related; for example, a Rust proc_macro making compilation slow would be equivalent to C building a code generator (for schemas? IDLs?), running it, then compiling the output along with its user.

        • gf000 4 days ago

          Runtime memory issues probably have a significantly higher total cost.

          But of course that doesn't negate this cost, but building can always be done on another machine as a way to circumvent the problem.

      • Yiin 4 days ago

        typescript transpilation to js is nearly instant, it's not comparable

        • thayne 4 days ago

          Rust compilation is also almost instant, if you have a relatively small project.

          It's only when you get very large projects that compilation time becomes a problem.

          If typescript compilation speed wasn't a problem, then why would Microsoft put resources into rewriting the tyescript compiler in Go to make it faster[1]?

          [1]: https://github.com/microsoft/typescript-go

        • baq 4 days ago

          Good to know, my $DAYJOB project unfortunately isn’t as well informed and we have to use esbuild just to survive.

    • AceJohnny2 4 days ago

      > 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

      • qwm 3 days ago

        Sure, but the reason tends to be that if you want something to run everywhere, C is your best bet.

    • blintz 4 days ago

      Doesn’t rustc emit LLVM IR? Are there a lot of systems that LLVM doesn’t support?

      • loeg 4 days ago

        There are a number of oddball platforms LLVM doesn't support, yeah.

      • aw1621107 4 days ago

        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 4 days ago

        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 4 days ago

          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 4 days ago

          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.

          • einpoklum 4 days ago

            > If you're developing, you generally have control over the development environment

            If you're developing something individually, then sure, you have a lot of control. When you're developing as part of an organization or a company, you typically don't. And if there's non-COTS hardware involved, you are even more likely not to have control.

    • archargelod 4 days ago

      One problem of Rust vs C, I rarely see mentioned is that Rust code is hard to work with from other languages. If someone writes a popular C library, you can relatively easily use it in your Java, D, Nim, Rust, Go, Python, Julia, C#, Ruby, ... program.

      If someone writes a popular Rust library, it's only going to be useful to Rust projects.

      With Rust I don’t even know if it’s possible to make borrow checking work across a language boundary. And Rust doesn't have a stable ABI, so even if you make a DLL, it’ll only work if compiled with the exact same compiler version. *sigh*

      • aw1621107 4 days ago

        The reason you rarely hear that mentioned is because basically every programming language is hard to work with from other languages. The usual solution is to "just" expose a C API/ABI.

        Of course, C API/ABIs aren't able to make full use of Rust features, but again, that also applies to basically every other language.

      • sophacles 4 days ago

        Perhaps we can finally stop defining abis in terms of c structs!

    • mustache_kimono 4 days ago

      > 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 4 days ago

        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 :/

        • bigyabai 4 days ago

          > 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 4 days ago

            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.

            • bigyabai 4 days ago

              Which is neat! But if you care about performance, you're probably using Clang to compile for your esoteric architecture. And if your esoarch already supports LLVM... might as well write Rust instead.

            • qwm 3 days ago

              Unreasonably good at writing compilers? Not in my experience lol.

        • mustache_kimono 4 days ago

          > 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 4 days ago

            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.

            • mustache_kimono 4 days ago

              > I'm curious as to which other metric you'd use to define successful? If it actual usage, C still wins.

              Wait, wait, you can use C everywhere, but if absolute lines of code is the metric, people seem to move away from C as quickly as possible (read: don't use C) to higher level languages that clearly aren't as portable (Ruby, Python, Java, C#, C++, etc.)?

              > 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.

              Re: embedded, this is just terribly short sighted. Right now, yes, C obviously has the broadest possible support. But non-experimental Linux support starts today. GCC is still working on Rust support and rust_codegen_gcc is making in roads. And one can still build new LLVM targets. I'd be interested to hear what non-legacy platforms actually aren't supported right now.

              But the real issue is that C has no adoption curve. It only has ground to lose. Meanwhile Rust is, relatively, a delight to use, and offers important benefits. As I said elsewhere: "Unless I am wrong, there is still lots of COBOL we wish wasn't COBOL? And that reality doesn't sound like a celebration of COBOL?" The future looks bright for Rust, if you believe as I do, we are beginning to demand much more from our embedded parts.

              Now, will Rust ever dominate embedded? Will it be used absolutely everywhere? Perhaps not. Does that matter? Not AFAIAC. Winning by my lights is -- using this nice thing rather than this not so nice thing. It's doing interesting things where one couldn't previously. It's a few more delighted developers.

              I'd much rather people were delighted/excited about a tech/a language/a business/a vibrant community, than, whatever it is, simply persisted. Because "simply persisted", like your comment above, is only a measure of where we are right now.

              Another way to think of this is -- Perl is also everywhere. Shipped with every Linux distro and MacOS, probably to be found somewhere deep inside Windows too. Now, is Perl, right now, a healthy community or does it simply persist? Is its persistence a source of happiness or dread?

              • NetMageSCW 4 days ago

                Why do you think people are delighted/excited about Rust? Some people are, but I’m sure plenty of people are about C and Perl is well. Some people isn’t most people and certainly not all people.

                • mustache_kimono 4 days ago

                  > Some people isn’t most people and certainly not all people.

                  I never said Rust was the universal language, that is pleasing to all people. I was very careful to frame Rust's success in existential, not absolute or universal, terms:

                  >> Winning by my lights is -- using this nice thing rather than this not so nice thing. It's doing interesting things where one couldn't previously. It's a few more delighted developers.

                  I am not saying these technologies (C and Perl) should go away. I am saying -- I am very pleased there is no longer a monoculture. For me, winning is having alternatives to C in embedded and kernel development, and Perl for scripting, especially as these communities, right now, seem less vibrant, and less adaptable to change.

          • qwm 3 days ago

            Yes, that is success. A pretty large degree of success.

          • AceJohnny2 4 days ago

            ... yes?

            • mustache_kimono 4 days ago

              >> Yes, you can use it everywhere. Is that what you consider a success?

              > ... yes?

              Then perhaps you and I define success differently? As I've said in other comments above, C persisting or really standing still is not what I would think of as a winning and vibrant community. And the moving embedded and kernel development from what was previously a monoculture to something more diverse could be a big win for developers. My hope is that competition from Rust makes using C better/easier/more productive, but I have my doubts as to whether it will move C to make changes.

              • qwm 3 days ago

                Sometimes it's nice to know that something will run and compile reliably far into the future. That's a nice thing to have, and wide support for the language and its relatively unchanging nature make it reliable.

                • mustache_kimono 3 days ago

                  > Sometimes it's nice to know that something will run and compile reliably far into the future.

                  I'm not sure why you think this is a problem that Rust has? Perhaps you mean something different but the Rust project compiles available code on crate.io upon the release of a new version.[0] C compilers may imagine their new compiler code doesn't break old software, but Rust takes that extra step, so we know it won't.

                  Now, the Rust kernel is currently using beta and nightly features which are on track for inclusion in the stable Rust compiler. So, yes, right now compilation is tied to a specific kernel version, and may need to be updated if a feature changes. However, any C compiler used to compile the Linux kernel uses non-standard GCC extensions only recently adopted by clang. Imagine if the C standards committee chose to change the syntax/sematics of a non-standard extension. Do you not imagine the non-standard extension would also be similarly deprecated?

                  The issue seems to be Rust is telling you what is non-standard, and you're yelling "Look it's non-standard!". But consider that the kernel in practice is using lots of non-standard features, and should the C standard simply adopt this non-standard behavior that means likely having to changes lots of code.

                  [0]: https://github.com/rust-lang/crater

      • johncolanduoni 4 days ago

        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 days ago

          > 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 4 days ago

            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.

        • maccard 4 days ago

          How many of them are running Linux, and how many of them are running a modern kernel?

          • johncolanduoni 4 days ago

            Almost none of them, but that doesn’t make them “places no one uses”, considering everyone who can see these words is looking at a device with a bunch of C firmware running on microcontrollers all over the place.

            • maccard 3 days ago

              > but that doesn’t make them “places no one uses

              You're putting words in my mouth there - that's not my point.

              My point is that if they're not running linux, and the ones that are aren't running a modern kernel, then we shouldn't hold back development of modern platforms for ones that refuse to keep up.

  • biorach 4 days ago

    There are certain styles of programming and data structure implementations that end up requiring you to fight Rust at almost every step. Things like intrusive data structures, pointer manipulation and so on. Famously there is an entire book online on how to write a performant linked list in idiomatic Rust - something that is considered straightforward in C.

    For these cases you could always use Zig instead of C

    • pjmlp 4 days ago

      Given Zig's approach to safety, you can get the same in C with static and runtime analysis tools, that many devs keep ignoring.

      Already setting the proper defaults on a Makefile would get many people half way there, without changing to language yet to be 1.0, and no use-after-free story.

      • metaltyphoon 4 days ago

        > many devs keep ignoring

        And thats why Zig don’t offer much. Devs will just ignore it.

    • wiz21c 4 days ago

      it is not straightforward in rust because the linked list is inherently tricky to implement correctly. Rust makes that very apparent (and, yeah, a bit too apparent).

      I know, a linked list is not exactly super complex and rust makes that a bit tough. But the realisation one must have is this: building a linked list will break some key assumptions about memory safety, so trying to force that into rust is just not gonna make it.

      Problem is I guess that for several of us, we have forgotten about memory safety and it's a bit painful to have that remembered to us by a compiler :-)

      • delamon 4 days ago

        Can you elaborate, what key assumptions about memory safety linked lists break? Sure, double linked lists may have non-trivial ownership, but that doesn't compromise safety.

        • estebank 4 days ago

          Rust wants all memory to be modeled as an ownership tree: the same bit of memory can't be owned by more than one data structure. A doubly linked list breaks that requirement so it can't be modeled in safe Rust directly. The options are using unsafe, or using one of the pointer wrapper types that have runtime checks that ensure correct behavior and own the underlying memory as far Rust is concerned.

          • delamon 3 days ago

            Right. So it is not that double-linked lists are inherently unsafe, it is (just) Rust ownership model cannot represent them (any other cyclic structures).

            • wiz21c 3 days ago

              It's not that it cannot, it just doesn't want to :-) (but you're right). I guess that in this very case of DLL, it's a bit hard to swallow. To be honest, it's because the rest of rust really helps me in other areas of my projects that I have accepted that. Learning the ownership model of rust is really painful, it really forces you to code in its way and it was not pleasant to me.

              • delamon 3 days ago

                I've been trying to convert to Rust an in-memory database and failed. It is strictly single-threaded and full of intrusive lists. I tried hard to please borrow-checker, but one have little choice when internal structures are full of cycles. The result was ugly mess of Rc all over the place. I guess it is just an example of a problem that doesn't fit Rust well.

                This makes me wonder: what performance cost Rust code pay due to inability represent cyclic structures efficiently? It seems people tend to design their data in way to please Rust and not in way that would be otherwise more performance efficient.

                • steveklabnik 3 days ago

                  Using Rc doesn't sound like an intrusive list to me. Personally I find tons of Rcs to be messy, so I'd agree with you.

                  > what performance cost Rust code pay due to inability represent cyclic structures efficiently?

                  You can still write the code you'd write in C with unsafe. There's no inherent loss left on the table.

                  Furthermore, a lot of C folks reach for intrusive lists because it's easy in C, but that doesn't mean that it's always the most performant. See https://bcantrill.dtrace.org/2018/09/28/the-relative-perform... as an example of this phenomenon.

          • zozbot234 4 days ago

            You can do it by combining ghostcell/qcell along with some bespoke "static/compile-time reference counting" for the double links part. But ghostcell/qcell is quite difficult to use with Rust's current feature set (it has to use lifetime hacks to place a safe "brand" on type instantiations, a kind of quasi-capability construct), so it hasn't become a part of standard rust so far.

    • ViewTrick1002 4 days ago

      Or just build a tested unsafe implementation as a library. For example the Linked List in the standard library.

      https://doc.rust-lang.org/src/alloc/collections/linked_list....

      • biorach 4 days ago

        Yeah, if you need a linked list (you probably don't) use that. If however you are one of the very small number of people who need fine-grained control over a tailored data-structure with internal cross-references or whatnot then you may find yourself in a world where Rust really does not believe that you know what you are doing and fights you every step of the way. If you actually do know what you are doing, then Zig is probably the best modern choice. The TigerBeetle people chose Zig for these reasons, various resources on the net explain their motivations.

        • ViewTrick1002 4 days ago

          The point with the linked list is that it is perfectly valid to use unsafe to design said ”tailored data structure with internal cross-reference or what not” library and then expose a safe interface.

          If you’re having trouble designing a safe interface for your collection then that should be a signal that maybe what you are doing will result in UB when looked at the wrong way.

          That is how all standard library collections in Rust works. They’ve just gone to the length of formally verifying parts of the code to ensure performance and safety.

          • eru 4 days ago

            > If you’re having trouble designing a safe interface for your collection then that should be a signal that maybe what you are doing will result in UB when looked at the wrong way.

            Rust is great, but there are some things that are safe (and you could prove them safe in the abstract), but that you can't easily express in Rust's type system.

            More specifically, there are some some things and usage pattern of these things that are safe when taken together. But the library can't force the safe usage pattern on the client, with the tools that Rust provides.

            • ViewTrick1002 4 days ago

              If you can't create a safe interface and must have the function then create an unsafe function and clearly document the invariants and then rely on the user to uphold them?

              Take a look at the unsafe functions for the standard library Vec type to see examples of this:

              https://doc.rust-lang.org/std/vec/struct.Vec.html#method.fro...

              • eru 4 days ago

                > If you can't create a safe interface and must have the function then create an unsafe function and clearly document the invariants and then rely on the user to uphold them?

                Yes, that's what you do in practice. But it's no different--in principle--from the approach C programmers have to use.

          • bluecalm 4 days ago

            >>That is how all standard library collections in Rust works

            Yeah and that's what not going to work for high performance data structures because you need to embed hooks into the objects - not just put objects into a bigger collection object. Once you think in terms of a collection that contains things you have already lost that specific battle.

            Another thing that doesn't work very well in Rust (from my understanding, I tried it very briefly) is using multiple memory allocators which is also needed in high performance code. Zig takes care to make it easy and explicit.

      • mjlawson 4 days ago

        I think that misses the point though. C trusts you to design your own linked list.

        It also trusts your neighbor, your kid, your LLM, you, your dog, another linked list...

    • yencabulator 3 days ago

      Sure. Now import a useful performant B+tree in C from a reusable library, while enforcing type safety for your keys and values.

      Lots of things C chose to use intrusive pointers and custom data structures for, you would program very differently in a different language.

      I'm an old C neckbeard and I find Rust a great experience. Some of the arguments against it sound like people are complaining about how hard it is to run pushing a bicycle.

    • arbitrandomuser 4 days ago

      what is an intrusive data structure?

      • ahartmetz 4 days ago

        A container class that needs cooperation from the contained items, usually with special data fields. For example, a doubly linked list where the forward and back pointers are regular member variables of the contained items. Intrusive containers can avoid memory allocations (which can be a correctness issue in a kernel) and go well with C's lack of built-in container classes. They are somewhat common in C and very rare in C++ and Rust.

        • eru 4 days ago

          At least for a double linked list you can probably get pretty far in terms of performance in the non-intrusive case, if your compiler unboxes the contained item into your nodes? Or are there benefits left in intrusive data structures that this doesn't capture?

          • dzaima 4 days ago

            Storing the data in nodes doesn't work if the given structure may need to be in multiple linked lists, which iirc was a concern for the kernel?

            And generally I'd imagine it's quite a weird form for data structures for which being in a linked list isn't a core aspect (no clue what specifically the kernel uses, but I could imagine situations where where objects aren't in any linked list for 99% of time, but must be able to be chained in even if there are 0 bytes of free RAM ("Error: cannot free memory because memory is full" is probably not a thing you'd ever want to see)).

            • eru 4 days ago

              > Storing the data in nodes doesn't work if the given structure may need to be in multiple linked lists, which iirc was a concern for the kernel?

              That's a great point! A language almost like C plus a smart enough compiler could do the unboxing, but this technique doesn't work for multiple structures.

              > And generally I'd imagine it's quite a weird form for data structures for which being in a linked list isn't a core aspect (no clue what specifically the kernel uses, but I could imagine situations where where objects aren't in any linked list for 99% of time, but must be able to be chained in even if there are 0 bytes of free RAM ("Error: cannot free memory because memory is full" is probably not a thing you'd ever want to see)).

              I think you are right in practice, though in principle you could pre-allocate the necessary memory when you create the items? When you have the intrusive links, you pay for their allocation already anyway, too. In terms of total storage space, you wouldn't pay for more.

              (And you don't have to formally alloc them via a call to kmalloc or so. In the sense that you don't need to find a space for them: you just need to make sure that the system keeps a big enough buffer of contiguous-enough space somewhere. Similar to how many filesystems allow you to reserve space for root, but that doesn't mean any particular block is reserved for root up-front.)

              But as I thought, that's about in-principle memory usage. A language like C makes the alternative of intrusive data structures much simpler.

              • dzaima 3 days ago

                > you just need to make sure that the system keeps a big enough buffer of contiguous-enough space somewhere. Similar to how many filesystems allow you to reserve space for root

                Said file system reserving can fill up (I've experienced that :) ). Could perhaps engineer some super-equation for a global reserved memory size that can actually guarantee being sufficient; but, unless you mark allocations as needing reserved space vs not and compute based on that (which is back to overhead), that'll necessarily waste a good amount of memory.

                And such a global equation of course can result in global failure if just one subsystem miscalculates its required reserved amount, or the calculations improperly account for worst-case non-contiguousness or interleaved different-size-linked-list-alloc-requests or whatever. (never mind that you now need to alloc when adding elements to linked lists, an action that would otherwise be 1-4 inlined stores)

                Probably (?) possible to handle, but way way way more easy to break or get wrong (with very-difficult-to-debug consequences) than just some pointer fields.

                Oh and also of course, if you store list data in a separate allocation from the main object, you lose the ability to do O(1) (and extremely-cheap at that) "remove self from linked list just given my own pointer", which is probably quite common (and you can't even O(1) with an arraylist instead of a linkedlist).

            • delamon 4 days ago

              > Storing the data in nodes doesn't work if the given structure may need to be in multiple linked lists

              That is why kernel mostly (always?) uses intrusive linked lists. They have no such problem.

          • bluecalm 4 days ago

            The main thing is that he object can be a member of various structures. It can be in big general queue and in priority queue for example. Once you find it and deal with it you can remove it from both without needing to search for it.

            Same story for games where it can be in the list of all objects and in the list of objects that might be attacked. Once it's killed you can remove it from all lists without searching for it in every single one.

          • delamon 4 days ago

            > if your compiler unboxes the contained item into your nodes

            Is there known compilers that can do that?

            • eru 4 days ago

              Haskell's GHC partially does it. LLVM can do it in principle, if your frontend gives enough information. Some JVMs can partially do some of it.

              The above is about the optimiser figuring out whether to box or unbox by itself.

              If you are willing to give the compiler a hand: Rust can do it just fine and it's the default when you define data structures. If you need boxing, you need to explicitly ask for it, eg via https://doc.rust-lang.org/std/boxed/struct.Box.html

      • ajuc 4 days ago

        A data structure that requires you to change the data to use it.

        Like a linked list that forces you to add a next pointer to the record you want to store in it.

  • mmooss 5 days ago

    Before we ask if almost all things old will be rewritten in Rust, we should ask if almost all things new are being written in Rust or other memory-safe languages?

    Obviously not. When will that happen? 15 years? Maybe it's generational: How long before developers 'born' into to memory-safe languages as serious choices will be substantially in charge of software development?

    • buster 4 days ago

      I don't know I tend to either come across new tools written in Rust, JavaScript or Python but relatively low amount of C. The times I see some "cargo install xyz" in a git repo of some new tool is definitely noticeable.

    • sho_hn 5 days ago

      I'm a bit wary if this is hiding an agist sentiment, though. I doubt most Rust developers were 'born into' the language, but instead adopted it on top of existing experience in other languages.

      • mmooss 4 days ago

        People can learn Rust at any age. The reality is that experienced people often are more hesitant to learn new things.

        I can think of possible reasons: Early in life, in school and early career, much of what you work on is inevitably new to you, and also authorities (professor, boss) compel you to learn whatever they choose. You become accustomed to and skilled at adapting new things. Later, when you have power to make the choice, you are less likely to make yourself change (and more likely to make the junior people change, when there's a trade-off). Power corrupts, even on that small scale.

        There's also a good argument for being stubborn and jaded: You have 30 years perfecting the skills, tools, efficiencies, etc. of C++. For the new project, even if C++ isn't as good a fit as Rust, are you going to be more efficient using Rust? How about in a year? Two years? ... It might not be worth learning Rust at all; ROI might be higher continuing to invest in additional elite C++ skills. Certainly that has more appeal to someone who knows C++ intimately - continue to refine this beautiful machine, or bang your head against the wall?

        For someone without that investment, Rust might have higher ROI; that's fine, let them learn it. We still need C++ developers. Morbid but true, to a degree: 'Progress happens one funeral at a time.'

        • a96 4 days ago

          > experienced people often are more hesitant to learn new things

          I believe the opposite. There's some kind of weird mentality in beginner/wannabe programmers (and HR, but that's unrelated) that when you pick language X then you're an X programmer for life.

          Experienced people know that if you need a new language or library, you pick up a new language or library. Once you've learned a few, most of them aren't going to be very different and programming is programming. Of course it will look like work and maybe "experienced" people will be more work averse and less enthusiastic than "inexperienced" (meaning younger) people.

          • tialaramex 3 days ago

            I agree that "programming is programming" but Rust feels very different with my background (some ML and many years of C, Java, some Python, a little Go, etc.) than for somebody whose only previous language is Java, or Javascript, or perhaps even C++

            The "You can write Java in any language" mentality afflicts some languages worse than others, but if your programming is exclusively in a single language you will be tainted by that regardless of the language. C++ is perhaps worst for this because its proponents, and indeed its standards committee have their own terminology for everything. So there aren't "methods" but instead "non-static member functions" for example. This has the "Call a rabbit a smeerp" problem, where you can't tell whether you actually don't know a feature or if you just know the exact same feature by a different name.

            I guess what I'm saying is that writing any language in an idiomatic way takes a bit more than just "programming is programming" plus a word-for-word translation guide, and some people might be weary of learning new idioms.

          • psychoslave 4 days ago

            >Experienced people know that if you need a new language or library, you pick up a new language or library.

            That heavily depends, if you tap into a green field project, yes. Or free reign over a complete rewrite of existing projects. But these things are more the exception than the regular case.

            Even on green field project, ecosystem and available talents per framework will be a consideration most of the time.

            There are also other things like being parent and wanting to take care of them that can come into consideration later in life. So more like more responsibilities constraints perspectives and choices than power corrupts in purely egoistic fashion.

        • sho_hn 4 days ago

          I still think you're off the mark. Again, most existing Rust developers are not "blank slate Rust developers". That they do not rush out to rewrite all of their past projects in C++ may be more about sunk costs, and wanting to solve new problems with from-scratch development.

          • debugnik 4 days ago

            > most existing Rust developers are not "blank slate Rust developers"

            Not most, but the pool of software devs has been doubling every five years, and Rust matches C# on "Learning to Code" voters at Stack Overflow's last survey, which is crazy considering how many people learn C# just to use Unity. I think you underestimate how many developers are Rust blank slates.

            Anecdotically, I've recently come across comments from people who've taught themselves Rust but not C or C++.

          • mmooss 4 days ago

            That's fair; my claims are kept simplistic for purposes of space and time. However, I'm talking about new projects, not rewriting legacy code.

        • gjajric 4 days ago

          According to the strange data at https://survey.stackoverflow.co/2025/technology#most-popular... , 44.6% have responded positively to that question regarding C++. But there may be some issues, for the question involves two check boxes, yet there is only one statistic.

      • pjmlp 4 days ago

        Sure there are plenty of them, hence why you seem remarks like wanting to use Rust but with a GC, or assigned to Rust features that most ML derived languages have.

    • lmm 5 days ago

      > Obviously not

      Is it obvious? I haven't heard of new projects in non-memory-safe languages lately, and I would think they would struggle to attract contributors.

      • jandrewrogers 4 days ago

        New high-scale data infrastructure projects I am aware of mostly seem to be C++ (often C++20). A bit of Rust, which I’ve used, and Zig but most of the hardcore stuff is still done in C++ and will be for the foreseeable future.

        It is easy to forget that the state-of-the-art implementations of a lot of systems software is not open source. They don’t struggle to attract contributors because of language choices, being on the bleeding edge of computer science is selling point enough.

        • ACCount37 4 days ago

          There's a "point of no return" when you start to struggle to hire anyone on your teams because no one knows the language and no one is willing to learn. But C++ is very far from it.

          • pornel 4 days ago

            There's always someone willing to write COBOL for the right premium.

            I'm working on Rust projects, so I may have incomplete picture, but I'm from what I see when devs have a choice, they prefer working with Rust over C++ (if not due to the language, at least due to the build tooling).

            • ACCount37 4 days ago

              Writing C++ is easier than writing Rust. But writing safe multithreaded code in C++?

              I don't want to write multithreaded C++ at all unless I explicitly want a new hole in my foot. Rust I barely have any experience with, but it might be less frustrating than that.

              • dwattttt 4 days ago

                Anecdotally, my "wow, this Rust business might really go somewhere" moment was when I tried adding multithreading to a random tool I made (dispatching tasks to new threads).

                Multithreading had not been planned or architected for, it took 30 min, included the compiler informing me I couldn't share a hashmap with those threads unsynchronised, and informing me on how to fix it.

                • pornel 3 days ago

                  I've had similar experience when the compiler immediately found unsynchronized state deep inside a 3rd party library I've been using. It was a 5-minute fix for what otherwise could have been mysterious unreproducible data corruption.

                  These days even mobile phones have multicore CPUs, so it's getting hard to find excuses for single-threaded programs.

      • pjmlp 4 days ago

        Game development, graphics and VFX industry, AI tooling infrastructure, embedded development, Maker tools like Arduino and ESP32, compiler development.

      • ottah 4 days ago
        • lmm 4 days ago

          Zig at least claims some level of memory safety in their marketing. How real that is I don't know.

          • vlovich123 4 days ago

            About as real as claiming that C/C++ is memory safe because of sanitizers IMHO.

            • Ygg2 4 days ago

              I mean, Zig does have non-null pointers. It prevents some UB. Just not all.

              • pjmlp 4 days ago

                Which you can achieve in C and C++ with static analysis rules, breaking compilation if pointers aren't checked for nullptr/NULL before use.

                Zig would have been a nice proposition in the 20th century, alongside languages like Modula-2 and Object Pascal.

          • tomnipotent 4 days ago

            I'm unaware of any such marketing.

            • dwattttt 4 days ago

              Zig does claim that it

              > ... has a debug allocator that maintains memory safety in the face of use-after-free and double-free

              which is probably true (in that it's not possible to violate memory safety on the debug allocator, although it's still a strong claim). But beyond that there isn't really any current marketing for Zig claiming safety, beyond a heading in an overview of "Performance and Safety: Choose Two".

              • gf000 4 days ago

                Runtime checks can only validate code paths taken, though. Also, C sanitizers are quite good as well nowadays.

              • tomnipotent 4 days ago

                That's a library feature (not intended for release builds), not a language feature.

                • weebull 4 days ago

                  It is intended for release builds. The ReleaseSafe target will keep the checks. ReleaseFast and ReleaseSmall will remove the checks, but those aren't the recommended release modes for general software. Only for when performance or size are critical.

          • gjajric 4 days ago

            I have heard different arguments, such as https://zackoverflow.dev/writing/unsafe-rust-vs-zig/ .

      • mmooss 4 days ago

        Out of curiosity, do the LLMs all use memory safe languages?

  • keyle 4 days ago

    C is fun to write. I can write Rust, but I prefer writing C. I prefer compiling C, I prefer debugging C. I prefer C.

    It's a bit like asking with the new mustang on the market, with airbags and traction control, why would you ever want to drive a classic mustang?

    • speedgoose 4 days ago

      It’s okay to enjoy driving an outdated and dangerous car for the thrill because it makes pleasing noise, as long as you don’t annoy too much other people with it.

    • IshKebab 4 days ago

      > I prefer debugging C

      I prefer not having to debug... I think most people would agree with that.

      • ykonstant 4 days ago

        I prefer a billion dallars tax free, but here we are:(

        • pornel 4 days ago

          In Rust dev, I haven't needed Valgrind or gdb in years, except some projects integrating C libraries.

          Probably kernel dev isn't as easy, but for application development Rust really shifts majority of problems from debugging to compile time.

          • FpUser 4 days ago

            My current project is C++ backend. I do a lot of debugging but all of it concerns business logic, some scientific calculations and the likes. In this situations having Rust will give me exactly zero benefits. As for "safety". I am a practical man and I pay my own money for development. Being able to use modern C++ I have forgotten when was the last time I had any memory related issue. My backends run for years serving many customers with no complaints in this department. Does not mean of course they're really really safe but I sleep well ;)

        • IshKebab 4 days ago

          If it wasn't clear, I have to debug Rust code waaaay less than C, for two reasons:

          1. Memory safety - these can be some of the worst bugs to debug in C because they often break sane invariants that you use for debugging. Often they break the debugger entirely! A classic example is forgetting to return a value from a non-void function. That can trash your stack and end up causing all sorts of impossible behaviours in totally different parts of the code. Not fun to debug!

          2. Stronger type system - you get an "if it compiles it works" kind of experience (as in Haskell). Obviously that isn't always the case, but I can sometimes write several hundred lines of Rust and once it's compiling it works first time. I've had to suppress my natural "oh I must have forgotten to save everything or maybe incremental builds are broken or something" instinct when this happens.

          Net result is that I spend at least 10x less time in a debugger with Rust than I do with C.

      • account42 4 days ago

        Do you also want some unicorns as well?

  • pjmlp 4 days ago

    Yes it does, alongside C++, Rust isn't available everywhere.

    There are industry standards based in C, or C++, and I doubt they will be adopting Rust any time soon.

    POSIX (which does require a C compiler for certification), OpenGL, OpenCL, SYSCL, Aparavi, Vulkan, DirectX, LibGNM(X), NVN, CUDA, LLVM, GCC, Unreal, Godot, Unity,...

    Then plenty of OSes like the Apple ecosystem, among many other RTOS and commercial endevours for embedded.

    Also the official Rust compiler isn't fully bootstraped yet, thus it depends on C++ tooling for its very existence.

    Which is why efforts to make C and C++ safer are also much welcomed, plenty of code out there is never going to be RIR, and there are domains where Rust will be a runner up for several decades.

    • Philpax 4 days ago

      I agree with you for the most part, but it's worth noting that those standards can expose a C API/ABI while being primarily implemented in and/or used by non-C languages. I think we're a long way away from that, but there's no inherent reason why C would be a going concern for these in the Glorious RIIR Future:tm:.

  • StopDisinfo910 4 days ago

    Depends of what you do.

    Rust has a nice compiler-provided static analyzer using annotation to do life time analysis and borrow checking. I believe borrow checking to be a local optima trap when it comes to static analysis and finds it often more annoying to use than I would like but I won't argue it's miles better than nothing.

    C has better static analysers available. They can use annotations too. Still, all of that is optional when it's part of Rust core language. You know that Rust code has been successfully analysed. Most C code won't give you this. But if it's your code base, you can reach this point in C too.

    C also has a fully proven and certified compiler. That might be a requirement if you work in some niche safety critical applications. Rust has no equivalent there.

    The discussion is more interesting when you look at other languages. Ada/Spark is for me ahead of Rust both in term of features and user experience regarding the core language.

    Rust currently still have what I consider significant flaws: a very slow compiler, no standard, support for a limited number of architectures (it's growing), it's less stable that I consider it should be given its age, and most Rust code tends to use more small libraries than I would personaly like.

    Rust is very trendy however and I don't mean that in a bad way. That gives it a lot of leverage. I doubt we will ever see Ada in the kernel but here we are with Rust.

  • stingraycharles 5 days ago

    It’s available on more obscure platforms than Rust, and more people are familiar with it.

    I wouldn’t say it’s inevitable that everything will be rewritten in Rust, at the very least this will this decades. C has been with us for more than half a century and is the foundation of pretty much everything, it will take a long time to migrate all that.

    More likely is that they will live next to each other for a very, very long time.

  • QuiEgo 4 days ago

    Rust still compiles into bigger binary sizes than C, by a small amount. Although it’s such a complex thing depending on your code that it really depends case-by-case, and you can get pretty close. On embedded systems with small amounts of ram (think on the order of 64kbytes), a few extra kb still hurts a lot.

    • accelbred 4 days ago

      Lack of stable build-std and panic_immediate_abort features result in a order of magnitude size difference for some rust code I have. Using no_std brings it to ~60kb from ~350kb, but still more than the ~40kb for the C version

      • torginus 4 days ago

        Afaik despite Rust not having exceptions, panic still unwinds the stack and executes 'drop'-s the same way C++ does, which means the code retains much of the machinery necessary to support exceptions.

        • dwattttt 4 days ago

          The panic_immediate_abort feature should prevent this. build-std is the name of the feature that recompiles the Rust standard libraries with your chosen profile, so the combination of these two features should result in no unwinding code bloat.

          • torginus 4 days ago

            Are all crates compatible with this feature?

            • steveklabnik 4 days ago

              A crate can add a setting in the package that says "hey if you try to build me without unwinding, cause an error, because I need unwinding to work."

              I have never run into such a crate in the wild, I don't think.

            • dwattttt 4 days ago

              It's possible for a crate to assume there will be unwinding, but given the Rust communities general attitude to exceptions it's not common.

              By default, all it means is that unwinding the stack doesn't happen, so Drop implementations don't get called. Which _can_ result in bugs, but they're a fairly familiar kind: it's the same kind of fault if a process is aborted (crashes?), and it doesn't get a chance to finalise external resources.

              EDIT: to clarify, the feature isn't really something crates have to opt in to support

  • QuiEgo 4 days ago

    Apple handled this problem by adding memory safety to C (Firebloom). It seems unlikely they would throw away that investment and move to Rust. I’m sure lots of other companies don’t want to throw away their existing code, and when they write new code there will always be a desire to draw on prior art.

    • goku12 4 days ago

      That's a rather pessimistic take compared to what's actually happening. What you say should apply to the big players like Amazon, Google, Microsoft, etc the most, because they arguably have massive C codebases. Yet, they're also some of the most enthusiastic adopters and promoters of Rust. A lot of other adopters also have legacy C codebases.

      I'm not trying to hype up Rust or disparage C. I learned C first and then Rust, even before Rust 1.0 was released. And I have an idea why Rust finds acceptance, which is also what some of these companies have officially mentioned.

      C is a nice little language that's easy to learn and understand. But the price you pay for it is in large applications where you have to handle resources like heap allocations. C doesn't offer any help there when you make such mistakes, though some linters might catch them. The reason for this, I think, is that C was developed in an era when they didn't have so much computing power to do such complicated analysis in the compiler.

      People have been writing C for ages, but let me tell you - writing correct C is a whole different skill that's hard and takes ages to learn. If you think I'm saying this because I'm a bad programmer, then you would be wrong. I'm not a programmer at all (by qualification), but rather a hardware engineer who is more comfortable with assembly, registers, Bus, DRAM, DMA, etc. I still used to get widespread memory errors, because all it takes is a lapse in attention while coding. That strain is what Rust alleviates.

      • QuiEgo 4 days ago

        Not trying to make a value judgement on Rust either, just brainstorming why Rust changeover might go slow per the question.

        FWIW I work in firmware with the heap turned off. I’ve worked on projects in both C and Rust, and agree Rust still adds useful checks (at the cost of compile times and binary sizes). It seems worth the trade off for most projects.

      • torginus 4 days ago

        I'm curious why your perspective on Rust as a HW engineer. Hardware does a ton of things - DMA, interrupts, etc. that are not really compatible with Rust's memory model - after all Rust's immutable borrows should guarantee the values you are reading are not aliased by writers and should be staying constant as long as the borrow exists.

        This is obviously not true when the CPU can either yank away the execution to a different part of the program, or some foreign entity can overwrite your memory.

        Additionally, in low-level embedded systems, the existence of malloc is not a given, yet Rust seems to assume you can dynamically allocate memory with a stateless allocator.

        • QuiEgo 4 days ago

          I’d like to take a swipe at this

          Rust has no_std to handle not having an allocator.

          Tons of things end up being marked “unsafe” in systems/embedded Rust. The idea is you sandbox the unsafeness. Libraries like zero copy are a good example of “containing” unsafe memory accesses in a way that still gets you as much memory safety as possible given the realities of embedded.

          Tl;dr you don’t get as much safety as higher level code but you still get more than C. Or maybe put a different way you are forced to think about the points that are inherently unsafe and call them out explicitly (which is great when you think about how to test the thing)

          • torginus 4 days ago

            Dunno. I used to do embedded. A ton of (highly capable) systems have tiny amounts of RAM (like 32kb-128kb). Usually these controllers run a program in an infinite event loop (with perhaps a sleep in the end of the iteration), communication with peripherals is triggered via interrupts. There's no malloc, memory is pre-mapped.

            This means:

            - All lifetimes are either 'stack' or 'forever'

            - Thread safety in the main loop is ensured by disabling interrupts in the critical section - Rust doesn't understand this paradigm (it can be taught to, I'm sure)

            - Thread safety in ISRs should also be taught to Rust

            - Peripherals read and write to memory via DMA, unbekownst to the CPU

            etc.

            So all in all, I don't see Rust being that much more beneficial (except for stuff like array bounds checking).

            I'm sure you can describe all these behaviors to Rust so that it can check your program, but threading issues are limited, and there's no allocation, and no standard lib (or much else from cargo).

            Rust may be a marginally better language than C due to some convenience features, but I feel like there's too much extra work very little benefit.

            • QuiEgo 4 days ago

              FWIW teaching it critical sections is dead simple, and likely already done for you. Ex cortex M:

              https://github.com/rust-embedded/cortex-m/blob/master/cortex...

              You can look at asynch and things like https://github.com/rtic-rs/rtic and https://github.com/embassy-rs/embassy for common embedded patterns.

              You handle DMA the same way as on any other system - e.x. you mark the memory as system/uncached (and pin it if you have virtual memory on), you use memory barriers when you are told data has arrived to get the memory controller up to speed with what happened behind its back, and so on. You’re still writing the same code that controls the hardware in the same way, nothing about that is especially different in C vs Rust.

              I think there is very much a learning curve, and that friction is real - hiring people and teaching them Rust is harder than just hiring C devs. People on HN tend to take this almost like a religious question - “how could you dare to write memory unsafe code in 2025? You’re evil!” But pragmatically this is a real concern.

            • yencabulator 3 days ago

              Hubris is an embedded microkernel targeting the kilobytes-to-megabyte range of RAM. In Rust. They're saying very positive things about the bug prevention aspects.

              https://hubris.oxide.computer/reference/

              https://hubris.oxide.computer/bugs/

        • goku12 3 days ago

          Here is my take on your question.

          > I'm curious why your perspective on Rust as a HW engineer.

          C, C++ and Rust requires you to know at least the basics of the C memory model. Register variables, heap, stack, stack frame, frame invalidation, allocators and allocation, heap pointer invalidation, etc. There are obviously more complicated stuff (which I think you already know, seeing that you're an embedded developer), but this much is necessary to avoid common memory errors like memory leaks (not a safety error), use-after-free, double-free, data-race, etc. This is needed for even non-system programs and applications, due to lack of runtime memory management (GC or RC). You can get by, by following certain rules of thumb in C and C++. But to be able to write flawless code, you have to know those hardware concepts. This is where knowledge of process and memory architecture comes in handy. You start with the fundamental rule before programming, instead of the other way around that people normally take. Even in Rust, the complicated borrow checker rules start to make sense once you realize how they help you overcome the mistakes you can make with the hardware.

          > Hardware does a ton of things - DMA, interrupts, etc. that are not really compatible with Rust's memory model - after all Rust's immutable borrows should guarantee the values you are reading are not aliased by writers and should be staying constant as long as the borrow exists.

          > This is obviously not true when the CPU can either yank away the execution to a different part of the program, or some foreign entity can overwrite your memory.

          I do have an answer, but I don't think it can be explained in a better way than how @QuiEgo did it: You can 'sandbox' those unsafe parts within Rust unsafe blocks. As I have explained elsewhere, these sandboxed parts are surprisingly small even in kernel or embedded code (please see the Rust standard library for examples). As long as you enforce the basic correctness conditions (the invariants) inside the unsafe blocks, the rest of the code is guaranteed to be safe. And even if you do make a mistake there (i.e memory safety), they are easier to find because there's very little code there to check. Rust does bring something new to the table for the hardware.

          NOTE: I believe that those parts in the kernel are still in C. Rust is just a thin wrapper over it for writing drivers. That's a reasonable way forward.

          > Additionally, in low-level embedded systems, the existence of malloc is not a given, yet Rust seems to assume you can dynamically allocate memory with a stateless allocator.

          That isn't true. @QuiEgo already mentioned no_std. It's meant for this purpose. Here is the reference: https://docs.rust-embedded.org/book/intro/no-std.html#bare-m...

      • Surac 4 days ago

        So you try to say c is for good programmers only and rust let also the idiots Programm? I think that’s the wrong way to argue for rust. Rust catches one kind of common problem but but does not magically make logic errors away.

    • AceJohnny2 4 days ago

      > It seems unlikely [Apple] would throw away that investment and move to Rust.

      Apple has invested in Swift, another high level language with safety guarantees, which happens to have been created under Chris Lattner, otherwise known for creating LLVM. Swift's huge advantage over Rust, for application and system programming is that it supports an ABI [1] which Rust, famously, does not (other than falling back to a C ABI, which degrades its promises).

      [1] for more on that topic, I recommend this excellent article: https://faultlore.com/blah/swift-abi/ Side note, the author of that article wrote Rust's std::collections API.

      • gjajric 4 days ago

        Swift does not seem suitable for OS development, at least not as much as C or C++.[0] Swift handles by default a lot of memory by using reference counting, as I understand it, which is not always suitable for OS development.

        [0]: Rust, while no longer officially experimental in the Linux kernel, does not yet have major OSs written purely in it.

        • pjmlp 4 days ago

          What matters is what Apple thinks, and officially it is, to the point it is explicitly written on the documentation.

          • gjajric2 4 days ago

            The practical reality is arguably more important than beliefs. Apple has, as it turns out, invested in trying to make Swift more suitable for kernel and similar development, like trying to automate away reference counting when possible, and also offering Embedded Swift[0], an experimental subset of Swift with significant restrictions on what is allowed in the language. Maybe Embedded Swift will be great in the future, and it is true that Apple investing into that is significant, but it doesn't seem like it's there.

            > Embedded Swift support is available in the Swift development snapshots.

            And considering Apple made Embedded Swift, even Apple does not believe that regular Swift is suitable. Meaning that you're undeniably completely wrong.

            [0]:

            https://github.com/swiftlang/swift-evolution/blob/main/visio...

            • pjmlp 4 days ago

              You show a lack of awareness that ISO C and C++ are also not applicable, because on those domains the full ISO language standard isn't available, which is why freestanding is a thing.

              • gjajric2 4 days ago

                But freestanding is not experimental, unlike Embedded Swift according to Apple. And there are full, large OS kernels written in C and C++.

                You continue being undeniably, completely wrong.

                • pjmlp 4 days ago

                  Is it really? It always depends on which specific C compiler, and target platform we are talking about.

                  For Apple it suffices that it is fit for purpose for Apple itself, it is experimental for the rest of the world.

                  I love to be rightly wrong.

        • astrange 4 days ago

          There's an allocation-free subset.

          https://www.swift.org/get-started/embedded/

          Rust's approach is overkill, I think. A lot of reference counting and stuff is just fine in a kernel.

          • gjajric2 4 days ago

            But at least a lot of tasks in a kernel would require something else than reference counting, unless it can be guaranteed that the reference counting is optimized away or something, right?

            • astrange 4 days ago

              There are some allocations where it doesn't make sense for them to have multiple owners (strong references) but I wouldn't say it makes sense to think about it as being optimized away or not.

        • saagarjha 4 days ago

          Nothing wrong with using reference counting for OS development.

          • gjajric2 4 days ago

            Even kernel development? Do you know of kernels where reference counting is the norm? Please do mention examples.

            • ahoka 4 days ago
            • throwaway17_17 4 days ago

              Is this even a fair question? A common response to pointing out that Oberon and the other Wirth languages where used to write several OS’s (using full GC in some cases) is that they don’t count, just like Minix doesn’t count for proof of microkernels. The prime objection being they are not large commercial OS’s. So, if the only two examples allowed are Linux and Windows (and maybe MacOS) then ‘no’ there are no wide spread, production sized OS’s that use GC or reference counting.

              The big sticking point for me is that for desktop and server style computing, the hardware capabilities have increased so much that a good GC would for most users be acceptable at the kernel level. The other side to that coin is that then OS’s would need to be made on different kernels for large embedded/tablet/low-power/smart phone use cases. I think tech development has benefitted from Linux being used at so many levels.

              A push to develop a new breed of OS, with a microkernel and using some sort of ‘safe’ language should be on the table for developers. But outside of proprietary military/finance/industrial (and a lot of the work in these fields are just using Linux) areas there doesn’t seem to be any movement toward movement toward a less monolithic OS situation.

        • pornel 4 days ago

          Apple is extending Swift specifically for kernel development.

    • pjmlp 4 days ago

      Also, Swift Embedded came out of the effort to eventually use Swift instead for such use cases at Apple.

  • stabbles 4 days ago

    A C compiler is easier to bootstrap than a Rust compiler.

  • 0xbadcafebee 4 days ago

    It's a bit like asking if there is any significant advantage to ICE motors over electric motors. They both have advantages and disadvantages. Every person who uses one or the other, will tell you about their own use case, and why nobody could possibly need to use the alternative.

    There's already applications out there for the "old thing" that need to be maintained, and they're way too old for anyone to bother with re-creating it with the "new thing". And the "old thing" has some advantages the "new thing" doesn't have. So some very specific applications will keep using the "old thing". Other applications will use the "new thing" as it is convenient.

    To answer your second question, nothing is inevitable, except death, taxes, and the obsolescence of machines. Rust is the new kid on the block now, but in 20 years, everybody will be rewriting all the Rust software in something else (if we even have source code in the future; anyone you know read machine code or punch cards?). C'est la vie.

    • NetMageSCW 4 days ago

      Machine code: Yes. Punched cards: easy - every punch has the character it represents at the top of the card.

  • scottyah 5 days ago

    I think it'll be less like telegram lines- which were replaced fully for a major upgrade in functionality, and more like rail lines- which were standardized and ubiquitous, still hold some benefit but mainly only exist in areas people don't venture nearly as much.

  • greesil 4 days ago

    Shitloads of already existing libraries. For example I'm not going to start using it for Arduino-y things until all the peripherals I want have drivers written in Rust.

    • littlestymaar 4 days ago

      Why? You can interact with C libraries from Rust just fine.

      • LtWorf 4 days ago

        But you now have more complexity and no extra safety.

        • dwattttt 4 days ago

          That's not really the case. Not all C APIs are inherently unsafe by construction, and I've always appreciated when someone has wrapped a C library and produced two crates:

          - a pure binding crate, which exposes the C lib libraries API, and

          - a wrapper library that performs some basic improvements

          Stuff in the second category typically includes adding Drop impls to resources that need to be released, translating "accepts pointer + len" into "accepts slices" (or vice versa on return), and "check return value of C call and turn it into a Result, possibly with a stringified error".

          All of those are also good examples of local reasoning about unsafety. If a C API returns a buffer + size, it's unsafe to turn it into a reference/slice. But if you check the function succeeded, you unsafely make the slice/reference, and return it from a safe function. If it crashes, you've either not upheld the C calls preconditions (your fault, check how to call the C function), or the C code has a bug (not your fault, the bug is elsewhere).

        • pornel 4 days ago

          If you create wrappers that provide additional type information, you do get extra safety and nicer interfaces to work with.

        • timeon 4 days ago

          You have extra safety in new code.

  • otikik 4 days ago

    Ubiquity is still a big one. There's many, many places where C exists that Rust has not reached yet.

  • s_ting765 4 days ago

    You mean safer languages like Fil-C.

  • qsera 4 days ago

    >does C hold any significant advantage over Rust

    Yes, it's lots of fun. rust is Boring.

    If I want to implement something and have fun doing it, I ll always do it in C.

  • antioxide 4 days ago

    you can look at rust sources of real system programs like framekernel or such things. uefi-rs etc.

    there u can likely explore well the boundaries where rust does and does not work.

    people have all kind of opinions. mine is this:

    if you need unsafe peppered around, the only thing rust offers is being very unergonomic. its hard to write and hard to debug for no reason. Writing memory-safe C code is easy. The problems rust solves arent bad, just solved in a way thats way more complicated than writing same (safe) C code.

    a language is not unsafe. you can write perfectly shit code in rust. and you can write perfectly safe code in C.

    people need to stop calling a language safe and then reimplementing other peoples hard work in a bad way creating whole new vulnerabilities.

    • herni 4 days ago

      I disagree. Rust shines when you need perform "unsafe" operations. It forces programmers to be explicit and isolate their use of unsafe memory operations. This makes it significantly more feasible to keep track of invariants.

      It is completely besides the point that you can also write "shit code" in Rust. Just because you are fed up with the "reimplement the world in Rust" culture does not mean that the tool itself is bad.

  • vbezhenar 4 days ago

    For my hobby code, I'm not going to start writing Rust anytime soon. My code is safe enough and I like C as it is. I don't write software for martian rovers, and for ordinary tasks, C is more ergonomic than Rust, especially for embedded tasks.

    For my work code, it all comes down to SDKs and stuff. For example I'm going to write firmware for Nordic ARM chip. Nordic SDK uses C, so I'm not going to jump through infinite number of hoops and incomplete rust ports, I'll just use official SDK and C. If it would be the opposite, I would be using Rust, but I don't think that would happen in the next 10 years.

    Just like C++ never killed C, despite being perfect replacement for it, I don't believe that Rust would kill C, or C++, because it's even less convenient replacement. It'll dilute the market, for sure.

    • anticrymactic 4 days ago

      > Just like C++ never killed C, despite being perfect replacement for it

      I think c++ didn't replace C because it is a bad language. It did not offer any improvements on the core advantages of C.

      Rust however does. It's not perfect, but it has a substantially larger chance of "replacing" C, if that ever happens.

      • NetMageSCW 4 days ago

        I don’t agree that C++ is a bad language, though it has been standardized to death into a bad language. But the whole point is for C++ to not be worse than C while offering a lot more, which I think it does well. Of course, my last serious use of C++ was a little after release E…

  • obviouslynotme 4 days ago

    A lot of C's popularity is with how standard and simple it is. I doubt Rust will be the safe language of the future, simply because of its complexity. The true future of "safe" software is already here, JavaScript.

    There will be small niches leftover:

    * Embedded - This will always be C. No memory allocation means no Rust benefits. Rust is also too complex for smaller systems to write compilers.

    * OS / Kernel - Nearly all of the relevant code is unsafe. There aren't many real benefits. It will happen anyways due to grant funding requirements. This will take decades, maybe a century. A better alternative would be a verified kernel with formal methods and a Linux compatibility layer, but that is pie in the sky.

    * Game Engines - Rust screwed up its standard library by not putting custom allocation at the center of it. Until we get a Rust version of the EASTL, adoption will be slow at best.

    * High Frequency Traders - They would care about the standard library except they are moving on from C++ to VHDL for their time-sensitive stuff. I would bet they move to a garbage-collected language for everything else, either Java or Go.

    * Browsers - Despite being born in a browser, Rust is unlikely to make any inroads. Mozilla lost their ability to make effective change and already killed their Rust project once. Google has probably the largest C++ codebase in the world. Migrating to Rust would be so expensive that the board would squash it.

    * High-Throughput Services - This is where I see the bulk of Rust adoption. I would be surprised if major rewrites aren't already underway.

    • aw1621107 4 days ago

      > No memory allocation means no Rust benefits.

      This isn't really true; otherwise, there would be no reason for no_std to exist. Data race safety is independent of whether you allocate or not, lifetimes can be handy even for fixed-size arenas, you still get bounds checks, you still get other niceties like sum types/an expressive type system, etc.

      > OS / Kernel - Nearly all of the relevant code is unsafe.

      I think that characterization is rather exaggerated. IIRC the proportion of unsafe code in Redox OS is somewhere around 10%, and Steve Klabnik said that Oxide's Hubris has a similarly small proportion of unsafe code (~3% as of a year or two ago) [0]

      > Browsers - Despite being born in a browser, Rust is unlikely to make any inroads.

      Technically speaking, Rust already has. There has been Rust in Firefox for quite a while now, and Chromium has started allowing Rust for third-party components.

      [0]: https://news.ycombinator.com/item?id=42312699

      [1]: https://old.reddit.com/r/rust/comments/bhtuah/production_dep...

      • jitl 4 days ago

        The Temporal API in Chrome is implemented in Rust. We’re definitely seeing more Rust in browsers including beyond Firefox.

    • johncolanduoni 4 days ago

      > Google has probably the largest C++ codebase in the world. Migrating to Rust would be so expensive that the board would squash it.

      Google is transitioning large parts of Android to Rust and there is now first-party code in Chromium and V8 in Rust. I’m sure they’ll continue to write new C++ code for a good while, but they’ve made substantial investments to enable using Rust in these projects going forward.

      Also, if you’re imagining the board of a multi-trillion dollar market cap company is making direct decisions about what languages get used, you may want to check what else in this list you are imagining.

      • pjmlp 4 days ago

        Unless rules have changed Rust is only allowed a minor role in Chrome.

        > Based on our research, we landed on two outcomes for Chromium.

        > We will support interop in only a single direction, from C++ to Rust, for now. Chromium is written in C++, and the majority of stack frames are in C++ code, right from main() until exit(), which is why we chose this direction. By limiting interop to a single direction, we control the shape of the dependency tree. Rust can not depend on C++ so it cannot know about C++ types and functions, except through dependency injection. In this way, Rust can not land in arbitrary C++ code, only in functions passed through the API from C++.

        > We will only support third-party libraries for now. Third-party libraries are written as standalone components, they don’t hold implicit knowledge about the implementation of Chromium. This means they have APIs that are simpler and focused on their single task. Or, put another way, they typically have a narrow interface, without complex pointer graphs and shared ownership. We will be reviewing libraries that we bring in for C++ use to ensure they fit this expectation.

        -- https://security.googleblog.com/2023/01/supporting-use-of-ru...

        Also even though Rust would be a safer alternative to using C and C++ on the Android NDK, that isn't part of the roadmap, nor the Android team provides any support to those that go down that route. They only see Rust for Android internals, not app developers

        If anything, they seem more likely to eventually support Kotlin Native for such cases than Rust.

        • johncolanduoni 4 days ago

          > Unless rules have changed Rust is only allowed a minor role in Chrome.

          I believe the Chromium policy has changed, though I may be misinterpreting: https://chromium.googlesource.com/chromium/src/+/refs/heads/...

          The V8 developers seem more excited to use it going forward, and I’m interested to see how it turns out. A big open question about the Rust safety model for me is how useful it is for reducing the kind of bugs you see in a SOTA JIT runtime.

          > They only see Rust for Android internals, not app developers

          I’m sure, if only because ~nobody actually wants to write Android apps in Rust. Which I think is a rational choice for the vast majority of apps - Android NDK was already an ugly duckling, and a Rust version would be taken even less seriously by the platform.

          • pjmlp 4 days ago

            That looks only to be the guidelines on how to integrate Rust projects, not that the policy has changed.

            The NDK officially it isn't to write apps anyway, people try to do that due to some not wanting to touch Java or Kotlin, but that has never been the official point of view from Android team since it was introduced in version 2, rather:

            > The Native Development Kit (NDK) is a set of tools that allows you to use C and C++ code with Android, and provides platform libraries you can use to manage native activities and access physical device components, such as sensors and touch input. The NDK may not be appropriate for most novice Android programmers who need to use only Java code and framework APIs to develop their apps. However, the NDK can be useful for cases in which you need to do one or more of the following:

            > Squeeze extra performance out of a device to achieve low latency or run computationally intensive applications, such as games or physics simulations.

            > Reuse your own or other developers' C or C++ libraries.

            So it would be expected that at least for the first scenario, Rust would be a welcomed addition, however as mentioned they seem to be more keen into supporting Kotlin Native for it.

    • saghm 4 days ago

      > No memory allocation means no Rust benefits

      There are memory safety issues that literally only apply to memory on the stack, like returning dangling pointers to local variables. Not touching the heap doesn't magically avoid all of the potential issues in C.

    • scq 4 days ago

      Rust is already making substantial inroads in browsers, especially for things like codecs. Chrome also recently replaced FreeType with Skrifa (Rust), and the JS Temporal API in V8 is implemented in Rust.

    • juliangmp 4 days ago

      > Embedded - This will always be C. No memory allocation means no Rust benefits. Rust is also too complex for smaller systems to write compilers.

      Embedded Dev here and I can report that Rust has been more and more of a topic for me. I'm actually using it over C or C++ in a bare metal application. And I don't get where the no allocation -> no benefit thing comes from, Rust gives you much more to work with on bare metal than C or C++ do.

    • Aurornis 4 days ago

      > No memory allocation means no Rust benefits.

      Memory safety applies to all memory. Not just heap allocated memory.

      This is a strange claim because it's so obviously false. Was this comment supposed to be satire and I just missed it?

      Anyway, Rust has benefits beyond memory safety.

      > Rust is also too complex for smaller systems to write compilers.

      Rust uses LLVM as the compiler backend.

      There are already a lot of embedded targets for Rust and a growing number of libraries. Some vendors have started adopting it with first-class support. Again, it's weird to make this claim.

      > Nearly all of the relevant code is unsafe. There aren't many real benefits.

      Unsafe sections do not make the entire usage of Rust unsafe. That's a common misconception from people who don't know much about Rust, but it's not like the unsafe keyword instantly obliterates any Rust advantages, or even all of its safety guarantees.

      It's also strange to see this claim under an article about the kernel developers choosing to move forward with Rust.

      > High Frequency Traders - They would care about the standard library except they are moving on from C++ to VHDL for their time-sensitive stuff. I would bet they move to a garbage-collected language for everything else, either Java or Go.

      C++ and VHDL aren't interchangeable. They serve different purposes for different layers of the system. They aren't moving everything to FPGAs.

      Betting on a garbage collected language is strange. Tail latencies matter a lot.

      This entire comment is so weird and misinformed that I had to re-read it to make sure it wasn't satire or something.

      • goku12 4 days ago

        > Memory safety applies to all memory. Not just heap allocated memory.

        > Anyway, Rust has benefits beyond memory safety.

        I want to elaborate on this a little bit. Rust uses some basic patterns to ensure memory safety. They are 1. RAII, 2. the move semantics, and 3. the borrow validation semantics.

        This combination however, is useful for compile-time-verified management of any 'resource', not just heap memory. Think of 'resources' as something unique and useful, that you acquire when you need it and release/free it when you're done.

        For regular applications, it can be heap memory allocations, file handles, sockets, resource locks, remote session objects, TCP connections, etc. For OS and embedded systems, that could be a device buffer, bus ownership, config objects, etc.

        > > Nearly all of the relevant code is unsafe. There aren't many real benefits.

        Yes. This part is a bit weird. The fundamental idea of 'unsafe' is to limit the scope of unsafe operations to as few lines as possible (The same concept can be expressed in different ways. So don't get offended if it doesn't match what you've heard earlier exactly.) Parts that go inside these unsafe blocks are surprisingly small in practice. An entire kernel isn't all unsafe by any measure.

    • tayo42 4 days ago

      Rust isn't that complex unless your pulling in magical macro libraries or dealing with things like pin and that stuff,which you really don't need to.

      It's like saying python is complex becasue you have metaclasses, but you'll never need to reach for them.

    • throwaway2037 4 days ago

          > Rust is also too complex for smaller systems to write compilers.
      
      I am not a compiler engineer, but I want to tease apart this statement. As I understand, the main Rust compiler uses LLVM framework which uses an intermediate language that is somewhat like platform independent assembly code. As long as you can write a lexer/parser to generate the intermediate language, there will be a separate backend to generate machine code from the intermediate language. In my (non-compiler-engineer) mind, separates the concern of front-end language (Rust) from target platform (embedded). Do you agree? Or do I misunderstand?
    • qalmakka 4 days ago

      > Embedded - This will always be C. No memory allocation means no Rust benefits. Rust is also too complex for smaller systems to write compilers.

      Modern embedded isn't your grandpa's embedded anymore. Modern embedded chips have multiple KiB of ram, some even above 1MiB and have been like that for almost a decade (look at ESP32 for instance). I once worked on embedded projects based on ESP32 that used full C++, with allocators, exceptions, ... using SPI RAM and worked great. There's a fantastic port of ESP-IDF on Rust that Espressif themselves is maintaining nowadays, too.

    • j16sdiz 4 days ago

      > The true future of "safe" software is already here, JavaScript.

      only in interpreter mode.

    • sunshowers 4 days ago

      JavaScript does not have a separation between & and &mut.

arilotter 5 days ago

This title is moderately clickbait-y and comes with a subtle implication that Rust might be getting removed from the kernel. IMO it should be changed to "Rust in the kernel is no longer experimental"

  • sho_hn 5 days ago

    I absolutely understand the sentiment, but LWN is a second-to-none publication that on this rare occasion couldn't resist the joke, and also largely plays to an audience who will immediately understand that it's tongue-in-cheek.

    Speaking as a subscriber of about two decades who perhaps wouldn't have a career without the enormous amount of high-quality education provided by LWN content, or at least a far lesser one: Let's forgive.

    • zengid 5 days ago

      He didn't intend it as a joke and his intent matches the op's title revision request: https://lwn.net/Articles/1049840/

    • DrammBA 4 days ago

      > on this rare occasion couldn't resist the joke

      It was unintentional as per author

      > Ouch. That is what I get for pushing something out during a meeting, I guess. That was not my point; the experiment is done, and it was a success. I meant no more than that.

      • DANmode 4 days ago

        The “Ouch.” was in reference to being compared to Phoronix.

        Has anyone found them to be inaccurate, or fluffy to the point it degraded the content?

        I haven’t - but then again, probably predominantly reading the best posts being shared on aggregators.

        • stavros 4 days ago

          I don't know about the "ouch" but the rest of the comment seems pretty clear that they didn't intend to imply the clickbait.

          • DANmode 4 days ago

            That’s correct!

            That’s why I was chatting about the “Ouch.”

            because it was the only part of the comment that didn’t make sense to me in isolation,

            so I opened the context, what he was replying to.

        • IshKebab 4 days ago

          Nah I used to read Phoronix and the articles are a bit clickbaity sometimes but mostly it's fine. The real issue is the reader comments. They're absolute trash.

          • JoshTriplett 3 days ago

            The comments section is the biggest problem, but also, in addition to clickbait, the site has a tendency to amplify and highlight anything that will produce drama, often creating a predictable tempest in a teapot.

    • b33j0r 5 days ago

      Fair. But there’s even an additional difference between snarky clickbait and “giving the exact opposite impression of the truth in a headline” ;)

    • nailer 5 days ago

      Hacker news generally removes Clickbait titles regardless of the provenance

  • raggi 5 days ago

    If it was being removed the title would be "An update on rust in the kernel"

  • joshdavham 5 days ago

    I think on HN, people generally want the submission's title to match the page's title.

    (I do agree it's clickbait-y though)

    • airstrike 4 days ago

      Guidelines say fine to editorialize in these cases.

      > Otherwise please use the original title, unless it is misleading or linkbait; don't editorialize.

      https://news.ycombinator.com/newsguidelines.html

    • not2b 4 days ago

      I think on HN, people waste too much time arguing about the phrasing of the headline, whether it is clickbait, etc. and not enough discussing the actual substance of the article.

    • Archelaos 5 days ago

      I prefer improved titles. However, not in this case. It is rather irony, because LWN does not need click-bait.

      • goku12 4 days ago

        This one is apparently a genuine mistake from the author. But I think we should leave it as it is. The confusion and the argument about it is interesting in itself.

  • onedognight 5 days ago

    It’s a bit clickbait-y, but the article is short, to the point, and frankly satisfying. If there is such a thing as good clickbait, then this might be it. Impressive work!

    • ModernMech 5 days ago

      Might as well just post it:

        The topic of the Rust experiment was just discussed at the annual Maintainers Summit. The consensus among the assembled developers is that Rust in the kernel is no longer experimental — it is now a core part of the kernel and is here to stay. So the "experimental" tag will be coming off. Congratulations are in order for all of the Rust-for-Linux team.
    • Redster 5 days ago

      Perhaps, except it can have the reverse effect. I was surprised, disappointed, and then almost moved on without clicking the link or the discussion. I'm glad I clicked. But good titles don't mislead! (To be fair, this one didn't mislead, but it was confusing at best.)

  • zengid 4 days ago

    i agree and this matches the authors intent: https://lwn.net/Articles/1049840/

  • CrankyBear 4 days ago

    He didn't mean to! That said, the headline did make me look.

  • panzi 5 days ago

    I'm having deja Vu. Was there another quite similar headline here a few weeks or so ago?

  • Aldipower 4 days ago

    Seems you do not understand the concept of fun. You can learn that, makes your life easier.

tzury 4 days ago

  > Mike: rachel and i are no longer dating
  >
  > rachel: mike that's a horrible way of telling people we're married
from the meme section on that page.
  • devsda 4 days ago

    > same Mike in an org wide email: thank you all for your support. Starting next week I will no longer be a developer here. I thank my manager blah blah... I will be starting my dream role as Architect and I hope to achieve success.

    > Mike's colleagues: Aww.. We'll miss you.

    > Mike's manager: Is this your one week's notice? Did you take up an architect job elsewhere immediately after I promoted you to architect ?!

  • notachatbot123 4 days ago

    I was confused but then noticed the actual headline of the submitted page: "The end of the kernel Rust experiment"

    • Elfener 4 days ago

      That was also the title of the HN post, before it was changed.

    • cevious 4 days ago

      Kind of tells you something about how timidly and/or begrudgingly it’s been accepted.

      IMO the attitude is warranted. There is no good that comes from having higher-level code than necessary at the kernel level. The dispute is whether the kernel needs to be more modern, but it should be about what is the best tool for the job. Forget the bells-and-whistles and answer this: does the use of Rust generate a result that is more performant and more efficient than the best result using C?

      This isn’t about what people want to use because it’s a nice language for writing applications. The kernel is about making things work with minimum overhead.

      By analogy, the Linux kernel historically has been a small shop mentored by a fine woodworker. Microsoft historically has been a corporation with a get-it-done attitude. Now we’re saying Linux should be a “let’s see what the group thinks- no they don’t like your old ways, and you don’t have the energy anymore to manage this” shop, which is sad, but that is the story everywhere now. This isn’t some 20th century revolution where hippies eating apples and doing drugs are creating video games and graphical operating systems, it’s just abandoning old ways because they don’t like them and think the new ways are good enough and are easier to manage and invite more people in than the old ways. That’s Microsoft creep.

      • TazeTSchnitzel 4 days ago

        The kind of Rust you would use in the kernel is no more high-level than C is.

      • bonzini 4 days ago

        > Forget the bells-and-whistles and answer this: does the use of Rust generate a result that is more performant and more efficient than the best result using C?

        These are the performance results for an NVMe driver written in Rust: https://rust-for-linux.com/nvme-driver

        It's absolutely on par with C code.

  • raaron773 4 days ago

    I legit thought that rust is being removed.

    Good meme!

bryanrasmussen 4 days ago

really? I recently read that "A 100% Rust kernel is now upstream in Linux 7.4"

anotherhue 5 days ago

Safety is good.

  • userbinator 4 days ago

    Unless it means sacrificing freedom.

  • lomase 5 days ago

    That is why most of the world has not been using c/c++ for decades.

    • scuff3d 4 days ago

      I'm not on the Rust bandwagon, but statements like this make absolutely no sense.

      A lot of software was written in C and C++ because they were the only option for decades. If you couldn't afford garbage collection and needed direct control of the hardware there wasn't much of a choice. Had their been "safer" alternatives, it's possible those would have been used instead.

      It's only been in the last few years we've seen languages emerge that could actually replace C/C++ with projects like Rust, Zig and Odin. I'm not saying they will, or they should, but just that we actually have alternatives now.

      • pjmlp 4 days ago

        At least on PC world you could be using Delphi, for example, or Turbo Pascal before it.

        Also I would refrain me to list all other alternatives.

      • vbezhenar 4 days ago

        One could rewrite curl with Perl 30 years ago. Or with Java, Golang, Python, you name it. Yet it stays written with C even today.

        • johncolanduoni 4 days ago

          If you’re trying to demonstrate something about Rust by pointing out that someone chose C over Perl, I have to wonder how much you know about the positive characteristics of C. Let alone Rust.

        • avhception 4 days ago

          Your comment comes across disingenuous to me. Writing it in, for example, Java would have limited it to situations where you have the JVM available, which is a minuscule subset of the situations that curl is used in today, especially if we're not talking "curl, the CLI tool" but libcurl. I have a feeling you know that already and mostly want to troll people. And Golang is only 16 years old according to Wikipedia, by the way.

          • vbezhenar 4 days ago

            Java might not be the most popular VM in Linux, but let's talk Perl or Python. It's installed by default almost everywhere, it's probably impossible to find a useful Linux installation without these runtimes. So writing curl with Python makes perfect sense, right? It's memory safe language, good for handling inherently unsafe Internet data. Its startup time is miniscule, compared to typical network response. Lots of advantages. Yet curl is still written with C.

            I've never used libcurl and I don't know why is it useful, so let's focus on curl. Of course if you want C library, you gotta write it with C, that's kind of weird argument.

            My point is, there were plenty of better options to replace C. Yet people chose to use C for their projects and continue to do so. Rust is not even good option for most projects, as it's too low level. It's a good option for Linux kernel, but for user space software? I'm not sure.

            • avhception 3 days ago

              "[...] it's probably impossible to find a useful Linux installation without [Perl or Python]. [...]"

              Oof. We seem to have very, very different definitions for both "Linux" and "useful". If all Linux installs w/o Perl or Python would cease to exist tomorrow, we'd probably enter a global crisis. Industrial processes failing left and right, collapse of wide swaths of internet and telecom infrastructure and god knows what else from ships to cars and smartphones.

              Regarding libcurl: libcurl probably represents the vast majority of curl installations. curl the CLI tool is mostly porcelain on top of libcurl. libcurl is used in _a lot_ of places. For example, inside the PHP runtime. And god knows were else, there must be billions of installations as part of other projects. It's not a weird argument, libcurl is 95% of the raison d'être for curl. If you want a curl-like tool in Python or Perl, you gotta write it in Python or Perl. Somebody probably already did. So maybe just use one of these? Instead of demanding that curl be transformed into something which is incompatible with it's mission statement.

        • scuff3d 4 days ago
      • i_am_a_peasant 4 days ago

        you took the ragebait bro :))

      • lomase 4 days ago

        As everybody knows not a single programming language was released between C++ and Rust.

        • scuff3d 4 days ago

          By the 90s/early 2000s C/C++ were the only widely used languages that met my criteria. Rust is the first "modern" language to meet that criteria while simultaneously offering memory safety.

          If you could afford garbage collection you had plenty of options.

    • vardump 5 days ago

      That's not true when the topic is operating system kernels.

      • checker659 5 days ago

        OS kernels? Everything from numpy to CUDA to NCCL is using C/C++ (doing all the behind the scene heavy lifting), never mind the classic systems software like web browsers, web servers, networking control plane (the list goes on).

        • lmm 4 days ago

          Newer web servers have already moved away from C/C++.

          Web browsers have been written in restricted subsets of C/C++ with significant additional tooling for decades at this point, and are already beginning to move to Rust.

    • wat10000 5 days ago

      Most of the world uses other languages because they’re easier, not because they’re safer.

      • gpm 5 days ago

        They're easier because, amongst other improvements, they are safer.

        • wat10000 4 days ago

          Sure, my point is the safety is not why they originally supplanted C and C++. It was seen largely as a tradeoff between ease of development and runtime performance. Memory safety as a goal of its own didn’t become prominent until much later.

    • lawn 4 days ago

      People didn't use seatbelts before seatbelts were invented.

    • bogantech 5 days ago

      Most software development these days is JS/Typescript slop, popular doesn't equal better

      • recursive 4 days ago

        You can write slop in any language. And good software for that matter.

        • mlindner 4 days ago

          I've never met anything written in JS/Typescript that I would call "well written".

          • josephg 4 days ago

            I have. I personally really enjoy the recent crop of UI frameworks built for the web. Tools like Solidjs or Svelte.

            Whatever your thoughts are about react, the JavaScript community that has been the tip of the spear for experimenting with new ways to program user interfaces. They’ve been at it for decades - ever since jQuery. The rest of the programming world are playing catchup. For example, SwiftUI.

            VSCode is also a wonderful little IDE. Somehow much faster and more stable than XCode, despite being built on electron.

            • division_by_0 4 days ago

              Great points! I think your point about the JS community is often overlooked. Electron et al have made desktop UI/UX considerations more salient in the JS world. Desktop-like experiences in the browser can be great.

          • recursive 4 days ago

            I guess you should read more code.

          • lomase 4 days ago

            Bait used to be credible.

wewewedxfgdf 5 days ago

Oh dear can you imagine the crushing complexity of a future Rust kernel.

  • dralley 5 days ago

    By most accounts the Rust4Linux project has made the kernel less complex by forcing some technical debt to be addressed and bad APIs to be improved.

    • mlindner 4 days ago

      This made me quite curious, is there a list somewhere of what bad APIs have been removed/improved and/or technical debt that's been addressed? Or if not a list, some notable examples?

      • dwattttt 4 days ago

        I don't know that there's a list, but cases come to mind because they've been controversial.

        (Not a Linux hacker, so apologies if I get this wrong)

        The filesystem APIs were quite arcane, and in particular whether or not you were allowed to call a C function at a certain point wasn't documented, and relied on experience to know already.

        In trying to write idiomatic Rust bindings, the Rust for Linux group asked the filesystems maintainer if they could document these requirements, so that the Rust bindings could enforce as much of them as they could.

        The result was... drama.

  • JuniperMesos 4 days ago

    The Linux kernel is already very complex, and I expect that replacing much or all of it with Rust code will be good for making it more tractable to understand. Because you can represent complex states with more sophisticated types than in C, if nothing else.

  • J_Shelby_J 4 days ago

    Complexity of Rust is just codifying existing complexity.

    • accelbred 4 days ago

      I've been working on Rust bindings for a C SDK recently, and the Rust wrapper code was far more complex than the C code it wrapped. I ended up ceding and getting reasonable wrappers by limiting how it can be used, instead of moddeling the C API's full capabilities. There are certainly sound, reasonable models of memory ownership that are difficult or impossible to express with Rust's ownership model.

      Sure, a different model that was easy to model would have been picked if we were initially using Rust, but we were not, and the existing model in C is what we need to wrap. Also, a more Rust-friendly model would have incured higher memory costs.

      • josephg 4 days ago

        I totally hear you about C friendly APIs not making sense in rust. GTK struggles with this - I tried to make a native UI in rust a few months ago using gtk and it was horrible.

        > Also, a more Rust-friendly model would have incured higher memory costs.

        Can you give some details? This hasn’t been my experience.

        I find in general rust’s ownership model pushes me toward designs where all my structs are in a strict tree, which is very efficient in memory since everything is packed in memory. In comparison, most C++ APIs I’ve used make a nest of objects with pointers going everywhere. And this style is less memory efficient, and less performant because of page faults.

        C has access to a couple tricks safe rust is missing. But on the flip side, C’s lack of generics means lots of programs roll their own hash tables, array lists and various other tools. And they’re often either dynamically typed (and horribly inefficient as a result) or they do macro tricks with type parameters - and that’s ugly as sin. A lack of generics and monomorphization means C programs usually have slightly smaller binaries. But they often don’t run as fast. That’s often a bad trade on modern computers.

        • accelbred 4 days ago

          The code is written in an embedded style, i.e. no dynamic memory allocation or thread creation/deletion after program initialization. It's also prioritizing reducing memory usage over performance since we are targeting memory constrained devices (and our performance target is 10 tps and we have like 100k tps). Thus we'd use trait objects over monomorphization. Dynamic collections are also off the table unless backed by a fixed-size arena on the stack or static mem.

          We heavily use arenas. We also have runtime-typed objects used to represent dynamically typed data like that obtained from JSON/Yaml or over IPC. If we were to be more friendly to modeling in Rust, we'd likely require that all memory reachable from an object node be in the same arena, disallowing common patterns like having list/map's arrays in one arena and having keys/strings in another or in static mem (this allows reusing other buffers without forcing copying all the data, so backing arrays can be smaller).

          • josephg 4 days ago

            You said above:

            > Also, a more Rust-friendly model would have incured higher memory costs.

            I'm not sure how modelling everything in a rust borrow checker friendly way would change anything here? Everything you're talking about doing in C could be done more or less exactly the same in rust.

            Arenas are slightly inconvenient in rust because the standard collection types bake in the assumption that they're working with the global system allocator. But there's plenty of high quality arena crates in rust which ship their own replacements for Vec / HashMap / etc.

            It also sounds like you'd need to write or adapt your own JSON parser. But it sounds like you might be writing part of your own JSON / Yaml parser in C anyway.

            • accelbred 4 days ago

              Arenas aren't the issue. Its objects with mixed lifetimes and mutability. I cant easily model the lifetimes of objects when there are cases like an instance where buffer memory reachable from the object has a different lifetime than maps/lists. Also these objects could be transively shared or mutable. In order to make a Rust friendly model, I'd have the tree be all shared or all mutable, and have all reachable memory have the same lifetime. This would often mean allocating the full tree into one arena. That is where the overhead comes from. Each arena would need enough memory to store the entire object; currently they can be smaller since they often only need to hold parts of objects, not the entire thing.

      • dwattttt 4 days ago

        This is ultimately a good example of how to use Rust. You express as much of the API as you can safely, and the rest is unsafe. APIs that can't be safely modelled can still be exposed to Rust & marked unsafe, if they're needed

        • accelbred 4 days ago

          That works for functions. For datatypes that are used throughout the API, it does not work so well.

          • dwattttt 4 days ago

            Wouldn't a data type with no safe method of construction satisfy that? You can only get one by calling an unsafe function & satisfying its constraints.

            • accelbred 4 days ago

              That would be possible but also make its usage unergonomic and not the experience customers are expecting when requesting a Rust API.

      • generalenvelope 4 days ago

        Which SDK? I've only written Rust FFI to pretty basic C APIs. I'm curious to get a sense of the limitations on something more complex

  • mrtesthah 4 days ago

    There’s one already — they seem to be doing decently well.

    https://www.redox-os.org/

  • g947o 4 days ago

    Do you have any quantitative measures to prove there would be an increase in complexity?

amelius 4 days ago

That's what you get with slippery slopes.

jenadine 4 days ago

And yet, the Linux kernel's Rust code uses unstable features only available on a nightly compiler.

Not optimal for ease of compilation and building old versions of the Kernel. (You need a specific version of the nightly compiler to build a specific version of the Kernel)

  • barrucadu 4 days ago

    Don't the C parts of Linux heavily depend on GCC extensions too? Seems depending on specific compiler features isn't really a blocker.

    • tambre 4 days ago

      The difference probably is that GCC extensions have been stable for decades. Meanwhile Rust experimental features have breaking changes between versions. So a Rust version 6 months from now likely won't be able to compile the kernel we have today, but a GCC version in a decade will still work.

  • Levitating 4 days ago

    > Not optimal for ease of compilation and building old versions of the Kernel. (You need a specific version of the nightly compiler to build a specific version of the Kernel)

    It's trivial to install a specific version of the toolchain though.

    • qwm 3 days ago

      You don't generally need specific versions of GCC or Clang to build it I'm pretty sure.

      • mustache_kimono 3 days ago

        > You don't generally need specific versions of GCC or Clang to build it I'm pretty sure.

        You need a C11 compiler these days with loads of non-standard extensions. Note, for a very long time, one couldn't compile the Linux kernel with clang because it lacked this GCC specific behavior.

        I'm not really sure you can turn around and say -- Oh, but now we feel differently about the C standard -- given how much is still non-standard. For instance, I don't believe Intel's C compiler will compile the kernel, etc.

    • accelbred 4 days ago

      It really isn't if bootstrapping from source.

  • hmry 4 days ago

    luckily downloading a specific nightly version is only a single rustup command

  • johncolanduoni 4 days ago

    What if I told you… there was a simple, constant environment variable you could set to make the stable compiler forget it isn’t a nightly?

    • estebank 4 days ago

      When it comes to nightly features use, it is good to note that a stable compiler, a nightly corresponding to the date beta for that stable was branched out and an arbitrary nightly are different. A branched-off nightly might have had beta back ports for fixing stable features that the nightly will not have, and a nightly feature that is subtly broken on stable but isn't used in std will not have received a backport. So using nightly feature on stable might mean every now and then skipping a stable version, and using a nightly compiler means having to do thorough testing after updating on arbitrary days. Any given nightly has high chances of being fine, but every update brings the possibility of bugs.

    • nialv7 4 days ago

      the point is unstable features aren't guaranteed to not break after a compiler update. hence the specific version thing.

  • sebzim4500 4 days ago

    It's not ideal, but at least most of these are only used in the `kernel` crate, i.e. if there's a breaking change to these features it should be fixable without widespread changes.

  • flanked-evergl 4 days ago

    Can you please share more details about this?

hexo 4 days ago

And we're cooked.

fithisux 4 days ago

Rust in the kernel is a self-fulfilling prophecy.

andersmurphy 4 days ago

I guess it's time to finally try FreeBSD.

  • josephg 4 days ago

    Why? Are you allergic to running rust code? You know, you can’t actually tell when you execute a binary?

    I don’t like programming in Go, but nothing stops me running go programs on my computer. My computer doesn’t seem to care.

    • andersmurphy 3 days ago

      It's not about rust or no rust, rust is fine. It's about the constant drama.

      • timeon 3 days ago

        > It's about the constant drama.

        So why are you posting things like drama queen:

        > I guess it's time to finally try FreeBSD.

        (btw. FreeBSD is fine)

  • ggm 4 days ago

    Lua in the kernel!

  • astrange 4 days ago

    BSD development mostly works through the classic approach of pretending that if you write C code and then stare at it really really hard it'll be correct.

    I'm not actually sure if they've gotten as far as having unit tests.

    (OpenBSD adds the additional step of adding a zillion security mitigations that were revealed to them in a dream and don't actually do anything.)

    • anthk 4 days ago

      They don't do anything yet they segfault some C turd from 'The computational beauty of Nature's. You have no clue about any BSD and it looks. Every BSD has nothing to do which each other.

p0w3n3d 4 days ago

They had me in the first half of the article, not gonna lie. I thought they resigned because Rust was so complicated and unsuitable, but it's the opposite

  • qwm 3 days ago

    It got my hopes up that they had backed off so they could solve their problems before returning to subject the kernel to their language.

singularity2001 4 days ago

Completely tangential but it would be nice if could 'natively' run wasm.

sshadmand 4 days ago

I haven't had time to experiment with it yet. How is agent directed development doing with Rust 0-to-1 an 1-inf. product gen?

fithisux 4 days ago

By the way, M$$$ has already making the transition of its driver writing in Rust

https://github.com/microsoft/windows-drivers-rs

maybe this will be good for the rest of the kernels, IllumOS/HaikuOS/ReactOS.

maybe

stackedinserter 4 days ago

Why do Rust developers create so much drama everywhere? "Rewrite everything to Rust", "Rust is better than X" in all threads related to other languages, "how do you know it's safe if you don't use Holy Glorious Rust".

I'm genuinely not trolling, and Rust is okay, but only Rust acolytes exhibit this behaviour.

Simplita 4 days ago

I’m curious how they’ll manage long term safety without the guarantees Rust brought. That tradeoff won’t age well.

  • javawizard 4 days ago

    You may want to read the article.

    (Spoiler alert: Rust graduated to a full, first-class part of the kernel; it isn't being removed.)

  • silisili 4 days ago

    It's late, but I'm having a hell of a time parsing this. Could you explain what you meant?

    • javawizard 4 days ago

      I think they read the title but not the article and assumed Rust was being removed, and (rightfully, if that were true) opined that that was a shortsighted decision.

      (Of course, that's not what's happening at all.)

      • silisili 4 days ago

        Ah! I hadn't considered that, thanks. That makes way more sense - having read the article I couldn't figure out what was being said here otherwise.

hgs3 4 days ago

Rust in the kernel feels like a red herring. For fault tolerance and security, wouldn’t it be a superior solution to migrate Linux to a microkernel architecture? That way, drivers and various other components could be isolated in sandboxes.

  • inapis 4 days ago

    I am not a system programmer but, from my understanding, Torvalds has expressed strong opinions about microkernels over a long period of time. The concept looks cleaner on paper but the complexity simply outweighs all the potential benefits. The debate, from what I have followed, expressed similar themes as monolithic vs microservices in the wider software development arena.

    • hgs3 4 days ago

      I'm not a kernel developer myself, but I’m aware of the Tanenbaum/Torvalds debates in the early 90’s. My understanding is the primary reason Linus gave Tanenbaum for the monolithic design was performance, but I would think in 2025 this isn’t so relevant anymore.

      And thanks for attempting to answer my question without snark or down voting. Usually HN is much better for discussion than this.

      • SSLy 4 days ago

        Linus holds many opinions chiefly based on 90's experience, many not relevant any more. So it goes.

      • FpUser 4 days ago

        >"My understanding is the primary reason Linus gave Tanenbaum for the monolithic design was performance, but I would think in 2025 this isn’t so relevant anymore."

        I think that unlike user level software performance of a kernel is of utmost importance.

      • tgma 4 days ago

        Why do you think performance isn't relevant in 2025?

  • sedatk 4 days ago

    Microkernel architecture doesn't magically eliminate bugs, it just replaces a subset of kernel panics with app crashes. Bugs will be there, they will keep impacting users, they will need to be fixed.

    Rust would still help to eliminate those bugs.

    • johncolanduoni 4 days ago

      I agree it doesn’t magically eliminate bugs, and I don’t think rearchitecting the existing Linux kernel would be a fruitful direction regardless. That said, OS services split out into apps with more limited access can still provide a meaningful security barrier in the event of a crash. As it stands, a full kernel-space RCE is game over for a Linux system.

  • the_gipsy 4 days ago

    Go ahead and do it!

  • TZubiri 4 days ago

    You should develop a small experimental kernel with that architecture and publish it on a mailing list.

  • tgma 4 days ago

    Just use MINIX, or GNU Hurd.

    • fuzztester 4 days ago

      Even better, be like the Amish, and build your own as much as you can.

      • tgma 2 days ago

        Not sure I get the joke. MINIX is not building from scratch. It's a serious choice if one needs a microkernel. Hurd is more experimental but still not Amish.

  • Arodex 4 days ago

    Then you can try the existing microkernels (e.g. Minix) or a Rust microkernel (Redox). You already have what you wish for.

semiinfinitely 4 days ago

This is great because it means someday (possibly soon) Linux development will slowly grind to a halt and become unmaintainable, so we can start from scratch and write a new kernel.

  • bigfishrunning 4 days ago

    You can start from scratch and write a new kernel now! Nothing's stopping you.

  • preisschild 4 days ago

    Or you can take this as a sign that the linux kernel adapts modern programming languages so that more programmers can contribute :)

    • GaryBluto 4 days ago

      > the linux kernel adapts modern programming languages so that more programmers can contribute :)

      I'm eagerly awaiting the day the Linux kernel is rewritten in Typescript so that more programmers can contribute :)

ls-a 4 days ago

I never used linux because it was built using C++. Never have I cared what language the product was built it. The Rust community however wants you to use a product just because it's implemented in Rust, or atleast as one of the selling points. For that reason I decided to avoid any product that advertises using Rust as a selling point, as much as I can. Was planning to switch from Mac to a Linux machine, not anymore, I'm happily upgrading my mac.

  • jjice 4 days ago

    It's an optional tool that can be used to implement drivers now, not forced. If you don't like the idea of another language being supported for implementing a subset of kernel modules, I don't think you wouldn't enjoyed having a Linux machine anyways.

    • ls-a 4 days ago

      That's not the case. It's using Rust as a selling point. All the noise around using Rust is marketing. The fact that you think linux machines are enjoyed by only a specific group of people makes me happier with my choice

      • jjice 4 days ago

        > That's not the case. It's using Rust as a selling point

        "Rust as a selling point" was a big thing in 2018-2022ish. You see it a lot less of the "written in Rust" in HN headlines these days. Some people were very excited about Rust early on. What feels more common today are people who unnecessarily hate Rust because they saw too much of this hype and they (justifiably) got annoyed by it.

        If there is a new, optional language to be added to Linux Kernel development, Rust makes sense. It's a low level, performant, and safe language. Introducing it for driver development has almost no impact on 99% of users, except maybe it'll safe them a memory related bug fix patch having to be installed at some point. Is Rust the "selling point" here, or is the potential to avoid an entire class of bugs the selling point?

        > The fact that you think linux machines are enjoyed by only a specific group of people makes me happier with my choice

        If by "specific group of people" you mean "people who will refuse to use an OS based on the implementation language(s)", then I guess so.

        I don't mean to be rude (although it reads like it, apologies), but I just think that you're coming at this from a perspective of malice instead of what the goal was, which was to reduce bugs in kernel drivers, and not to pimp Rust as a programming language by getting it into a large software project.

        • ls-a 4 days ago

          No worries I didn't take offenses. I just disagree. The title should've been we reduced bugs in the kernel and here is some proof of that. The 2018-2022-ish hype (I call it bullying campaign) is still strong. Google recently did a blog post about Rust speeding up their development, in the age of LLMs, seriously! I can't stop lol'ing at that

      • umanwizard 4 days ago

        > It's using Rust as a selling point.

        That's just not true. Neither Linus Torvalds, nor the Linux Foundation, nor any major distro, nor anyone else who could conceivably be considered responsible for "marketing" Linux is saying you should use it because a small part of it is written in Rust.

        I just went to ubuntu.com and the word "rust" does not appear anywhere on the front page. So what are you talking about?

        • ls-a 4 days ago

          > Stay tuned for details in our Maintainers Summit coverage.

          I can argue otherwise. Developer advocacy is a form of marketing (specially for a product traditionally targeted towards tech savvy people)

  • michaelmcmillan 4 days ago

    Linux is written in C, my friend.

    • ls-a 4 days ago

      C, C++, I don't think you got the gist of what I said

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection