26 ms·
Rust has language versions and you can specify the language version to use in your Cargo.toml file. This is possible today and it shouldn't pose a problem for t
by jeroenhd 4y ago
Rust has language versions and you can specify the language version to use in your Cargo.toml file. This is possible today and it shouldn't pose a problem for the kernel at all as long as there are rules about what versions to support.
You don't need a super modern version of the spec to use Rust.
As for Rust's incompatibilities, as long as you stay clear from methods marked unstable and the nightly compiler versions you'll be fine. Rust's libraries have breaking changes, but the stable language features haven't had any since the 1.0 release as far as I'm aware.
If your problem is forwards compatibility, well, you can't use clang10 to compile the kernel either. Sometimes the version gets bumped, but it doesn't need to happen too often. I think GCC's rust compiler will keep up just fine.
- vips7L 4y agoHalf of the ecosystem depends on the nightly compiler.
- wongarsu 4y agoThat used to be true a couple years ago, but I don't think I've used a nightly compiler version at any point in the last 12 months. That said, I think for this first phase the kernel is planning on a specific stable version of the compiler with nightly features enabled, because they have a couple specific needs that haven't made it through the stabilization process yet.
- smolder 4y agoI dont't think "half" is accurate, at least not anymore. A lot of things have moved from Nightly to Stable compatibility with stabilization of async, for example. Rocket builds on stable now, while for a long time it didn't. I'd like to see the actual percentage but AFAIK it would take some analysis. Crates.io shows 86417 total crates, searching for "stable" shows 3346 and "nightly" shows 2527... So that's not a good heuristic, probably.
- rdsubhas 4y agoParent is saying the proportion is very high. It's not the exact number that matters. Even if one dependency your project uses needs nightly, then your entire project has to use nightly.
- nindalf 4y agoLess than 20% of devs use nightly. About a third of the devs who use nightly do it because of a dependency. 6-7% of Rust devs is a far cry from the “half” claimed by GP. https://github.com/rust-lang/surveys/raw/main/surveys/2021-annual-survey/2021-annual-survey-summary.pdf https://github.com/rust-lang/surveys/raw/main/surveys/2021-a...
- arinlen 4y ago> Less than 20% of devs use nightly. You tried to make that sound like few Rust developers use nightly, but the same survey you linked to states that, while 7449 said they use the latest stable version for local development, 3333 said they use nightly, with 2853of them using the latest nightly and 481 using a specific version of nightly. All in all, the ratio of Rust developers targeting nightly releases or betas represents something in between a third and a quarter of the whole developer community. That's a lot of people in the Rust community delivering code targeting unstable and unmaintainable releases.
- nindalf 4y ago> unmaintainable releases How did you come to this conclusion? Seems like it must be working for them, because most of them are using nightly out of choice. Plus it’s a service to the community. Their everyday testing helps make the stable releases better. Imagine if no one used nightly - that would be much worse.
- woodruffw 4y agoThis is true, but you'd have to show that those nightly dependencies are relatively central to the Rust dependency graph (i.e., that lots of other things depend on them). To the best of my knowledge, that's not really the case (the really central dependencies in the Rust ecosystem are things like serde, libc, anyhow, etc. that all use the stable compiler). In my experience writing Rust professionally (including making heavy use of dependencies), I've only needed the nightly compiler once. And that was for our own code, not an external dependency.
- TotempaaltJ 4y agoI've not experienced this. I know it used to be very significant, but on my latest (and biggest) project that I've been working on for ~a year, I haven't run into any nightly-only packages that I couldn't easily do without.
- eternauta3k 4y agoWould the kernel pull in any dependencies, or just reimplement everything like it currently does?
- bonzini 4y agoIt doesn't use cargo but it does use the core and alloc crates. Some parts such as Mutex are reimplemented for interoperability with C code.
- ungamedplayer 4y agoAlmost none of that ecosystem is relevant to kernel.
- arinlen 4y ago> Almost none of that ecosystem is relevant to kernel. What exactly leads you to believe that? From the Rust 2021 survey, 2420 said they use nightly to access one or more language features they need, 1028 claimed a Crate dependency requires it, and 876 claimed a tool they use requires it. This, from a sample pool where around 3k users out of around 10k claim they use a nightly version.
- nindalf 4y agoBecause the kernel code isn’t pulling dependency code from the internet OR a compiler that changes every day. Kernel code will be checked into the repo, dependencies if any, will be vendored. Nor will much of crates.io be relevant - the kernel will only use no_std with fallible allocations. As for the compiler, it will use a pinned, stable compiler, not nightly. Why are you spreading FUD about nightly + Linux on this thread? At no point has this combination ever been considered.
- ungamedplayer 4y agoAgain. Almost none of these can run in kernel space, those that are required will be duplicated in tree. The survey results are not relevant. The rust code must not use stdlib (the name escapes me) which uses an incompatible memory allocation mechanism. The code used to build will likely need to be checked into the kernel git repo and not downloaded live online, I doubt that the mature development process of the kernel wants the problems that other package managers have. I will fight to ensure that this is not the case in the kernels that I work with, because fetching dependencies is for people who can tolerate other people and networks being faulty. I got shit to do.