-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pin rust version #5680
Pin rust version #5680
Conversation
d227e48
to
5630f07
Compare
5630f07
to
0e56332
Compare
We decided not to do this. The |
I was going to open an issue to request to add a I’ve been unable to compile the AUR package for more than half a year due to some Rust error that I never had the time to investigate, today I decided to dive deeper. It turns out that this was because the package builds with The biggest problem with
This is true, but that is the reality of Rust development nowadays. It is already standard practice to pin specific versions (which although it has downsides, is in my experience way better than not pinning), so if you develop or use any Rust projects, those toolchains are going to be there anyway. In the Git repositories in my homedir, I currently have 15 The converse is also true though, if you use
How so? This is exactly what it is meant for. |
Do you have an example of a version of this app that does not build with a Rust version newer than whatever was the latest Rust release at the time of us releasing that app version? I'm pretty sure that you can always just use latest stable to build basically all Mullvad app versions coming out prior to that Rust release. In other words, you should always be able to solve your build issues by
Sounds like your problems were simply solved by a
Did this actually happen to you, or is this more of a hypothetical scenario? As stated above, this should work fine. Rust is backwards compatible.
Do you have links to things like this? Except some more extreme cases I don't think this happens a lot. Just targeting latest stable is not a controversial way to handle a Rust project.
Do you have links to some prominent projects doing this? I have almost never seen For Linux, we do have pinned containers with a correct Rust version if you want to use that: https://github.com/mullvad/mullvadvpn-app/blob/main/building/linux-container-image.txt. For any given commit, the container image pointed to by that file should build the app just fine.
We are not pinned to a specific version. We just use the latest stable, which is not at all an uncommon thing to do. |
I didn’t run into that problem with $ git checkout 2020.4
HEAD is now at fbf6d44d5 Updating version in package files
# The tag is dated Tue May 12 09:56:23 2020 +0200.
# According to https://releases.rs/docs/1.44.0/, 1.44 was released June 4th,
# so the latest stable at the time was 1.43.1 from May 7th.
# Rustup complains though that the 'cargo' component is not applicable to this release,
# so we go with 1.43.0.
$ cargo +1.43.0 check
(some output omitted)
Finished dev [unoptimized + debuginfo] target(s) in 24.96s
# Now let's try with 1.79, which is stable at the time of writing.
$ cargo +1.43.0 clean
$ cargo +1.79 check
(some output omitted)
Checking tokio-io v0.1.12
Checking rand v0.5.6
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> /home/ruud/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.3.11/src/sockaddr.rs:156:9
|
156 | mem::transmute::<SocketAddrV4, sockaddr_in>(v4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: source type: `SocketAddrV4` (48 bits)
= note: target type: `sockaddr_in` (128 bits)
Compiling ring v0.16.12
Checking tokio-service v0.1.0
Checking rand v0.7.2
For more information about this error, try `rustc --explain E0512`.
error: could not compile `socket2` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish... This version is 4 years old by now, but the Rust version on which it breaks first is 1.64, which was released August 2022, only 2 years after tag was created. (Semi-related, many older versions cannot be built any more because they use Git dependencies and the pinned commits can no longer be obtained.)
Of course, but it’s nice that Rustup automates the process if there is a
All of these pin to stable versions, not nightly. These are cherry-picked of course, there are also prominent projects that don’t pin to a specific version, especially simple applications with fewer dependencies. (E.g. sharkdp/fd, though it does specify an MSRV.) There are also a few popular projects that don’t pin in Now that I’m looking into this, mulvadvpn-app also started doing this for recent releases, so that is very helpful! Future toolchains breaking old code tends to happen only over longer time scales that are rarely a problem when packaging, it’s more of an issue when building historical versions, so this is already a big help. If the toolchain that I tried to use to build 2024.3 had been recent enough to support the
Projects that pin generally also track a recent stable, they just bump the pinned version regularly. This ensures that they can update at a time when it’s convenient for them, rather than having the update forced onto them by Rust’s release cycle. Edit November 2024: The recent timepocalypse (rust-lang/rust#127343) is another example of a breaking change that had very widespread impact and broke many applications that compiled fine 4 months earlier. |
Adds pinning of Rust version to this repository. Still work in progress!
Benefits
rustup update
. Cargo will take care of getting the correct version of Rust for every build commandrust-toolchain.toml
so bumping that is enough.stable
at the time.Cons
stable
, over time developers will sit with many toolchains installed on their systems that they manually need to clean out to free disk space.rust-toolchain.toml
is supposed to be used really, so there might be dragons we have not found yet.target
s are per release channel. So if you install the target forx86_64-pc-windows-msvc
for Rust1.77.0
then you will not automatically get it when installing1.78.0
. This is a major pain point with this approach.This change is