The topic of the Rust experiment was just discussed at the annual Maintainers Summit. The consensus among the assembled developers is that Rust in the kernel is no longer experimental — it is now a core part of the kernel and is here to stay. So the “experimental” tag will be coming off. Congratulations are in order for all of the Rust for Linux team.
This title really bait me.
Yeah, thought that was going the other way for a second.
ditto and it made me sad; i was afraid that the maintainers had become too ossified to embrace change.
Ambiguous title is ambiguous ಠ_ಠ
Yeah ambiguity is for C code /s
Yep. Came here ready to rant
My heart stopped. Sheesh.
Phoronix commentors will be furious.
You scared me for a second
This means that drivers written in Rust will have just a good a chance to be accepted as drivers written in C?
I guess that still depends on the maintainer which is responsible. But since drivers often deal with untrusted data, which can lead to security exploits, this makes a lot of sense.
If i remeber correctly, the current approach is each device/vendor family is free to choose how they want to move. for example, gpu folks are actually interested to do rust stuff (for example novo, tyr by redhat,collabora). there may be some families who do not want to move fast.
I would have guessed that mixing different programming languages would cause problems. But apparently it’s working well.
It’s been 20 years since I did any serious programming, so I’m a bit rusty, is that what Rust is for?Lots of “modern” languages don’t interop terribly well with other languages, because they need a runtime environment to be executed.
So, if you want to call a Python function from Java, you need to start a Python runtime and somehow pass the arguments and the result back and forth (e.g. via CLI or network communication).C, C++, Rust and a few other languages don’t need a runtime environment, because they get compiled down to machine code directly.
As such, you can call functions written in them directly, from virtually any programming language. You just need to agree how the data is laid out in memory. Well, and the general agreement for that memory layout is the C ABI. Basically, C has stayed the same for long enough that everyone just uses its native memory layout for interoperability.And yeah, the Rust designers weren’t dumb, so they made sure that Rust can also use this C ABI pretty seamlessly. As such, you can call Rust-functions from C and C-functions from Rust, with just a bit of boilerplate in between.
This has also been battle-tested quite well already, as Mozilla used this to rewrite larger chunks of Firefox, where you have C++ using its C capabilities to talk to Rust and vice versa.No, Rust is to make you feel like you haven’t programmed seriously in 20 years when you first pick it up, even though you are actively doing it.
Before the angry rust “mob” comes to get me: this is a joke. I tried Rust out of genuine curiosity, cobbled together a silly little thing, and quite liked it. The borrow checker made me feel like a total beginner again, in some aspects, and it was great to get that feeling again.
Ultimately it does not fit my needs, but there are a few features I am pretty envious of. I can totally see why it’s getting such a following, and I hope it keeps growing.
Thanks, I might take a look at it just for fun. 😀
Enjoy! I don’t know what you used to seriously program on but I am willing to be that the ownership paradigm that it enforces is going to feel at least moderately new to you, unless you forced yourself to code that way anyways.
Plus, as long as you’re doing silly little home projects, the compiler errors are the absolute best I’ve ever seen. Literally just learn basic syntax, try it out, and when it does not compile, the compiler not only tells you why but also what it thinks you’re trying to do and how to fix.
Absolute gem of a learning tool.
Enjoy! I don’t know what you used to seriously program on but I am willing to bet that the ownership paradigm that it enforces is going to feel at least moderately new to you, unless you forced yourself to code that way anyways.
Thinking about ownership is the right way e.g. for C++ as well, so if one has coded professionally in larger systems, it should not be too alien.
One still needs to learn life time annotations. So, assuming that you know, for example, C++, it is an a bit larger hurdle than picking up Java or Go, but it is worth the time.
In many aspects, Rust is far more productive and also more beginner-friendly than C++:
- far better compiler error messages
- a superb and easy-to-use packaging system
- Unicode support
- support for unit testing right in the language
- strong support for a side-effect-free or “functional programming” style which is great for testing and tasks like data analysis or parsing
- better modularization
- avoids implementation inheritance, and the trait system is a bit different but superb
- no undefined behavior (in safe Rust) which means nothing less than that the code does what it says - and this is extremely useful in larger projects
- great support for safe concurrency
- the language and library frees one to think about interfaces and algorithms which is where the big wins for performance are hidden (and IMO one of the key factors for the astounding success of Python).
I could go on… but I need to do other stuff
Thanks for the detailed answer. Preaching to the choir.
The existence of the concept of ownership in languages like C++ is why I threw “moderately” in there. I agree depending on what you take that to mean, it may or may not do some heavy lifting.
For the rest, I’d divide it into hard facts (compiler messages are absolutely undeniable, in any circumstance) and things that can definitely be true depending on your personal use cases. I’m with you on this: for the vast vast majority of tasks commonly understood as software engineering, memory safety is a concern, and a lot, if not all, of your points, are valid.
I must humbly insist that it does not fit my needs, in the sense that memory safety is of no concern to me, and that the restrictions that a compiler-enforced approach imposes make me less productive, and, subjectively, also less enjoyable because causing more friction.
That being said, you may also not consider what I’m currently doing to be software engineering, and that’s totally fine. Then we’d agree entirely.
EDIT: also, there are very few languages less productive and beginner-friendly than C++ in my opinion. The proverbial bar is in hell. But you are talking to an unreasonable C++ hater.
EDIT: also, there are very few languages less productive and beginner-friendly than C++ in my opinion.
I am a professional C++ developer with 20 years of experience and have worked in about eight other languages professionally, while learning and using a dozen more in hobby projects.
I agree with you here. The only areas where specifics are worse are package management in Python, and maintainability of large SIMULINK models.
That’s the sort of indictment of C++ I like to hear. It’s not just me then. I sometimes feel like I’m taking crazy pills with some colleagues who are super enthusiastic about it still.
But again, I’m stupid, I know I’m stupid, and C++ has way too many features and convoluted behaviours which are hard for me to remember and reason about. It often feels like it makes me think more about the language problems than the actual problem I’m supposed to work on. It may say more about me than the language, but I do feel validated with comments like this.
What’s wrong with implementation inheritance? Don’t you want that?
Generally no. As soon as a class hierarchy becomes moderately complex, implementation inheritance makes code very hard to maintain, because you need to read the whole stack of classes to see what a single change will actually do.
Rust has another system, traits and trait implementations.
The consensus seems to be that implementation inheritance leads to code that is difficult to understand and difficult to reuse. Its perhaps the main reason C++ is banned from the kernel.
I am willing to bet that the ownership paradigm that it enforces is going to feel at least moderately new to you
Absolutely, I am more used to program closer to the iron mostly C. My favorite was 68000 Assembly, python is nice, but I prefer compiled languages for efficiency. Although that efficiency isn’t relevant for basic tasks anymore.
The compiler error messages sound extremely cool. 👍
Ah, a fellow C coder. Never did do assembly with chips older than x86_64 basically. The only old school stuff I touched was writing an interpreter for the CHIP-8. I tried writing some CHIP-8 too, but coming from more recent paradigms, it seemed quite unwieldy to me.
I like python for quick and dirty stuff, I don’t like python for being interpreted and it being not obvious what happens under the hood, memory wise, at a glance.
Seeing as you do C I’ll say this. The one thing I really did not enjoy, subjectively, with Rust, is that writing “C-style loops” comes with a performance penalty because there are bound checks happening, so the idiomatic version of a loop in Rust usually involves iterators and function composition.
I am stupid. C-loops are easy for me to understand. More sophisticated stuff is hard for my little brain. I’d rather be trusted with my memory access, and be reminded of my stupidity when comes the inevitable segfault. Keeps you humble.
I like Python for quick and dirty stuff
There is one more little secret that not everyone knows:
You do not need lifetime annotations and full borrow checking if you do not care to press out the last drop of performance out of the CPU, or if you just draft experimental code.
In fact, you can very much program in a style that is similar to python:
- just pass function arguments as references, or make a copy (if you need to modify them)
- just return copies of values you want to return.
This makes your code less efficient, yes. But, it avoids to deal with the borrow checker before you really need it, because the copied values get an own life time. It will still be much faster than Python.
This approach would not work for heavily concurrent, multi-threaded code. But not everyone needs Rust for that. There are other quality-of-life factors which make Rust interesting to use.
… and of course it can’t beat Python for ease of use. But it is in a good place between Python and C++. A bit more difficult than Java, yes. But when you need to call into such code from Python, it is far easier than Java.
The one thing I really did not enjoy, subjectively, with Rust, is that writing “C-style loops” comes with a performance penalty because there are bound checks happening, so the idiomatic version of a loop in Rust usually involves iterators and function composition.
IIRC you can speed up such checks by putting an assertion in front that checks for the largest index - this will make repeated checks for smaller indices unnecessary. Also, bound checks are often not even visible on modern CPUs because speculative execution, branch prediction, and out-of-order execution. The CPU just assumes that the checks will succeed, and works on the next step.
I had no idea about the assertion! Thanks.
Yes, this is plain wrong or often unimportant on modern architecture, you’re right. I, certainly mistakenly, thought this was one of the reasons for the idiomatic version involving function composition, which is the thing I, subjectively, don’t enjoy as much.
I stand corrected.
it being not obvious what happens under the hood
To me it feels like it does things I didn’t ask it to. So I’m not 100% in control 😋
the idiomatic version of a loop in Rust usually involves iterators and function composition.
What? You need to make a function to make a loop? That can’t be right???
C-loops are easy for me to understand.
Absolutely, the way C loops work is perfect. I’m not so fond of the syntax, but at least it’s logical in how it works.
If you don’t like the functional syntax you can usually use for each loops to the same effect.
for element in array.iter() { println!("{element}"); }What? You need to make a function to make a loop? That can’t be right???
Ah no, there is a misunderstanding. You can write C-loops, of course, they just could involve more work under the hood because in order to enforce memory safety, there needs to be some form of bounds checking that does not happen in C. Caveat: I don’t know whether that’s always true, and what the subtleties are. Maybe I’m wrong about that even, but what is true is that what I am about to say, you will encounter in Rust codebases.
By function composition I meant in the mathematical sense. So, this example explains the gist of it. You may need to throw in a lambda function in there to actually do the job, yeah. I don’t know what the compiler actually reduces that to though.
It’s just the more functional approach that you can also see with Haskell for example. I find it harder to parse, but that may be lack of training rather than intrinsic difficult.
EDIT: pasted the wrong link to something totally irrelevant, fixed now
What have you been doing since you stopped programming?
Alternatively, why did you stop (seriously) programming?
It was never a major part of my job description, and I lost interest doing small hobby projects.
Understandable
Oh well, time to switch to TempleOS.
Or get a catgirl ears. And safer memory.
My memory is safe. Nobody ever knows what I’m going to forget…
Then catgirl ears are enough 😉
Pff you know how many layers of abstraction HolyC still has? Real computing enthusiasts write their OS in machine code. Not assembly, that’s an abstraction too, literally tapping out high and low electrical pulses like you’re in the Marconi room on the Titanic.
Isn’t one of the main concerns the licensing of Rust?
No. The Rust code in the kernel is GPLv2 just like the rest of the kernel. The licence of the compiler has nothing to do with that, that’s nonsense Rust haters make up.
You can argue against independent projects like the Rust coreutils not using a copyleft license, but that has nothing to do with Rust or the kernel. There are independent C projects without non-copyleft licenses too.
Ah thank you. You likely guessed the reason for the question.
Many popular projects written in Rust, including the UUtils core utils rewrite, are MIT licensed as Rust is. There have been people that purposely confuse things by saying that “the Rust community” is undermining the GPL. I can see how that may lead somebody to believe that there is some kind of inherent licence problem with code written in Rust.
Code written in Rust can of course be licensed however you want from AGPL to fully proprietary.
I personally perceive a shift in license popularity towards more permissive licenses at least with the “younger generation”. The fact that so many Rust projects are permissively licensed is just a consequence of those kinds of licenses being more popular with the kinds of “modern” programmers that would choose Rust as a language to begin with. Those programmers would choose the same licenses even they used the GCC toolchain. But the “modern” languages they have to choose from are things like Rust, Swift, Zig, Go, or Gleam (all permissively licensed ). Python and TypeScript are also still trendy (also permissively licensed).
Looking at that list, it is pretty silly to focus on Rust’s license. Most of the popular programming languages released over the past 20 years are permissively licensed.
Many popular projects written in Rust, including the UUtils core utils rewrite, are MIT licensed as Rust is. There have been people that purposely confuse things by saying that “the Rust community” is undermining the GPL.
How would that ever be a problem in any case? I mean I’m not that versed in licensing stuff, but MIT explicitly allows sublicensing, so if in doubt just slap a GPL-sticker on the MIT code and you are good, no?
I have never heard the licensing of Rust being raised as a concern for the Linux kernel.
As Charles Babbage would say, “I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.”
The distro I use builds the entire Linux kernel with Clang which uses the same license as Rust. Linux is bound by the same modified GPL license regardless of what compiler I use to build it.
The compiler has no impact on the license applied to the code you build with that compiler. You can use closed source tools to build open source software and vice versa.
And, of course, the Rust license is totally open source as it is offered as both MIT and Apache. Apache 2.0 even provides patent guarantees which can matter for something like a compiler.
If you prefer to use GPL tools yourself, you may want to keep an eye on gccrs.
A legitimate concern about Rust may be that LLVM (Rust) supports a different list of hardware than GCC does. The gccrs project addresses that.
Huh, its a programing language. People can write the code and use whatever license they want.
Rust is mit/apache licensed? What concerns are there?
rust the language is, but projects using it can be any other license, like GPL 2 or 3 or whatever cursed one that sudo has
Yes, I know.






