4 ms·
Yep, this is a great article, but that section (the whole "Rust Isn’t Finished" section) jumped out as a place where there were some simple ways he could have m
by ntoskrnl 4y ago
Yep, this is a great article, but that section (the whole "Rust Isn’t Finished" section) jumped out as a place where there were some simple ways he could have made his life easier. It could also have been a failure of the Rust community to teach a good workflow.
You don't need to force every contributor to upgrade every six weeks in lockstep, since releases of Rust and std are backwards compatible. Upgrade at your leisure, and run tests in CI with the minimum version you want to support. If you're doing something crazier that requires ABI compatibility between separate builds (or you just want consistency), you can add a `rust-toolchain` file that upgrades the compiler on dev machines automatically, as seamlessly as Cargo downloads new dependency versions.
- burntsushi 4y agoTo clarify a bit, the key thing here is that the OP is maintaining their own patches to Rust's standard library. While the API of std is itself backwards compatible, its implementation uses a whole mess of unstable nightly features. That means that std for Rust 1.x can't necessarily be built with Rust 1.(x-1). EDIT: Nor can std for Rust 1.(x-1) be necessarily built by Rust 1.x. It's true that you don't have to force every contributor to upgrade every six weeks, but you do very likely need to have every contributor use the same version of Rust. (Which can be accomplished with a rust-toolchain file, as you mention.) The problem here is that if you don't do this upgrade whenever a new Rust release is made, you're just putting off that work to some other point. Maybe you do it every 12 weeks instead of 6 weeks, that would probably be okay. But I'd imagine waiting a year, for example, could be unpleasant.
- xobs 4y agoThis is correct. When you tell someone to install Rust, they go to rustup.rs and install the latest version. Therefore, we need to have a libstd port for the latest version. Which effectively means we need to release libstd as soon as possible after the compiler is released. Our `sys` directory is at https://github.com/betrusted-io/rust/tree/1.61.0-xous/library/std/src/sys/xous https://github.com/betrusted-io/rust/tree/1.61.0-xous/librar... and isn't too complicated. It's about 50 patches that need to be carried forward every six weeks. Fortunately libstd doesn't change too much, at leaset not the parts we need. And I can usually pre-port the patches by applying them to `beta`, which means the patches against the release version usually apply cleanly. It's still better than requiring nightly, which has absolutely no stability guarantees. By targeting stable, we don't run into issues of bitrot where we accidentally rely on features that have been removed. Rather than adjusting every service in the operating system, we just need to port one library: libstd I've considered trying to upstream these, but I'm not sure how the rust team would feel about it.
- ntoskrnl 4y ago> OP is maintaining their own patches to Rust's standard library Oops, that's the bit I must have missed. That does sound like an ordeal and I don't have an easy answer.
- albrewer 4y agoThis is one thing I struggle with when learning Rust. I want to have some examples of purely idiomatic Rust code solving some bog-standard problems, that way I can copy what that project's doing while I get comfortable enough with the language and learn to make my own decisions.