News for hackers. Stuff that matters.
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