Rust Style Guide
Posted by kaycebasques 16 hours ago
Comments
Comment by japgolly 8 hours ago
Comment by demurgos 1 hour ago
I'm working at a company with a very large Rust codebase with thousands of endpoints. We use multiple repos and each service publishes its API as crates. A few years ago those were manually written and teams used exhaustive enums frequently in their API. It did not prevent runtime issues as older clients could receive responses with new variants from newer servers. It also made versioning painful because semver would dictate a major bump, but Rust's nominal typing means that types from different major versions get different identities, making it very inconvenient to integrate with these types (think shared helper functions, extension traits, ...). This caused people to release new variants in feature bumps and wreck havoc in the dependency tree by breaking compilation of intermediate libs.
Since then we switched to code generation from an IDL for the API model. I was leading this project and decided to produce non_exhaustive enums for the Rust code: it was 2 years ago and the situation drastically improved.
We have a CI step running lints with `non_exhaustive_omitted_patterns` mentionned in an other comment. That's the right approach for such a public API. The big difference is that is that warnings are local to the crate you're working on, so they're more actionable than errors.
This was all in the context of modeling the API of a distributed system. I still tend to use non_exhaustive more often now even for regular helper libraries. It always requires some thought as you need to plan for the forward compat of your code.
Comment by smallnamespace 1 hour ago
At Google, the bottleneck is that a team changing a commonly used enum will not know how to update all the broken use sites, since it can be affecting dozens or hundreds of teams.
It is better to decouple the enum change from the use site change and let consuming teams update on their own schedule.
Comment by berkes 1 hour ago
Comment by smallnamespace 1 hour ago
Note that teams generally manage their own deployments, so even a repo wide code change doesn’t force the update of an older deployed binary.
Comment by i2talics 7 hours ago
Honestly what I tend to see is that most enums are not exposed publicly at all besides maybe error types and configuration options (where the user usually constructs but does not match on them). In both cases #[non_exhaustive] is valid. For all of the non-public enums you get to enjoy the compiler exhaustiveness enforcement.
Comment by rendaw 5 hours ago
It's always up to callers to decide to handle everything, or decide that additions are non-fatal and use a wildcard branch to ignore them. The same enum could need to be exhaustive for one use case, or subset matched by another.
Comment by alfiedotwtf 4 hours ago
Comment by froh 3 hours ago
edit: I don't know rust. in other languages he's such catch all patterns exist and you have to either capture each possible value explicitly or you express "here in this fu, I take care of these and all others I do that..."
Comment by mort96 3 hours ago
Comment by eptcyka 3 hours ago
Comment by ninkendo 7 hours ago
It’s the eternal struggle between flexibility and strictness that doesn’t really have a silver bullet answer. Or maybe it’s better framed as “flexibility, safety, backwards compatibility, pick any two”?
Comment by Thom2000 4 hours ago
Comment by quotemstr 5 hours ago
I just fundamentally disagree with Google on how to evolve data structures. Sloppy open-domain protobuf field presence, enum values, whatever are illusory extension points. Better to have discrete versions of a data structure --- Foo1, Foo2, Foo3, etc., and rigid checking in each one than to have just one "Foo" with optional-everything that changes implicitly over time.
Comment by akshayshah 7 hours ago
Comment by Groxx 6 hours ago
Comment by zeroCalories 6 hours ago
Comment by Pavilion2095 4 hours ago
Comment by zelphirkalt 4 hours ago
Second case is the same. The other team needs to definitely know, that their assumptions expressed in their current code are broken and need to be adjusted.
We just need to stop to take whatever shit Google is doing as the one bar to measure all others, and need to understand that they may be different requirements than a typical business. We are not Google.
Comment by alfiedotwtf 4 hours ago
If you really don’t care about compiler warnings, what’s the actual point of using Rust?
Comment by monocasa 15 hours ago
That feels like the ~2010 era of people saying that functions should be as small as possible. That lead me to reviewing a lot of code where every function was one or two lines and you couldn't actually see what was going on anymore through the layers of unneeded abstraction.
I want to give chrome the benefit of the doubt, but that seems really goofy.
Comment by evmar 14 hours ago
Given that a crate is the unit of build parallelization in Rust, there's a benefit to more crates especially when they don't cost much cognitive overhead. You could imagine using crates in the way you'd typically use separate mods in a normal Rust project.
I dug around in their code search to find some examples but didn't see much Rust in there, seems still early. I think https://source.chromium.org/chromium/chromium/src/+/main:tes... has ~4 Rust files that end up separate crates though. (One of them defines a proc macro so even in a Cargo built Rust project it would need to be in its own separate crate, I think!)
Comment by evmar 14 hours ago
https://source.chromium.org/chromium/chromium/src/+/main:tes...
Comment by skohan 15 hours ago
I guess smaller crates and avoiding nested modules could also help optimize for making the code greppable by coding agents without blowing up context windows.
Comment by i2talics 14 hours ago
I think one benefit of small crates is that it gives you more granularity in linking and dependency graphs, which is especially relevant for rebuilds. At a previous job we had a monolithic "utilities" crate, and this caused problems when you tried to depend on it for the IP address utilities but this brought in the radio frequency utilities. When one of these submodules got an update the versioning would excessively propagate downstream to every consumer. If this was organized as small "net-utils" and "rf-utils" crates then maybe it would not have been as much of an issue.
Comment by vvillena 14 hours ago
Comment by loeg 15 hours ago
Comment by hugmynutus 8 hours ago
So a single crate has to be as small as possible so builds are fast & cachable.
Comment by pornel 13 hours ago
OTOH if you have one crate with lots of modules, it's tempting to import anything anywhere and use pub(crate). Rustdoc needs to be configured to show private items if you want to see internal APIs.
Comment by tcdent 13 hours ago
And then the ability to enforce a formalized layer between crates and the way that they assemble into your application (i.e. the public API) is powerful for comprehension and maintainability. I go as far as documenting each crate with its own README that presents it as a standalone component with usage instructions, much like an open source library, even if it's only ever used in a single system.
Comment by skavi 12 hours ago
Comment by dnautics 15 hours ago
Comment by epage 13 hours ago
This just pushes people to have redundant information in types (`IoError` instead of `io::Error`).
Unless a type is widely recognized (like `HashMap`), I prefer to have them fully qualified so I have the contextual meaning for it. If I am working with a generic name like `Source`, what does that mean? I shouldn't have to look up in the imports to understand the code (or only understand it through an LSP).
Reducing imports also reduces unnecessary merge conflicts.
Comment by Blikkentrekker 13 hours ago
Comment by B-Con 11 hours ago
Everyone remembers finding some hideous name like foo.widget.widgetBuilder.widgetFactory in Java or something. It's nice to have naming rules, or at least guidelines, focused on trimming redundancy and keeping the signal high.
Comment by cobbzilla 5 hours ago
NO, it’s beautiful! https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...
Comment by epage 12 hours ago
Comment by boxed 3 hours ago
Comment by wtetzner 13 hours ago
Comment by preommr 13 hours ago
Nowadays, I care about their recommendations as much as the ones from microsoft, or ibm.
Still big companies, lots of smart people, but nothing above norm.
Comment by afdbcreid 11 hours ago
Comment by tcallred 14 hours ago
Comment by JoeDohn 15 hours ago
But it wasn't as coherent and reliable from project to project like this guide. Kudos to google on this one !
Comment by i2talics 14 hours ago
Comment by petcat 15 hours ago
Comment by fasterik 15 hours ago
As a solo programmer, I still prefer C and C++. In fact, as I've incorporated LLMs in to my workflow, I've been increasingly drawn toward C and its simplicity. A lot of the QoL features of C++ simply aren't needed when you're writing less code manually.
Comment by loeg 10 hours ago
Comment by Groxx 6 hours ago
Comment by anthk 11 hours ago
Comment by pjmlp 4 hours ago
Other than a few examples given in the past, the Rust adoption among WinDev doesn't seem to be really taking off like in Azure.
Indeed C# is getting more low level coding features, and the unsafe memory model is being redone in .NET 11 for a reason.
Comment by boredatoms 9 hours ago
Comment by npalli 14 hours ago
Comment by simonask 12 hours ago
Like, I agree that C++ will be around for a long while, but the writing is on the wall.
Comment by 20k 11 hours ago
Comment by simonask 56 minutes ago
There's no reason to think that current game engines will have their fundamental APIs around scene management, serialization, entity composition, and so on, ported directly to Rust, because these things are typically designed around available language features. For example, an engine written in C++ might have its own version of `dynamic_cast` and RTTI, and that's going to be an extremely awkward design in any other language.
I think 15 years is too high, but I agree that it will be a while, because a triple-A game engine is a huge investment.
Comment by rudedogg 9 hours ago
Comment by dwattttt 3 hours ago
Comment by dbdr 7 hours ago
Comment by QuantumNomad_ 5 hours ago
Comment by tonyhart7 10 hours ago
15 years of pre LLM or post LLM ?????
Comment by loeg 10 hours ago
Comment by npalli 11 hours ago
Comment by simonask 1 hour ago
Comment by 59nadir 2 hours ago
Even disregarding tooling I'm actually happier writing C than (even) Odin because it's really just a natural end state of changes I'd made to how I write code over the past 7-8 years and what I expect from a language (to not do much, and to not get in the way).
It's hard to compete with the tangibles of writing/using C:
- Somehow it has shorter compile times than everything else still, particularly for release builds?
- Everything that matters (to me) has C bindings.
- All the tools just work and they work well (and a lot of them are made specifically for C anyway).
- The compilation model is actually better, more straight forward and easier to make fast than languages that try to "fix" it, unless you sit there fighting it and overcomplicate it with overwrought build systems. (`make` is better than I used to give it credit for, though).
I think Ada is the only language that could peel my attention away from C at the moment, which is ironic given my "Don't do much, get out of my way" stance. It turns out you can do more if you're sensibly designed, have the right escape hatches and actually provide real, useful features (basically every feature regarding arrays in Ada and their interplay with other features like index types, etc.). Ada is not as easy to port from Odin, though, and Ada would be a much bigger gamble than C in so many ways. We don't mind writing the code we use ourselves (we in fact prefer it), but in Ada a lot of that code would be decidedly alien to how Ada seems to work in many ways.
With that said, I do have an Ada port of a game I was working on that does illustrate a lot of upsides. It's a different possible end state.
P.S. I've tried Zig, I wrote Zig for several years before I started using Odin, it's what got me back to imperative, small, native languages. It's what started this journey back to C.
Comment by xedrac 14 hours ago
Comment by skohan 15 hours ago
Comment by vlovich123 14 hours ago
Comment by skohan 13 hours ago
Comment by Philpax 13 hours ago
Comment by FuckButtons 9 hours ago
Comment by vlovich123 8 hours ago
There’s also work actively ongoing to make certain constructs even easier to express more ergonomically and letting user programs implement some of the magic that’s currently restricted to the standard library
Comment by skohan 4 hours ago
If all you care about is performance, you're going to be fighting Rust's memory model for no reason.
Comment by tialaramex 2 hours ago
If you actually care about performance where you'd start is with measurements. What we see so much from C++ isn't measurements it is dogma. Things C++ forces on you must dogmatically be imagined as free without measuring them, things C++ does not have get treated as expensive, again without measuring so as to justify their absence.
For example, the unstable sort in C++ (std::sort) is typically implemented in a way which introduces Undefined Behaviour if your ordering isn't coherent either because you didn't realise that was mandatory or through some minor programming error. In contrast all of Rust's unstable sort implementations have been entirely safe even in the face of such mistakes.
And your dogma might tell you OK, but the C++ sort must be faster. That's why we're doing unsafe things, it must be faster. Except, nope, slower. Slower, but unsafe. Pointlessly worse. Only acceptable because of dogmatic belief.
Comment by skohan 2 hours ago
90% of the code I write these days is Rust. It's a great tool, and the performance/safety balance, as well as general developer experience makes it well-suited to a wide variety of applications.
But in the past I've also built an ECS implementation. For that to optimize performance (and yes I did measure this) you want to do bulk memory allocations memory, pack bytes in order to minimize cache misses, and dispatch multiple threads to read and write concurrently over your memory pool. You can do all that in Rust, and people have, but it's a pain in the ass.
And for example, if I were working on a high-frequency trading application, where every millisecond of additional latency represents millions of dollars of lost revenue, I wouldn't waste my time fighting the burrow checker just so I can have a prettier program.
Rust is an amazing tool, but that doesn't mean it's the optimal tool for every job.
Comment by Philpax 27 minutes ago
With that being said, I did write a compiler to specifically help me match C++ memory layouts in Rust [0], so I might be an outlier case :-)
Comment by tialaramex 48 minutes ago
Obviously like Michael Burry it is always possible that I'm wrong and I can't see why. But I did give you a specific example where the dogma says well we have to choose this unsafe way to do it, but the reality is that's not only unsafe it's also slower. It is just worse.
I am glad to hear that you measured. I've been yelling at people for not measuring for much longer than Rust has existed - if people measure and choose C++ because the numbers were better I feel a lot better about that outcome.
As to being the right tool, I firmly believe we should use a lot more niche languages which do only one narrow thing very well. One common thing you'll see argued about the Memory Safe languages is that they need runtime bounds checks and such checks are a performance cost the unsafe languages do not incur. WUFFS illustrates that if we're willing to give up generality we can have a language which is entirely safe but doesn't do runtime bounds checks - because it proved mathematically at compile time that your code has no bounds misses so such checks are needless.
Arguably for HFT in particular the dirty secret is that if things go badly enough wrong you just say "Oops" and get a do-over because money isn't real.
Comment by SkiFire13 3 hours ago
No, Rust _has_ a stable ABI, it's the C ABI. It just isn't the default.
Comment by Philpax 32 minutes ago
I can confirm that this has been sufficient for all of my memory layout needs, including interfacing with existing C/C++ code in memory.
Comment by smj-edison 7 hours ago
Comment by j1elo 14 hours ago
Comment by pjmlp 14 hours ago
Ah and Rust's compiler backend dependency on LLVM and in the future GCC as well.
Comment by loeg 15 hours ago
Comment by redox99 6 hours ago
Comment by geertj 6 hours ago
Comment by zelphirkalt 4 hours ago
Comment by tkz1312 15 hours ago
Comment by neutronicus 15 hours ago
Comment by tormeh 10 hours ago
Comment by thomashabets2 15 hours ago
Comment by 3eb7988a1663 10 hours ago
This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.
https://devblogs.microsoft.com/oldnewthing/20180228-00/?p=98...Comment by neutronicus 15 hours ago
From the job postings, many of them seem to be physics simulations of various kinds where (in my experience) memory is allocated on the heap without a second thought. Well, there are second thoughts, but those second thoughts are about performance.
Comment by debo_ 11 hours ago
Comment by pornel 13 hours ago
Comment by nchie 3 hours ago
Comment by pjmlp 4 hours ago
Comment by m00dy 4 hours ago
Comment by pjmlp 4 hours ago
Comment by m00dy 3 hours ago
Comment by pjmlp 3 hours ago
Comment by m00dy 7 hours ago
Comment by pjmlp 4 hours ago
Comment by pipe01 49 minutes ago
Comment by m00dy 4 hours ago
Comment by pjmlp 4 hours ago
> Frame was created over the past month largely via Claude Code. The Assembly code in all its glory can be found on GitHub.
https://www.phoronix.com/news/Frame-X11-Server-Assembly
The eating everything part is only the usual hype cycle as folks update their CVs, in this fashion driven industry.
Except this time around AI makes language knowledge meaningless, we can vibe code anything into any language.
Comment by m00dy 3 hours ago
Comment by pjmlp 3 hours ago
Comment by m00dy 3 hours ago
Comment by pjmlp 3 hours ago
Naturally everyone around the globe that contributes to LLVM will gladly contribute the rewritten version as well.
Comment by IshKebab 14 hours ago
Comment by icase 15 hours ago
Comment by thomashabets2 15 hours ago
Considering that it's been 54 years, and we've yet to find any human being, any at all[1], who can write C without UB, I'd say that writing C in 2026 when there's any other option is basically misconduct and a good case could be made that if the code touches money in any way, then it could be a SOX violation too.
Writing C today is like still writing Cobol. Yes, if you are adding a new type of savings account to your bank, and the rest is in Cobol, then sure write it in Cobol.
Some microcontroller projects may have an ecosystem in C that makes other options harder in practice, but it's still a worthy investment to not use C. There's a reason phone baseband firmwares are moving away from C.
[1] No, not even djb, who people like to bring up.
Comment by clifflocked 14 hours ago
Undefined behavior does not mean that a language is useless. C is quite nice to write as an abstraction over assembly, and I highly recommend writing C code and thinking about (and checking) what assembly it compiles into.
Also, it is possible to verify that the types of UB that you are referring to do not occur: see the seL4 project, which provides machine-checked proofs for an OS kernel that no execution can reach a state that is undefined by the language specification.
Comment by thomashabets2 14 hours ago
Never said it was useless. But it's pretty damning that literally nobody can write correct code in the language. And my point is that it's been enough time that it can't be seen as a skill issue.
> C is quite nice to write as an abstraction over assembly, and I highly recommend writing C code and thinking about (and checking) what assembly it compiles into.
Absolutely. I think in order to understand programming you need to be able to write C, and be able to read assembly.
C isn't "high level assembly", with the whole discussion about the spec talking about the abstract machine, but one does not need to be a C language lawyer to be a good programmer.
But to your point about checking the output: That goes for Rust too, and godbolt.org supports Rust too, for this workflow.
So I'm not saying C is useless. But I am saying that if someone were to decide to write their greenfield project in C, then if it plans to have actual users (as opposed to a fun project), then it's basically misconduct.
Cf. Steve Gibson writes his software in assembly, still. Because he enjoys it, and his enjoyment is the primary user. I respect that. But I would NEVER hire someone to write whole applications like that in assembly. Or C.
Comment by dnautics 15 hours ago
Sel4?
Comment by 3eb7988a1663 10 hours ago
PDF: https://www.eng.auburn.edu/~kchang/comp6710/readings/They%20...
Comment by anonymous908213 14 hours ago
They aren't being snarky, they're stating a fact. Rust, rounding to the nearest percent, does not exist. It's a trendy language among the Silicon Valley types that HN draws, but 99.9% of the world runs on C/++, OSes written in C/++, and language VMs implemented in C/++. Maybe some day it will change, but hanging around here too much will give you a very skewed idea of how widely adopted it is.
Comment by thomashabets2 14 hours ago
Not as many as there are Python, Java, JS, or C++ programmers. Depending on the survey, C seems to be neck and neck with PHP.
I read the comment the other way, though. The way that says that those other more popular languages are not serious, and NOT for grownups with important jobs.
Edit: actually, Jetbrains 2025 survey has C neck and neck with Rust: https://www.jetbrains.com/lp/devecosystem-data-playground/ . Both "below the fold" and less than 10% of Java.
Comment by anonymous908213 14 hours ago
Think about what Rust software people actually use. Codex CLI, uv, ripgrep, and what else? That's three pieces of software, all development tools for development nerds. Normal people aren't engaging with any of this stuff. Your metaphorical grandma has never used software written with Rust in her life.
Comment by thomashabets2 14 hours ago
> Think about what Rust software people actually use
More and more Chrome, Google, Android, Cloudflare, Prime Video, and phone basebands, parts of Linux kernel, and many other things.
Normal users literally use those all day every day.
Are they 100% Rust? Of course not (well, I don't actually know if some phone basebands are, by now. Naturally very closed source). But they're not 100% another-language either.
If C disappeared from the world, the world would stop, yes. Same with Cobol. Same with Java. Same with C++. Same with assembly.
If I were to guess (completely without basis for my guess) about the number of lines of code that normal users exercise in a normal day (counting each line just once), my bet would be on Java or JS.
Would the Java be able to run without the C code? No. But normal users would not be able to do anything if only C was left. And all banks would be gone.
And in any case C would not be able to do anything without transistors.
Comment by dwattttt 14 hours ago
Comment by anonymous908213 14 hours ago
Comment by aero_code 14 hours ago
- Chrome currently uses https://github.com/googlefonts/fontations to implement its font handling, and text is the main thing on most web pages.
- Windows' DirectWriteCore for font handling is also now written in Rust.
- Firefox's whole CSS engine and GPU 2D rendering engine are written in Rust.
Comment by thomashabets2 14 hours ago
I pointed to a jetbrains study, and then there's a stackoverflow survey[1] showing C neck and neck with PHP at 11th place among professional developers.
We all know there's lots of important C code out there. I don't see anyone going "RIIR!!!" in this thread.
But obviously yes, the 11th place language will have MANY programmers working on it. Not as many as JS by far. But many. In that survey Go is just after PHP. There are also many many Go programmers.
We are not yet at risk of running out of C programmers, like the Cobol situation. Nor do I want us to.[2]
But what point are you trying to make by so strongly defending C and the comment "grownups with important jobs write C"?
[1] https://survey.stackoverflow.co/2025/technology#most-popular... [2] relevant comment: https://news.ycombinator.com/item?id=50187384
Comment by anonymous908213 13 hours ago
Comment by dralley 8 hours ago
Cloudflare's network routing code is predominantly Rust. Massive parts of AWS and Azure are Rust (including crown jewels like S3 and Lambda). Multiple car manufacturers have shipping Rust code in their production cars for years, albeit yes it's a slow process intoroducing it into regulated industries. Airbus and Boeing are putting up job openings for Rust development. As mentioned critical pieces of Windows and Android are now written in Rust. If you use Discord - that's Rust. If you use Amazon Prime Video or Disney+, that's Rust. I could go on.
When like 40% of internet traffic and 75% of end user devices are using Rust in some capacity, to say that it's "not production" is just ignorant, arrogant nonsense.
Comment by dwattttt 11 hours ago
Your argument was that the only Rust projects there are are little developer tools, so Rust isn't a production language. When pointed out there are large projects that every day users rely on that use Rust, and not just in corners of the codebase, code that's exercised by approximately all users, you insist it's still not production?
Comment by contact9879 12 hours ago
You must not exist, because, rounded to a whole percent, literally 0% of the lives of people in the world are directly affected by you personally
Comment by anthk 11 hours ago
Even big bases as FFMPEG will be ported to Rust, as the porters' repos already use Rust's cc to compile ASM code.
And of course Qemu will be almost a mandatory candidate for obvious reasons.
For instance, quick and dirty SGI Irix emulator:
Comment by thomashabets2 1 hour ago
> running in a browser written in C++
As other have pointed out, that browser would not render fonts without Rust. You use your browser without fonts? I mean, it's not impossible. Some people navigate the web using screen readers.
> running on an OS written in C/++
Except the parts that are written in Rust or other languages, sure.
So tautologically, the parts that are not written in other languages, are written in C and C++. That's technically correct, the best kind of correct.
> Whatever higher-level language you use, it's powered by C/++
"Powered by" in that it runs on an OS written in C, assembly, and C++, sure. Still not relevant. Languages tend to want to "self-host".
> Your game engines are written in C/++
Well, most gaming hours in the world are probably spent on games written in C#, Java, Kotlin, Swift, and Objective-C. And JS.
JetBrains 2025 study has 40% of game development as C#. C++ just 29%.
AAA games, sure. But it's understatement of the year to say that because AAA games are written in C++ that means it's the only production language.
> Your fucking car is written in C
I think you're stuck in the past. This is no longer a categorically true statement.
The world changes. It used to be a true statement that "americans don't even have passports". In 1989 only 3% had passports, and the world could mock that figure. Today it's 48% and rising.
Just like you should no longer say "americans don't even have passports", because while the percentage may not be a record, it's no longer true, you should stop saying other things when they are no longer true.
> literally 0% of the software anyone uses being written in Rust.
As I have others have repeatedly proved to you, this is literally (actual literally, not as a rhetorical device) false.
I guess you could live in a world with 0% Rust. Your car is old, your Linux kernel was compiled to exclude Rust parts (not sure this is possible. Haven't checked), and you don't run anything Chromium-based, or Firefox. And you don't own an Android phone.
But you saying (asserting without evidence) that it's only minor systems in these omnipresent systems that use Rust, then… uh… what's your point? In a car, if C controls fuel injection and Rust controls the power steering, does that "not count", and you'd still claim "literally 0%"?
But… like, if you have an iPhone instead, do you think it doesn't run anything Objective-C or Swift?
I think it's accurate enough to say that "Cloudflare runs on Rust".
You think you, and normal people, never use Cloudflare? Cloudflare hosts like a a quarter of web traffic.
A quarter of web traffic runs on Rust. In production. Right now.
> You're talking about how "writing new C in 2026 is misconduct" like it's a relic of a bygone era
Just like with Cobol, in an existing system it does have its place for extending existing code.
But that "new" is key.
> world around you is a world written entirely in C
Entirely? No. Nobody's saying there's no C code in existence. I don't know why you care to defend against that imagined claim.
> rounded to a whole percent, literally 0% of the software anyone uses being written in Rust.
Does it matter, if (say for example) your pacemaker or car ignition runs Rust?
Come back, zinc, come back.
Comment by scottyah 13 hours ago
Comment by dwattttt 11 hours ago
Comment by anthk 11 hours ago
>Codex CLI, uv, ripgrep, and what else?
RustDesk, Servo/Firefox, tons of gtk4-rs on Gnome and extra tools, Librsvg, CosmicDE (Fedora Atomic with Cosmic can be slightly faster than vanilla Gnome Silverblue), Ruffle, Gopher64, ArtCraft (both the vibecodec cr*p and the AI powered magical multimedia IDE doing crazy stuff which is fine).
Oh, and Harper to sharp your English skills:
https://github.com/automattic/harper
IronCalc looks better than LO Calc performance wise:
https://github.com/ironcalc/ironCalc
Gnome might be a Rust domain tomorrow and nobody would bat an eye. Fedora/RH/IBM can rewrite the Anaconda installer in Rust in no time.
Comment by mahboi 13 hours ago
Comment by oddCopper65 15 hours ago
Comment by sebastianconcpt 15 hours ago
Comment by eviks 5 hours ago
> Manual alignment
Guess, another decade before Rust robots can do columns?
Comment by hitekker 11 hours ago
That's pretty direct. IIRC, the Rust for Linux people also have that refrain informally
Comment by slaymaker1907 14 hours ago
Don't do weird crap with lifetimes to try and convince the compiler that what you're doing is ok, just throw Rc/Arc on it and be done with it.
The Rc/Arc advice also applies to C++ IMO, though you use different constructs, std::shared obviously, but there is a strong argument to be made for a std::shared_st or something which is single threaded.
It would not surprise me if this advice comes from experience with C++ where there is no Rc so reference counting is very expensive. Even so, you can greatly reduce the expense by passing things by ref where lifetimes are simple which is the vast majority of the time.
Comment by i2talics 14 hours ago
Comment by mrbonner 11 hours ago
Comment by wtetzner 13 hours ago
Adding Rc/Arc is just another layer of indirection and noise that makes the code hard to read.
Comment by wocram 5 hours ago
Comment by eugenedonin25 2 hours ago
Comment by manlymuppet 9 hours ago
Comment by threethirtytwo 9 hours ago
Comment by JimTheMan 9 hours ago
Not a professional programmer, so it's a genuine question rather than a statement.
Comment by threethirtytwo 7 hours ago
Comment by 0xmassi 1 hour ago
Comment by mmooss 13 hours ago
Anytime numbers and letters are mixed, it's more readable if the letters are lowercase. It's easier to read the variable heights - numbers are usually capital letter height, sometimes with descenders - and avoids confusing 0O, I1, even 8B and 5S (think of a degraded printed serial number, poor lighting, etc.). There's only l problem that persists.
Comment by IX-103 12 hours ago
Comment by bibekadhikari 10 hours ago
Comment by chmmohibullahpa 3 hours ago
Comment by younglunaman 14 hours ago
Comment by icase 15 hours ago
Comment by sebastianconcpt 15 hours ago
Comment by xiaodai 12 hours ago
Comment by shaftway 12 hours ago
Comment by holografix 14 hours ago
Comment by japgolly 8 hours ago
Comment by incrediblers 14 hours ago
// Mine
let label = Label.text("Hello Wold");
let label_text = label.get_text();
// Theirs
let label = Label.set_text("Hello Wold");
let label_text = label.text();
A method is a way to accomplish a specific task. Emphasis on specific not generic. The getter task is to always return. The setter task is specific. So the method should be the setter - `text`, `color`, `fill`. In Rust the getter can't have same name, so prefix it. Not the other way around.Comment by i2talics 14 hours ago
That being said I don't particularly understand your conception of a method. They are both methods. The getter ought to have a shorter name since it is probably called more frequently and because it inherently has less of an impact -- this goes along with the principle that names that demand attention should be larger and easier to notice.
Comment by incrediblers 14 hours ago
But this made me think...
> "The getter ought to have a shorter name since it is probably called more frequently"
So i checked. Rough agent driven counts:
https://github.com/ronilan/incredible-flappy 407 setters and 183 getters.
https://github.com/ronilan/rusticon 546 setters and 5 getters
https://github.com/ronilan/shape-sorting 688 setters and 33 getters.
And in a code editor with a lot of ui configurations based on reusable elements 2865 setters and 206 getters.
In reactive apps on state handlers call on setters with state values. No getters involved...
Comment by afdbcreid 14 hours ago
Comment by incrediblers 13 hours ago
Comment by i2talics 8 hours ago
Comment by incrediblers 6 hours ago
Comment by fwip 11 hours ago
Comment by trimbo 14 hours ago
Comment by epage 13 hours ago
A builder type like `Command` will have unqualified setters and `get_` qualified getters.
For record-like-structs, I think unqualified getters becomes preferred and `set_` qualified setters.
Comment by Thanemate 15 hours ago
So it's not like I am willing to read through this and think to myself "I cannot wait to pick up some new ways of doing things". I'm the general to my agentic army now.
I guess you would code manually every now and then for your own enjoyment but at that point do you care about style guides written for scale?
Comment by nimih 15 hours ago
> I guess you would code manually every now and then for your own enjoyment but at that point do you care about style guides written for scale?
I think they're still quite valuable in that case, for a couple reasons:
- When learning a new language (which happens much more frequently when writing code "for pleasure," as it were), "written for scale" guidelines still translate pretty well to "written for oneself" IME. At the very least, they tell you what to expect in code you read, and give you a reasonable starting point as you develop your own taste and stylistic preferences.
- I've noticed some open source projects beginning to institute anti-AI contribution guidelines, and such projects still benefit from codified style guides. Google obviously doesn't fall under this category themselves, but in other language ecosystems, their style guides tend to find use in OSS projects.
Comment by anonymous908213 15 hours ago
What have you produced with your agentic army? Would you like to share with the class?
Comment by bigfishrunning 15 hours ago
Comment by solyin 14 hours ago
Comment by nvme0n1p1 14 hours ago
Comment by lioeters 9 hours ago
We get it, Rust is great, and LLMs too. But sometimes it's like listening to teenage philosophers who just discovered atheism, who go on and on to disparage all religions every chance they get. They're so full of themselves that they don't realize they're missing entire areas of understanding about the world and people.
The juvenile arrogance on display in many threads in recent years is second-hand embarrassing. Meanwhile the greybeards continue getting the job done, with or without LLMs, in Rust, C++ or even C.
Comment by solyin 6 hours ago
Comment by scottyah 13 hours ago
Comment by nvme0n1p1 12 hours ago
If you think style guides don't matter anymore, I encourage you to submit patches to the people on your list whose credibility you're borrowing, and see if they agree. Tell Linus to delete https://docs.kernel.org/process/coding-style.html because it doesn't matter because we have AI now. Or ask GvR if the current Python maintainers should deprecate https://peps.python.org/pep-0008/, since agents don't need it.
Comment by vor_ 10 hours ago
Comment by japgolly 8 hours ago
Comment by Mawr 12 hours ago
Comment by smoe 15 hours ago
It seems to me that if the intent is not just to produce code but also to operate it, having the different pieces behave in a similar, predictable way is kind of nice. Whether the software is written by AI or humans.
Comment by monocasa 15 hours ago
I would think they're probably even more meaningful in an agentic world.
Shitty generals can't review meaningfully review the work of their troops.
On top of that all, I just enjoy programming itself. It's less and less of the meat of a software job over time, but I was coding before I got paid for it, and I'll probably keep coding well after I can get paid for it.
Comment by mkagenius 15 hours ago
Except that reviewing has become just asking your agent what that piece of code does in english. Reading code has a bit of cognitive load, that we will probably drop it in coming years
Comment by u1hcw9nx 15 hours ago
I guess you would type out a comment manually every now and then for your own enjoyment, but at that point do you really care about comments at scale?
---
EDIT (above is a joke) It's very important that every time you find something that is of no use to you, you write a comment explaining that this link is of no interest to you, discouraging people from things you have no interest in. Monoculture for all!
Comment by yodsanklai 15 hours ago
Unless you're working on your own project on which you have full control, or you have a strong authority figure in your company who cares about that, it's a lost battle.
It's sad for anyone who love their craft, but tbh I'm not even sure it matters anymore for most projects.
Comment by scottyah 13 hours ago
Comment by petersellers 15 hours ago
Comment by bigstrat2003 14 hours ago
Comment by IX-103 12 hours ago
Comment by bigstrat2003 3 hours ago
Comment by gatlin 15 hours ago