4 ms·
Does Rust have a special interest group that's working with the kernel engineers to figure out how best to go about this integration, or is it only kernel devs
by sph 4y ago
Does Rust have a special interest group that's working with the kernel engineers to figure out how best to go about this integration, or is it only kernel devs that are working on this?
I'd like to read more about what the Rust people are working on to help this effort, and if there's any particular nightly feature the kernel requires that will soon reach stable for everybody's benefit.
- tialaramex 4y agoRust for Linux tracks the list of "Required" / "Good to have" features from Rust itself. The set of things from that first category which aren't in Stable Rust has been shrinking but isn't zero. https://github.com/Rust-for-Linux/linux/issues/2 https://github.com/Rust-for-Linux/linux/issues/2 I don't believe there is a "Special interest group" but since the only comparable team to Rust for Linux would be a hypothetical "NT kernel with Rust" group, to some extent it's hard to argue with what they say they need when they come to Rust teams, e.g. library. Of course just because Rust for Linux wants X doesn't magically mean X is the top priority for the people working in that area, or even in some cases that Rust is going to ever do X. Sometimes the answer will be, as it has been for alloc, well, too bad then, make your own. Linus really doesn't like implicit allocation, this is one thing he didn't like about C++. But Rust's own alloc has lots of implicit allocation. For example its String can be appended to, even using an operator like in Java or C++ which means the heap allocation just grows. But what if there's no more RAM? So, in Rust for Linux such features don't exist. In both your desktop Rust and Rust for Linux, we can have a variable of type String, like &str it's UTF-8 encoded text, but unlike &str we can have mutable Strings. In desktop Rust you can just write my_string += " and then we ate a whole cake,"; and Rust will grow the String if necessary to fit on this extra text. But that's an implied allocation, so in Rust for Linux, this won't compile, the Rust for Linux String type doesn't have that += operator.
- dbrgn 4y agoWhoa, after about 7 years of writing Rust, I only now learned that Rust's strings can be extended with `+=`. In any case, a Rust string is inherently a growable data structure. It has a capacity and a size. If the size exceeds the capacity, it is reallocated. Does Rust for Linux have "mystring.push_str(" and then we ate a whole cake,")"? If yes, why is "+=" implicit and "push_str" is not?
- tialaramex 4y agoRust's standard library String implements AddAssign, the effect of which is that the += operator exists, in effect a += b is sugar for AddAssign::add_assign(&mut a, b) Personally I would rather it didn't, but the use of + as a concatenate operator is widespread and I imagine if String didn't do this a popular BetterString would. No, the Rust for Linux String doesn't have push_str(), see for yourself: https://rust-for-linux.github.io/docs/alloc/string/struct.String.html https://rust-for-linux.github.io/docs/alloc/string/struct.St... that String also has no way to do infallible reserve(), and doesn't implement Write among other differences.