News for hackers. Stuff that matters.
Re:Rust in Android: move fast and fix things by mk89 on Thursday November 13, 2025 @03:18PM (#45919981)
This is the bomb that sank C++ in 2026.

Have fun justifying that Rust is "also" unsafe, with the right tools you can achieve the same in C++, if you're a great dev you can do even better, etc.

Re:Rust in Android: move fast and fix things by beeflet on Thursday November 13, 2025 @03:41PM (#45920250)
rust has other advantages. I think cargo is better than cmake. I think the syntax is better, I think the way dependencies and modules are handled is better.

It can be annoying to write "safe" code, but once it meets a certain standard I can be confident in multithreaded applications I write.

I would like to use rust to write android apps. I don't really like the whole android studio java thing.

Re:Rust in Android: move fast and fix things by gpm on Thursday November 13, 2025 @03:45PM (#45920291)
> I think cargo is better than cmake

I expect that Google is using neither of these for most of their own code, but rather their own build system (which I think is the same between the languages).

I absolutely agree if you aren't Google though.

Re:Rust in Android: move fast and fix things by petcat on Thursday November 13, 2025 @04:24PM (#45920751)
Yeah my understanding is that google has some sort of God program they use that can compile anything and has 10,000 command line options.
Re:Rust in Android: move fast and fix things by kridsdale1 on Thursday November 13, 2025 @04:27PM (#45920789)
Re:Rust in Android: move fast and fix things by kridsdale1 on Thursday November 13, 2025 @04:26PM (#45920780)
Google3 uses Blaze which is an internal Bazel. And it’s fantastic. I like Facebook’s BUCK too but it’s basically the same thing.

If I were to go to another company I’d promote using either of the above.

Re:Rust in Android: move fast and fix things by vlovich123 on Thursday November 13, 2025 @04:50PM (#45921081)
What does Android do for Rust?
Re:Rust in Android: move fast and fix things by surajrmal on Thursday November 13, 2025 @09:41PM (#45923269)
It uses Soong which internally calls rustc: https://source.android.com/docs/setup/build/rust/building-ru...
Re:Rust in Android: move fast and fix things by ncruces on Thursday November 13, 2025 @04:51PM (#45921092)
Android uses Soong: https://source.android.com/docs/setup/build

Proprietary code uses the internal version of Bazel: https://bazel.build/

Re:Rust in Android: move fast and fix things by tux3 on Thursday November 13, 2025 @04:07PM (#45920546)
>I think cargo is better than cmake

That is an understatement. I can't think of a build system that has spawned more attempts to find something better than CMake has.

There have been so many people trying to make their own C/C++ build system and/or package manager out of sheer spite for CMake that it's frankly hard to keep track.

In fairness to them and to CMake, it's not a simple problem to solve. To truly know CMake is to wish you didn't, that way someone else would have to maintain it.

Re:Rust in Android: move fast and fix things by bluGill on Thursday November 13, 2025 @04:24PM (#45920754)
You seem to forget about autotools. Cmake is ugly but I'll take it over autotools.
Re:Rust in Android: move fast and fix things by danudey on Thursday November 13, 2025 @04:37PM (#45920932)
As an end user: at least with autotools it's easy for me to see the available configuration options with ./configure --help in a nicely readable way. cmake has -LAH but it's still... kind of awful.

At least it knows how to use ninja though.

Re:Rust in Android: move fast and fix things by bluGill on Thursday November 13, 2025 @06:06PM (#45921914)
Problem is autotools doesn't work when cross compiling - the options are there but there is always something wrong, and it isn't easy to fix. cmake can at least get that right. Note that I cross compile a lot of code so this matters to me, if you just do the common thing autolools might work - but make would as well then.
Re:Rust in Android: move fast and fix things by josephg on Thursday November 13, 2025 @06:22PM (#45922037)
Yeah; generally I find CMake rules are much easier to read and modify than autotools and makefiles. With Makefiles there’s about 18 different ways to write a rule to compile something, and I find I need to go hunting through a bunch of files to figure out how this makefile in particular defined a rule for compiling this C file in particular. CMake is much higher level. I can just see all the higher level targets, and how they’re built. Then - orthogonally - I can modify the build system that CMake uses to compile C code. It makes a lot more sense.

But I’d take cargo over any of this stuff. Cargo means I don’t have to think about compiler flags at all.

Re:Rust in Android: move fast and fix things by apitman on Thursday November 13, 2025 @11:36PM (#45923877)
If you find yourself doing a lot of cross compiling C check out the Zig build system.
Re:Rust in Android: move fast and fix things by bluGill on Friday November 14, 2025 @08:59AM (#45926738)
I am not going to rewrite the build system of a third party library.
Re:Rust in Android: move fast and fix things by johnisgood on Thursday November 13, 2025 @03:51PM (#45920370)
I dislike Rust, but I would definitely prefer it over the "Android Studio Java / Kotlin thing", for sure.
Re:Rust in Android: move fast and fix things by mk89 on Thursday November 13, 2025 @03:56PM (#45920425)
I cannot like Rust syntax, sorry.

For me the ideal syntax is C/Go, just to be clear what I like.

But I agree that the tooling that cargo introduced is a breath of fresh air in a world dominated by huge makefiles, libraries copied in the repository (I know, there is Conan, vcpkg etc)...

Re:Rust in Android: move fast and fix things by dontlaugh on Thursday November 13, 2025 @04:25PM (#45920763)
All three have very similar syntax when compared even to something like Python or Ruby, let alone ML or Haskell. Seems like a spurious complaint.
Re:Rust in Android: move fast and fix things by gf000 on Thursday November 13, 2025 @05:24PM (#45921476)
I mean, Rust is quite a different category than C or Go, if this is the 3 languages you reference.

Rust has plenty of syntax coming straight from ML (okay, not straight, probably through OCaML)

Pattern matching, destructuring, expressions everywhere, etc are stuff that C/Go never even heard about.

Re:Rust in Android: move fast and fix things by baq on Thursday November 13, 2025 @04:38PM (#45920940)
No need to like it. It isn’t brainfck and does the job.
Re:Rust in Android: move fast and fix things by MBCook on Thursday November 13, 2025 @04:54PM (#45921117)
I don’t disagree, that’s part of why I like Swift so much. Rust looks very C++ to me.

But if I was working in C++ and had a choice of C++ or Rust, I’d go Rust based on this.

Re:Rust in Android: move fast and fix things by mk89 on Thursday November 13, 2025 @04:58PM (#45921166)
Agree! Swift I forgot to mention. What a nice and elegant language.
Re:Rust in Android: move fast and fix things by claudiug on Thursday November 13, 2025 @04:59PM (#45921175)
in the beginning I also hate it, but now is fine.
Re:Rust in Android: move fast and fix things by guywithahat on Thursday November 13, 2025 @05:16PM (#45921368)
Go is such a great language. If your code base doesn't mind garbage collection and doesn't depend on some external library, everyone should really look at go. Great multithreading, memory safe, great error handling, and a familiar syntax for people coming from C++/Java/etc.
Re:Rust in Android: move fast and fix things by mkehrt on Thursday November 13, 2025 @05:46PM (#45921692)
> great error handling

Go get this completely wrong! It use a tuple rather than an enum for potential errors. This means you can forget to check errors and just use the invalid (nil?) return value from the function.

On the other hand, rust uses the Either enum to force you to handle the error. Alternatively you can use the ? operator to pass it to the calling function, which is reflected in the enclosing function's type.

Re:Rust in Android: move fast and fix things by ikety on Thursday November 13, 2025 @05:54PM (#45921803)
Yep Rust approach won. Pretty much every new language is adopting Result style errors and it's been adapted to plenty of existing languages.

It's a product of functional programming, and for me I can't see how you would ever want to handle errors outside of the functional programming railway-oriented style. For me it's just superior.

Re:Rust in Android: move fast and fix things by tczMUFlmoNk on Friday November 14, 2025 @12:54AM (#45924268)
Umm, actually, it's specifically a coproduct of functional programming. ;-)

https://en.wikipedia.org/wiki/Coproduct

Re:Rust in Android: move fast and fix things by ikety on Friday November 14, 2025 @09:47AM (#45927226)
Ha learned something
Re:Rust in Android: move fast and fix things by Mond_ on Thursday November 13, 2025 @06:19PM (#45922013)
Pet peeves nitpick: it's not even a tuple. Go doesn't have tuples. It just has special-cased "multiple return values", which means that it's often impossible to just stuff the return of a function call (error value and all) into any data structure to aggregate them. You just can't do without first defining a struct since tuples don't exist in Go.
Re:Rust in Android: move fast and fix things by tuetuopay on Thursday November 13, 2025 @07:06PM (#45922328)
How is Go memory safe? Memory safety does not mean "leaking memory".

It's absolutely possible to compute wrong pointer offsets. It's absolutely possible to dereference nil. It's absolutely possible to bork ownership and have multiple thread trample a struct. It's absolutely possible to reinterpret memory the wrong way.

I do agree that UAF is not possible (in most cases) due to the GC. That array indexing out of bounds is not possible. But it is by no means "memory safe" to the level Rust is.

Re:Rust in Android: move fast and fix things by gpm on Thursday November 13, 2025 @08:04PM (#45922694)
> It's absolutely possible to bork ownership and have multiple thread trample a struct.

This is specifically the one place where go is not memory safe IMO.

> It's absolutely possible to compute wrong pointer offsets.

In Go? Without the `unsafe` package (at which point you are explicitly opting out)? How? There's no pointer offset in the first place.

> It's absolutely possible to dereference nil.

Yeah, but that's safe defined behavior in go equivalent to "unwrap"ing a None option in rust. It reliably crashes. It's not like C where it's undefined behavior and you might crash of you might just corrupt random memory or have the optimizer make your code do something even stranger.

It's (really the lack of non-nil types) is one of many reasons why go doesn't produce as reliable software as rust, but it's not a memory safety issue.

> It's absolutely possible to reinterpret memory the wrong way.

Again, without the unsafe package? How?

Re:Rust in Android: move fast and fix things by uaksom on Thursday November 13, 2025 @08:48PM (#45922935)
Re:Rust in Android: move fast and fix things by gpm on Thursday November 13, 2025 @09:51PM (#45923342)
Right, that's the first category, "It's absolutely possible to bork ownership and have multiple thread trample a struct" resulting in undefined behavior.
Re:Rust in Android: move fast and fix things by tuetuopay on Friday November 14, 2025 @05:04AM (#45925500)
My Go is a bit rusty (pun intended), so I may have misremembered, especially with the pointer offsets. (just googled it, I did remember it, sorry for the confusion).

>> It's absolutely possible to reinterpret memory the wrong way. > Again, without the unsafe package? How?

Again my go is rusty, but I saw quite a bit of shenanigans in go with pointer casting from what's essentially a collection of void*. However perhaps those casts blow up at runtime? I'm too used to rust where it's explicit where it'll blow up.

>> It's absolutely possible to dereference nil. > Yeah, but that's safe defined behavior in go equivalent to "unwrap"ing a None option in rust. It reliably crashes. It's not like C where it's undefined behavior and you might crash of you might just corrupt random memory or have the optimizer make your code do something even stranger.

Agreed. I conflated "safety" and "robustness" here. The existence of nil is a thorn in the language.

Thanks for the corrections!

Re:Rust in Android: move fast and fix things by rascul on Thursday November 13, 2025 @08:01PM (#45922675)
Rust doesn't consider leaking memory to be unsafe.
Re:Rust in Android: move fast and fix things by tuetuopay on Friday November 14, 2025 @05:06AM (#45925515)
I mentioned it because I often hear people (not in this thread though) that thanks to its GC preventing memory leaks, Go is memory safe. The GC's role in memory safety is preventing dangling pointers though.
Re:Rust in Android: move fast and fix things by Zambyte on Thursday November 13, 2025 @06:43PM (#45922182)
Zig in spirit is essentially Go without GC. If GC is not reasonable for your usecase Zig seems like an awesome choice. Unfortunately it's probably about 5 to 10 years out from being stable enough for most people being able to write serious applications in it though (notable exceptions being Bun and Ghostty, but they have solid effort behind them keeping them up to date with Zig).
Re:Rust in Android: move fast and fix things by pjmlp on Friday November 14, 2025 @05:02AM (#45925492)
More like Modula-2 in C clothing, given the safety guarantees.
Re:Rust in Android: move fast and fix things by Zambyte on Sunday November 16, 2025 @09:22AM (#45945345)
If you're focusing on safety guarantees, sure. If you measure by safety checks included by default instead, it actually has more safety checks than Go (in particular, safety checked numeric operations for overflow).

The other big thing that makes it spiritually like Go is that you follow the same pattern of: allocate resource, immediately defer deallocation.

Re:Rust in Android: move fast and fix things by gf000 on Thursday November 13, 2025 @05:25PM (#45921486)
> If your code base doesn't mind garbage collection and doesn't depend on some external library, everyone should really look at go

I mean, at that point pretty much every language would be a decent choice.

Re:Rust in Android: move fast and fix things by tonyhart7 on Thursday November 13, 2025 @06:55PM (#45922261)
>mention Go

>great error handling

why people so confident being so wrong???

Re:Rust in Android: move fast and fix things by ViewTrick1002 on Thursday November 13, 2025 @05:31PM (#45921542)
> Great multithreading

Until you stumble upon the countless footguns. At least they generally don’t lead to memory unsafety, just garbage data.

Data Race Patterns in Go

https://www.uber.com/blog/data-race-patterns-in-go/

Re:Rust in Android: move fast and fix things by array_key_first on Thursday November 13, 2025 @08:41PM (#45922903)
Go has some of the worst error handling I've ever seen, even worse than most exception implementations IMO, and the type system is stupid enough that it's still very easy to write bugs. Go is only surface-level memory safe, you can definitely segfault in Go. And I mean real segfault, not nullptr dereference.
Re:Rust in Android: move fast and fix things by josephg on Thursday November 13, 2025 @06:16PM (#45921996)
> I cannot like Rust syntax, sorry. For me the ideal syntax is C/Go, just to be clear what I like.

I’m sorry if this comes across as dismissive, but I find it hard to take people seriously with complaints about syntax like this. Learning new syntax is really easy. Like, if you’re familiar with C & Go, you could probably learn all the syntax of rust in under an hour. The only surprising part of rust’s syntax is all the weird variants of match expressions.

Rust has some surprising semantics. Like how lifetimes work (and when you need to specify them explicitly). That stuff is legitimately difficult. But learning that if statements don’t need parenthesis is like - seriously whatever dude. If you want to spend your career never learning new stuff, software isn’t for you.

I picked up objective C about 15 years ago. The only thing most of my friends knew about it was that it had “that weird syntax”. It took no time at all to adjust. It’s just not that hard to type [] characters.

Re:Rust in Android: move fast and fix things by vacuity on Thursday November 13, 2025 @06:47PM (#45922211)
I'm very vocal that I don't like Python syntax, but I wouldn't refuse to write Python because of the syntax. If I had reason to write Python, I would grumble a bit but write the Python.
Re:Rust in Android: move fast and fix things by samdoesnothing on Thursday November 13, 2025 @08:27PM (#45922839)
It's not about learning syntax, it's about finding it generally tolerable to read. I personally find Rust syntax repulsive and would opt for a different language unless Rust was literally the only option. Thankfully it's never the only option, now or in the future.
Re:Rust in Android: move fast and fix things by josephg on Friday November 14, 2025 @05:11AM (#45925540)
Can you give some examples? Its hard to agree or disagree if you're not going to make any substantive claims.
Re:Rust in Android: move fast and fix things by cogman10 on Thursday November 13, 2025 @08:38PM (#45922888)
I'd say that rust has a weird level of being both verbose and terse in strange ways.

If you ever have to deal with lifetimes, then the verbosity goes up pretty significantly. And, dealing with pointers ultimately introduces multiple layers of concepts that you don't necessarily run into with C++/Go/Java.

Yet, with the type inference by default, rust can often feel shockingly terse. Doing collection manipulation is just as terse as any language you could imagine.

I think that's probably where complaints about syntax comes in.

C++ hides a lot of that complexity with move semantics, shorthands, autocoersion, and by making lifetime issues runtime problems. Languages like Go/Java/Python simply push everything onto the heap and try to avoid exposing low level memory semantics.

It's easy for me to see why someone wouldn't like rust. I think it's fine, but I'm also brain broken from perl and php.

Re:Rust in Android: move fast and fix things by josephg on Friday November 14, 2025 @12:15AM (#45924085)
> I'd say that rust has a weird level of being both verbose and terse in strange ways. If you ever have to deal with lifetimes, then the verbosity goes up pretty significantly.

I find rust generally more terse than both C and - especially Go, to which rust was compared upthread. Writing out lifetimes explicitly can be confusing. But I don't think it adds that much syntactic noise. Maybe 1/20 functions in my code have explicit lifetimes. That will confuse beginners, but I don't think its too bad once you're used to them.

> And, dealing with pointers ultimately introduces multiple layers of concepts that you don't necessarily run into with C++/Go/Java.

This is my #1 complaint about rust's syntax. If you ever need to interact with raw pointers within unsafe blocks, I feel like the language really fights you. It seems so strange, too - since unsafe blocks are exactly the place where it matters the most that my code is easy to read. Improving the syntax around pointers (for example by adding C's -> operator) would make unsafe blocks clearer.

Re:Rust in Android: move fast and fix things by WhyNotHugo on Thursday November 13, 2025 @05:29PM (#45921516)
Cargo is absolutely awful. It might be better than cmake, but it still the worst part about Rust. It’s completely opaque, and intermixes a huge pile of different functionality.

Distributing Rust software is the pain that it is mostly because of how Cargo works. It’s pretty much impossible to sanely distribute something that isn’t a headache for downstream to consume.

Re:Rust in Android: move fast and fix things by hardwaresofton on Thursday November 13, 2025 @06:06PM (#45921909)
> Cargo is absolutely awful. It might be better than cmake, but it still the worst part about Rust. It’s completely opaque, and intermixes a huge pile of different functionality.

"Absolutely awful" strikes me as wild hyperbole -- you also meant it this way as well, right? What toolchains are not absolutely awful in your mind?

Cargo isn't perfect by any stretch of the imagination -- there are a few common complaints that people have and a bunch of sharp edges (most of which have a github issue that has been open for years), but... "absolutely awful" has to be hyperbole.

Re:Rust in Android: move fast and fix things by crote on Thursday November 13, 2025 @07:10PM (#45922362)
That sounds a lot like the issues some Linux distros are running into, where they expect to be able to ship one single blessed pre-compiled version of every library, and have each app load it dynamically at runtime.

But that's just not how Rust works: it's trying to fit a square peg in a round hole, and it isn't Cargo's fault that you have trouble with it.

Re:Rust in Android: move fast and fix things by josephg on Thursday November 13, 2025 @06:05PM (#45921905)
Can you say more?

I’ve found it a joy to use compared to CMake and friends. How does it make it harder to consume something downstream? Seems easy enough to me - just share the source crate.

Are you trying to distribute pre compiled code or something like that? I can see how that would be harder - cargo doesn’t really support that use case.

How would you improve cargo?

Re:Rust in Android: move fast and fix things by WhyNotHugo on Friday November 14, 2025 @06:36PM (#45933473)
> just share the source crate

That’s a nice concrete example of something that sounds simple but is a nightmare.

Let’s be clear: the goal is to distribute a tarball which the receiver can build. Crates won’t be packaged in the target host (that’s part of Rust’s design), so we don’t have any choice but to include them too.

But there’s no simple way of gathering all of these. “cargo vendor” fetches all transitive dependencies for all platforms. So if any dependency supports windows, you end up with 400MB(!) of windows-only dependencies, even if your project doesn’t target windows. This makes “cargo target” useless.

There’s “cargo-vendor-filtered”, a huge hack around this bug, but it’s also broke in subtle ways.

In the end, if you want to distribute a tarball which a downstream can build, you can’t. Cargo works online only.

Like I said: cargo is too opaque. There’s no command to generate a list of files that it would download for a build. There’s no command to fetch all “real” dependencies. It too opaque an monolithic, doing everything in one indivisible way. This is a great experience for the developer, but awful for anyone else.

Re:Rust in Android: move fast and fix things by josephg on Friday November 14, 2025 @08:14PM (#45934169)
> Let’s be clear: the goal is to distribute a tarball which the receiver can build.

Thanks for clearing that up. What problem does that solve? I've never tried to do that, but I can see how it would be a pain in the neck.

I wonder how hard that would be to fix. It doesn't sound like a difficult feature to implement in cargo. I wonder how amenable the cargo devs would be to adding something like that?

Re:Rust in Android: move fast and fix things by tuetuopay on Thursday November 13, 2025 @07:12PM (#45922376)
Uuuh how so?

Cargo is a blessing for any source-available project. All bundled up, a `cargo build` away. Because don't you dare say CMake or autotools are better, that's just the stockholm syndrome kicking in because you're familiar with it.

Seriously, how a CMakeLists.txt can even be compared to a Cargo.toml file? One is imperative full of arcane conditions everywhere filled with boilerplate, while Cargo.toml is a declarative manifest of the package?

Though there is one very sore point when distributing software, and that is for distribution package maintainers, because the whole ecosystem has been built around the C model and dynamic linking. That is not even the fault of cargo, since Rust's ABI is not stable thus dynamic linking would not work most of the time. Another thorn is generic stuff, which needs to be monomorphized, and as such don't work with dynamic linking (without Box<dyn>); C++ actually has the same issue and is why there are so many "header only" libraries for it.

Re:Rust in Android: move fast and fix things by ModernMech on Thursday November 13, 2025 @05:33PM (#45921563)
Can you expand on your reasoning? Because the opposite seems to be true when it comes to projects like uv. People love the single-file executable -- easy to just compile that for a platform and have your users download it. It seems like the uv project is having a good time with that model, so I think they show it's not "impossible". Maybe they're doing something different I'm not aware of? Or maybe your use case is different, so what's impossible about your situation?
Re:Rust in Android: move fast and fix things by quantummagic on Thursday November 13, 2025 @05:56PM (#45921812)
Isn't it also the npm model?
Re:Rust in Android: move fast and fix things by gchamonlive on Thursday November 13, 2025 @03:28PM (#45920078)
I personally have zero interest in these feud wars. I'm only glad there are more quality options for Devs to develop safer system tools.
Re:Rust in Android: move fast and fix things by josephg on Thursday November 13, 2025 @06:31PM (#45922098)
The only people I’ve met who seem to think it’s a feud war are a few dyed in the wool C++ fans who implicitly hate the idea of programming anything else. Rust is just a language. It has some strengths and weaknesses just like every programming language. Some of its strengths are incredibly compelling.

Personally I’m relieved that we’re starting to see real competition to the C & C++ duopoly. For awhile there all the new languages were GC, and paid for their shiny features with poor runtime performance. (Eg java, C#, Ruby, Python, lua, go, etc etc)

Rust is a fine language. Personally I can’t wait to see what comes after it. I’m sure there’s even better ways to implement some of rust’s features. I hope someone out there is clever enough to figure them out.

Re:Rust in Android: move fast and fix things by bgwalter on Thursday November 13, 2025 @07:24PM (#45922463)
That is a surprising opinion. Rust marketing is entirely based - like in this submission - on comparing its memory safety to C/C++ and saying that C is bad!

Even in its own "memory safety" definition, which is the first result on Google, they criticize C instead of providing a proper definition:

https://doc.rust-lang.org/nomicon/meet-safe-and-unsafe.html

Re:Rust in Android: move fast and fix things by aw1621107 on Thursday November 13, 2025 @08:29PM (#45922847)
> Even in its own "memory safety" definition, which is the first result on Google, they criticize C instead of providing a proper definition:

I'm not sure that page is intended to provide a definition of "memory safety" in the first place? It (and the following page) seem more intended to introduce safe/unsafe Rust and the boundaries between the two.

It's also from the Rustinomicon, which states:

> Unlike The Rust Programming Language, we will be assuming considerable prior knowledge. In particular, you should be comfortable with basic systems programming and Rust.

So it's arguably unsurprising that a definition of memory safety would not be found there.

My guess is that if you want a more precise definition you'd want to look at the Rust Reference (e.g., [0]) or in related areas.

[0]: https://doc.rust-lang.org/reference/unsafety.html

Re:Rust in Android: move fast and fix things by Inityx on Thursday November 13, 2025 @08:49PM (#45922943)
I don't think materially contrasting yourself with your direct competition quite constitutes a "feud war"
Re:Rust in Android: move fast and fix things by bgwalter on Thursday November 13, 2025 @09:04PM (#45923035)
The downvoting patterns of anything that is mildly critical of Rust (see above) very much indicates a feud war. Rust has a dogmatic, aggressive and self-righteous community that uses any available tactic to push their language through.

The Rust literature is poorly written compared to C and Ada and the argumentation style on forums is sloppy, aggressive, and often unintelligible.

Which is a pity, because the language itself does not seem to be so bad.

Re:Rust in Android: move fast and fix things by josephg on Friday November 14, 2025 @05:04AM (#45925501)
> Rust has a dogmatic, aggressive and self-righteous community that uses any available tactic to push their language through.

I'm confused, because that's not been my experience of the rust community at all. I've been very critical of certain aspects of rust over the last few years, and I've (for the most part) gotten fair, reasonable feedback in response.

> The Rust literature is poorly written compared to C and Ada

I'm even more confused. Which literature are you looking at? Can you provide some examples so we’re all talking about the same thing?

I find most of the documentation around rust to be the best in the business. Eg here's the reference documentation for iterator trait, in the standard library:

https://doc.rust-lang.org/std/iter/trait.Iterator.html

Every function in that interface is well documented, with examples.

Here's the equivalent for C++:

https://en.cppreference.com/w/cpp/iterator/iterator.html

Where is the rest of it? This doesn't describe how iterators work at all. Or how to use them. There's more stuff in the header file but its inadequate by far.

So much C library code is documented in ad-hoc ways - often through doxygen, which is a disaster. Eg here's the documentation for LMDB. LMDB is one of the most thoroughly documented C APIs I've seen, but I find this almost totally unusable. I often find myself reading the source instead. There's not even any links to the source from here:

http://www.lmdb.tech/doc/group__mdb.html

In rust, any published crate automatically has a docs.rs/cratename link. Eg for serde's reference manual:

https://docs.rs/serde/

And then for the "guide" style explanation they wrote a book:

https://serde.rs/

Where is any documentation for the C standard library? As far as I can tell, there's no official documentation at all. There are man pages. But in comparison to rust's docs, or mdn for javascript, man pages are nowhere near as good. I’d give examples but this comment is too long already.

Re:Rust in Android: move fast and fix things by hyc_symas on Sunday November 16, 2025 @02:11AM (#45943349)
> So much C library code is documented in ad-hoc ways - often through doxygen, which is a disaster. Eg here's the documentation for LMDB. LMDB is one of the most thoroughly documented C APIs I've seen, but I find this almost totally unusable. I often find myself reading the source instead. There's not even any links to the source from here:

> http://www.lmdb.tech/doc/group__mdb.html

How is doxygen a disaster?

Why do we need links to the source code? Doxygen is already embedded in the source, you should already be reading the source code on your local machine. It makes no sense to go searching across the web for information that's already stored on your local machine. Especially since you have no idea if the version you find on the web matches the version you're using locally.

Re:Rust in Android: move fast and fix things by josephg on Monday November 17, 2025 @04:19AM (#45952057)
Hah! Do you have a running search giving you alerts when lmdb is mentioned or something?

> How is doxygen a disaster?

I've just never read any good, user friendly documentation ever produced by doxygen. Even when I used it myself. It always comes out looking like a pig's breakfast.

Like, take the lmdb docs. And I'm sorry for picking on it. But its a good example, because you've clearly put effort into using doxygen to document lmdb. I think the lmdb docs are about the best that doxygen generated documentation gets.

Looking at this page: http://www.lmdb.tech/doc/group__mdb.html

There's a bunch of concepts here:

- Environment (mdb_env)

- Database and database (dbi)

- Transaction

- Cursor

- Record

- Key

But none of those concepts are defined or explained. They're simply referenced without explanation in a big jumble of function names and descriptions, leaving me to figure out how they're supposed to work together. Maybe if those data types were defined up the top of the page? No. Doxygen tries to put some data structures at the top of the page - but for some reason the only documented types are MDB_val, MDB_stat and MDB_envinfo. All terrible places to start reading if you want to understand how to use lmdb.

Good documentation would lead with some front matter like:

- What does the library do

- How does the library sees the world. Here, explain the above concepts and how they relate. (Eg an environment represents a set of files on disk. Each environment contains a numbered set of databases, database contains a set of records. You can read and write within a txn. You can use a cursor to iterate. ... Etc)

- Code examples of all of the above. Ideally a hello world, and more complex / specific examples showing each feature.

Doxygen does not help with any of that. From this documentation I don't know how to use lmdb to make a correct program. I can kinda guess how to use various features, but not what the features actually are or how to use them correctly.

For example, I can obliquely tell from reading the function descriptions that an environment can be opened multiple times at the same time. But I have no idea why I'd want to do that, or how, or what performance implications there are, or if there are any gotchas I need to be aware of if I do that. I see there's a bunch of functions for mdb_env_copy. Does that copy in memory or on disk? Does it do it atomically, like at a snapshot? Is it synchronous? Does it fsync? fdatasync? What errors can happen? The documentation isn't helpful.

So I'm not just banging on about rust, here's equivalent - but much better - reference documentation for prisma:

https://www.prisma.io/docs/orm/reference/prisma-client-refer...

Prisma also has a separate guide, explaining the concepts involved:

https://www.prisma.io/docs/orm/prisma-client/queries/select-...

Or for another positive example, here's bun's documentation on using sqlite from javascript:

https://bun.com/docs/runtime/sqlite

They explain the concepts and present examples for how to use all the features. When I read those docs, I come away knowing how to use the library to solve my problems. I don't have that experience reading the lmdb documentation.

Maybe its possible to produce good documentation using doxygen. But I've never seen it done. Not even once.

-----

Side points:

> you should already be reading the source code on your local machine.

I'd rather not read the source code of all my dependencies to understand how to use them. Reading the source code of your dependencies should be a last resort. Eg, I don't go reading my compiler's source code if I want to understand my programming language. I don't want to read the source code of my web browser, or postgres, or linux, or any of this stuff.

> It makes no sense to go searching across the web for information that's already stored on your local machine. Especially since you have no idea if the version you find on the web matches the version you're using locally.

I hear you, but honestly I don't really care where documentation lives. Just so long as I can find it and read it. But with rust in particular, if you want local documentation you can run cargo doc to generate & open the documentation of your project and all your dependencies, which is nice.

And re: versions, rust docs hosted online also have a little 'version' field up the top showing which version of the library you're looking at the documentation of. Eg if you open https://docs.rs/rand/ I see "rand-0.9.2". If you change versions, the URL changes. It'd be nice if doxygen had that too.

Re:Rust in Android: move fast and fix things by josephg on Thursday November 13, 2025 @10:03PM (#45923384)
> That is a surprising opinion. Rust marketing is entirely based - like in this submission - on comparing its memory safety to C/C++ and saying that C is bad!

I'm not really sure what you expect here. Like, a large driving factor of using rust (compared to C/C++) is that it has better memory safety. Should rust not talk about that? Should we try and be careful about the feelings of C/C++ devs and not name the truth in the room around memory safety?

The reason android is moving to rust is because it decreases the memory related defect rate compared to C++. Should we shy away from talking about C++ memory bugs because they're somehow embarrassing?

When C came out, I'm sure a lot was written about how much easier it was to program in compared to assembly. Does that mean there's a feud between C and assembly? I'm sure some assembly developers felt under attack. But its not a feud. Just two tools with different use cases. That's how I see C and rust.

Re:Rust in Android: move fast and fix things by tick_tock_tick on Thursday November 13, 2025 @03:42PM (#45920265)
I mean we know for sure Rust is unsafe there is whole bug tracker dedicated to all the ways it's unsafe. My favorite is that you can cast any lifetime to static no matter how short it actually is in 100% safe Rust.

(doesn't mean it's not an improvement on C++)

Re:Rust in Android: move fast and fix things by j-krieger on Thursday November 13, 2025 @04:13PM (#45920630)
This doesn't 'cast' anything. The compiler prevents this because it would allow references that outlive their owners. Freely 'casting' only works for data that is static in nature anyways, at which point a coercion is taking place. Any other way involves `std::mem::transmute` or `Box::leak` and the like.
Re:Rust in Android: move fast and fix things by tick_tock_tick on Thursday November 13, 2025 @04:21PM (#45920711)
Here is a nice segfault in perfectly legal safe Rust https://play.rust-lang.org/?version=stable&mode=debug&editio...

I'd call it casting thought technically maybe it's not you might want to call it something else? You don't need transmute or leak. The issue is only 10 years old now https://github.com/rust-lang/rust/issues/25860

Re:Rust in Android: move fast and fix things by dwattttt on Thursday November 13, 2025 @04:34PM (#45920891)
Yes, that's an existing soundness hole in the compiler. You won't accidentally code it up yourself though.

If the bar is "deliberately malicious code results in a segfault", get back to me when they fix

  memcpy(0x10000, 0x20000, 0x10);
EDIT: and even that's being charitable; the Rust issue is viewed as a compiler bug which should be fixed.
Re:Rust in Android: move fast and fix things by ViewTrick1002 on Thursday November 13, 2025 @03:51PM (#45920365)
The unsound bug tracker is were my heart gets all warm and fuzzy in Rust land.

All the ways to coerce and poke the implementation of what should be safe constructs to produce unexpected garbage - and people spending time fixing the issues!

It’s like the best possible advertisement for ”we enable soundness and correctness for all your programs.”

https://github.com/rust-lang/rust/issues?q=state%3Aopen%20la...

Re:Rust in Android: move fast and fix things by krukah on Thursday November 13, 2025 @05:53PM (#45921777)
I think referencing the well-known cases in cve-rs[1] is quite a bad faith effort. Of course if you try reeeally hard to write unsound code, you can write unsound code. An edge case in the type system downstream of lifetime variance rules is simply not something that matters in any practical attempt to write safe software. I find the tracker interesting since it probes the boundary of the compiler, but it says absolute nothing to the effect of "Rust is unsafe".

[1] https://github.com/Speykious/cve-rs

Re:Rust in Android: move fast and fix things by ActorNightly on Thursday November 13, 2025 @05:01PM (#45921205)
Id like to see dev time in Rust vs C++, but generally, I sort of agree. If you use modern C++ with all its features, Rust is generally a better alternative.

That being said, it would be pretty easy to implement some pointer semantics even in C that can do 95% of what Rust does.

Re:Rust in Android: move fast and fix things by kibwen on Thursday November 13, 2025 @06:50PM (#45922239)
> That being said, it would be pretty easy to implement some pointer semantics even in C that can do 95% of what Rust does.

Making a language with memory-safe pointers isn't hard. Making a language with memory-safe pointers that doesn't rely on sandboxing, a virtual machine, or other dynamic checks which produce runtime overhead--thereby disqualifying one from being considered for this domain in the first place--is nontrivial.

Re:Rust in Android: move fast and fix things by ActorNightly on Friday November 14, 2025 @02:18PM (#45930846)
Rust has things that have dynamic runtime check overhead that are often used. Reference counters, array size, e.t.c You have to have runtime checks because of Rice's theorem.

The only way around this would be to have a absolutely strict type system that defines the finite sets of data that memory can hold.

But for compile time checks, its not hard. For example, the I would do it C is that every pointer gets an optional permission id through some syntax when created. Any expression involving modifying that pointer needs to have the appropriate permission id stated, any dereference operation needs to have the appropriate permission stated, and free is only limited to the function where the pointer was created with malloc. Then any pointer created in assignment from an expression involving that pointer inherits the permission id.

So you simply have a system of tracing where memory gets used.

But all of this is overkill tbh, when you can just use existing static memory analyzers that pretty much do the same thing. And coupled with dynamic memory analyzers like valgrind with appropriate testing, you don't even need to do runtime checks within your code.

Re:Rust in Android: move fast and fix things by josephg on Sunday November 16, 2025 @07:04PM (#45949695)
So your claim is that sufficiently careful C is just as safe as rust?

Seems like a pretty wild claim to make in the comment thread of this article. Google has some of the most careful engineers in the business. They use valgrind & ubsan & friends religiously. And yet this is their conclusion:

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

C is not as memory safe as rust. And it cannot be made as safe as rust with a few bolted on tools and programming tricks.

Re:Rust in Android: move fast and fix things by paulf38 on Monday November 17, 2025 @01:24AM (#45951257)
I agree that C is a basket case when it comes to safety and security.

The CPU and the hardware don’t care how confident C coders are in their ability.

C developers tend to forget the reason why Windows and UNIX like systems are now quite robust is that there has been over 50 years of turd polishing. Unfortunately for rust it is not immune to bugs other than memory safety issues. I think that it is a good idea to write new code in rust. Less so for battle hardened old code.

C++ is somewhere between C and rust. With modern ‘good practices’ (no raw pointers, no for loops) it can be an order of magnitude or two safer than C.

Re:Rust in Android: move fast and fix things by super_flanker on Friday November 14, 2025 @03:46PM (#45931983)
And tell me how that pointer semantics would do * a very strict type checking * Pattern matching * Algeberic data type

Plenty of people don't write Rust for additional memory safety, they write Rust because the features provided by it is overall very balanced & encourages developer to write code which handles almost all edge cases.

Re:Rust in Android: move fast and fix things by jandrewrogers on Thursday November 13, 2025 @08:54PM (#45922971)
It really depends on the type of software.
Re:Rust in Android: move fast and fix things by pjmlp on Friday November 14, 2025 @05:01AM (#45925476)
Nope, Rust compiler depends on LLVM and GCC (ongoing), both written in C++.

Then there are enough industry standards that are defined for C and C++, where Rust isn't even visible.