Gentoo Archives: gentoo-dev

From: Dirkjan Ochtman <djc@g.o>
To: Gentoo Development <gentoo-dev@l.g.o>
Cc: cardoe@g.o, Luca Barbato <lu_zero@g.o>, alicef@g.o
Subject: Re: [gentoo-dev] Add rust eclass to support multi-target compilation
Date: Tue, 31 Jul 2018 07:35:55
Message-Id: CAKmKYaADVxvxNFR_W5wpuP2yDZo8QJ8PPJmY9h5qcCTgyQySsA@mail.gmail.com
In Reply to: [gentoo-dev] Add rust eclass to support multi-target compilation by gibix
1 On Mon, Jul 30, 2018 at 5:02 PM gibix <gibix@××××××.net> wrote:
2
3 > This will allows projects like rustfmt, clippy, bindgen that need runtime
4 > linking with the proper rust version to work correctly. Beyond this while
5 > rust is getting older as project we will see more projects that will
6 > require a specific rust version for compilation.
7 >
8
9 As I mentioned in the PR already, I'm not a fan of this change. (Context: I
10 have been writing Rust code for 2 years, I'm on the Rust team, and I've
11 done most of the maintenance on the dev-lang/rust ebuilds for the past year
12 or so.)
13
14 As far as I know, the Rust ecosystem is largely bimodal: stuff is either
15 compatible with stable and later, or it works only on nightly. It seems
16 very rare that code is actually tied to a particular Rust release and does
17 not compile against latest Rust stable. (Upstream actually promises they
18 won't break code except in case they need to fix a soundness issue in the
19 compiler.) So instead of building this whole target infrastructure (which
20 is definitely needed for something like Python or Ruby), we should be able
21 to just work with stable and nightly slots, and ebuilds can depend on those.
22
23 Upstream is also very clearly packaging their core tooling as a single
24 package made up of a number of components, and these are distributed and
25 compiled together in common usage on other platforms (with the rustup
26 tooling). That also means they are tightly coupled -- for example, rustfmt
27 can change formats over time, and CI that checks formatting will need to
28 align with whatever the current stable Rust version of rustfmt is.
29 Installing the latest (nightly or beta) version of rustfmt while you have a
30 stable Rust toolchain installed is thus not a good idea. As another
31 example, cargo is now tagged as 0.28, but when passing --version it will
32 report as 1.27.0 -- actually the Rust toolchain version.
33
34 For these reasons, I think it would be better to align our Rust ebuilds
35 with upstream and work with single ebuilds (dev-lang/rust and
36 dev-lang/rust-bin) that install all the tools belonging to a particular
37 version of the Rust toolchain. What tools are installed can be customized
38 with USE flags, and the default install can be minimal (just rustc and
39 cargo, which you need to build packages anyway).
40
41 Regards,
42
43 Dirkjan

Replies