this post was submitted on 11 Mar 2025
162 points (100.0% liked)

Linux

6615 readers
432 users here now

A community for everything relating to the GNU/Linux operating system

Also check out:

Original icon base courtesy of [email protected] and The GIMP

founded 2 years ago
MODERATORS
top 25 comments
sorted by: hot top controversial new old
[–] [email protected] 32 points 1 week ago (2 children)

Yesterday, we had a presentation at $DAYJOB, where we showed off our software project at a high level to another department. That department does lots of low-level work, including with C.

A team lead from that department, who knows our project, had provided the initial draft for the presentation slides. And they threw a sentence at the end of the slides "By the way: $PROJECT powered by Rust". We were also not the only project there, which explicitly mentioned Rust, even though it wasn't strictly relevant.

And yeah, that's just kind of insane to me. When even management understands that their techies get excited about working with Rust, that's not anymore just a few select voices that call for it. That's a whole department discontent with C, where an alternative is presented.

Which is why I would be extremely surprised, if not something similar happened with the Linux kernel.
Obviously, those who've coded C for twenty years might not understand the issue, but there's so many people for which low-level development becomes accessible for the first time with Rust. The stream of people wanting to contribute Rust code will just not cut off any time soon.

[–] [email protected] 17 points 1 week ago (1 children)

those who’ve coded C for twenty years might not understand the issue

or the opposite because they have that experience

[–] [email protected] 4 points 1 week ago

Yeah that's definitely true, but also the people who have been doing it for 20 years have a huge amount of knowledge and experience invested in dealing with memory unsafety. Lots of people don't want that investment to be "wasted", so they try to maintain the status quo, even if it is worse for them.

[–] [email protected] 3 points 1 week ago (4 children)

Rust doesn't help with accessibility its just as easy if not easyer to write c. Its just that when u write bad c u have real serious issues.

[–] [email protected] 10 points 1 week ago* (last edited 1 week ago) (2 children)

that's odd most people praise rust for being incredibly easy to install and build any project with rustup and cargo

you can do remarkably sophisticated things using a few crates, simple data structures and types and at C speeds or faster

i think you're wrong

[–] [email protected] 7 points 1 week ago

Rust allows you to create more powerful abstractions, which can allow you to express your intent in a clearer way. C code can feel like you're bogged down by details all the time. C is on the other hand a smaller language, so just getting to the point where you "know" the language is a lot easier.

[–] [email protected] 4 points 1 week ago (1 children)

I'm not talking about building I'm talking about programming. I defiantly agree rust has some very nice tooling but the language itself has quite a steep learning curve that isn't kind to newcomers.

[–] [email protected] 9 points 1 week ago

both C and Rust have learning curves that get steep after the initial trivial stuff

with C as soon as you're in array/string/pointer land, you're in a world of seg faults

you can get so much more done as a beginner in Rust before you get anywhere near dealing with ownership or creating advanced generics

[–] [email protected] 8 points 1 week ago (1 children)

Have you used both languages before?

[–] [email protected] 4 points 1 week ago (2 children)

Yeah. I prefer rust but I defiantly had a far easier time learning c and apply my existing programming knowledge. Getting my head around the borrow checker was one hell of a pain in the ass.

[–] [email protected] 12 points 1 week ago

The thing is that "learning C" means "I can write C code that compiles and might be full of bugs", whereas "learning Rust" means "I can write Rust code that compiles and has a small number of bugs". It's not apples-to-apples.

It's like saying "I found it easier to learn primary school maths than I did to learn a physics degree".

[–] [email protected] 7 points 1 week ago

I defiantly had a far easier time learning c and apply my existing programming knowledge. Getting my head around the borrow checker was one hell of a pain in the ass.

What specifically was difficult to understand about the borrow checker? Much of what the borrow checker requires you to do are things that you still need to do in C just without compiler support.

[–] [email protected] 8 points 1 week ago

Rust doesn't help with accessibility

when u write bad c u have real serious issues

I hope you recognize the irony.

[–] [email protected] 3 points 1 week ago

Well, I did mean accessible in terms of feeling semi-confident to contribute to a project with users. If you end up writing code that takes longer to review than it would've taken the reviewer to write it themselves, that's always kind of unfortunate...

[–] [email protected] 23 points 1 week ago (3 children)

I could actually see myself contributing to Rust kernel code. C code has always been impossible for me to understand, but the Rust part seems to have a more understandable structure

[–] [email protected] 17 points 1 week ago

Rust code (and the ecosystem) seems to put a higher priority on describing code contracts through the type system and documentation. I personally feel you don't need as much context to write functional code compared to C where every corner of the codebase might be hiding something that could impact the part your working on.

[–] [email protected] 9 points 1 week ago* (last edited 1 week ago)

This exactly. I always wanted to contribute to the kernel but after being a c++ dev for so many years I absolutely don't want to do C, and rust would allow me to have fun doing kernel hacking

[–] [email protected] 8 points 1 week ago

I think this is the most important aspect of Linux accepting more rust contributions. More and more existing maintainers are aging out, and people just don't learn or want to build large applications in C anymore. From what I understand companies doing proprietary kernel development have largely made the rust transition for new code at this point, so fewer and fewer systems level programmers will be used to C (and C++ over time) for these tasks. Existing maintainers pressure against rust development could become a threat to the long term viability of the kernel.

[–] [email protected] 12 points 1 week ago (1 children)

[memory safety] is a more or less solved research problem

I don't know if I would go that far. There are some interesting alternative approaches to Rust's borrow checker that might turn out to be better. There's definitely more research that can be done.

But we do have at least one solution that works very well.

[–] [email protected] 3 points 1 week ago (1 children)

The nice thing is if a much better solution exists then a rust compiler that uses it can be implemented using it. Then you don't have to rewrite all the rust code.

[–] [email protected] 5 points 1 week ago (2 children)

No, the alternative solutions definitely wouldn't work with existing Rust code. You need a new language.

[–] [email protected] 5 points 1 week ago
[–] [email protected] 1 points 1 week ago (1 children)

If you don't code with undefined behavior compiler updates can apply to legacy code. I've been through enough compiler upgrades with microcontrollers that it's old hat.

[–] [email protected] 1 points 1 week ago

I'm talking about things like Perceus. It's not a compiler update.

[–] [email protected] 3 points 1 week ago

Some people wont be pleased.