Skip to content
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

[Discussion] Updating MSRV to 1.29.0 #338

Closed
elichai opened this issue Nov 6, 2019 · 48 comments
Closed

[Discussion] Updating MSRV to 1.29.0 #338

elichai opened this issue Nov 6, 2019 · 48 comments

Comments

@elichai
Copy link
Member

elichai commented Nov 6, 2019

Hi,
I want to initiate a discussion about bumping the MSRV to 1.29.0.

  1. It was released at 2018-09-13, which is more than a year ago.
  2. mrustc now supports compiling it directly. so potential bootstrapping should be easy.

A non exhaustive list of important(IMHO) features:

  1. the GlobalAlloc API is stable. meaning we can make better alignment guarantees in rust-secp256k1. (fix Pre-allocation and alignment rust-secp256k1#138 which also affect non preallocated ). [1.28]
  2. repr(align(N)) on types. [1.25]
  3. The Error trait is a marker on top of Display. [1.27]
  4. Closures implement Clone/Copy (see tests of use lambda instead of a hash map to find spent outputs #319).
  5. u128/i128. [1.26]
  6. Duration no longer requires libstd. (Move Duration to libcore rust-lang/rust#46666) [1.25]
  7. Fix cargo's CVE-2019-16760. [1.26]
  8. NonNull pointer. [1.25]
  9. slice::align_to [1.30]

Ergonomics reasons (again non exhaustive):

  1. Tests can return Result<(), E: Debug>. [1.28]
  2. dyn syntax. (shows explicitly that there's dynamic dispatch involved). [1.27]
  3. #[must_use] warning (https://github.com/rust-lang/rfcs/blob/master/text/1940-must-use-functions.md) [1.27]
  4. Inclusive range (getting rid of these warnings lol). [1.26]
  5. Nested imports (https://github.com/rust-lang/rfcs/blob/master/text/2128-use-nested-groups.md). [1.25]

Important features for allowing dependencies:

  1. crate keyword (used by cc and ryu). [1.30]
  2. 2018 Edition (used by cc, ryu, serde_derive) [1.31]
  3. to_be_byte functions (used by base64(Add MessageSignature type for dealing with signed messages #413)) [1.32]
  4. TryInto trait (used by base64(Add MessageSignature type for dealing with signed messages #413)) [1.34]
@elichai
Copy link
Member Author

elichai commented Nov 6, 2019

I'll wait to see what's up with thepowersgang/mrustc#123 but we can start talking about this.

@TheBlueMatt
Copy link
Member

TheBlueMatt commented Nov 6, 2019 via email

@elichai
Copy link
Member Author

elichai commented Nov 6, 2019

That's a great question that skipped my mind.
I'll try to do a survey of rust versions in distros.
Altough it's always a bit hard to differentiate between available packages and shipped ones.

@TheBlueMatt
Copy link
Member

TheBlueMatt commented Nov 6, 2019 via email

@elichai
Copy link
Member Author

elichai commented Nov 6, 2019

Supported Distros:

RedHat and CentOS are harder to search for some reason. but checking via docker

@TheBlueMatt
Copy link
Member

Hmm, so minimum is definitely no lower than 1.24 (about 1.5 years old). Of your list of "wants", I'd love to see a "which version it went in", it looks like quite a few of them went in in 1.24 (except maybe NonNull, which maybe we can live without?).

@elichai
Copy link
Member Author

elichai commented Nov 7, 2019

@TheBlueMatt updated the list. seems like non of what I listed here is less than 1.25.

I looked again at https://github.com/rust-lang/rust/blob/master/RELEASES.md and couldn't find anything interesting between 1.22-1.24.
kinda sucks if the reason we/core will be stuck with this is because of Debian Strech.

Anyway. I see no good reason to bump to anything less than 1.28 (which will help me sleep better at night with the raw allocations and alignments lol).

And unless you know a Debian maintainer it doesn't look like they're going to update Strech's rustc. so I guess we need to wait until it's oldoldstable? (probably somewhere around September 2020)

@elichai
Copy link
Member Author

elichai commented Nov 7, 2019

Talked with some Debian guys.
oldstable-proposed-updates [1] already has 1.34.2 so hopefully this will be included in the next point release [2]

[1] http://ftp.debian.org/debian/dists/oldstable-proposed-updates/
[2] https://www.debian.org/releases/oldstable/errata#pointrelease

@TheBlueMatt
Copy link
Member

Does oldstable-proposed-updates go into oldstable/updates or into oldstable main? Cause those are rather different things (though it also may not be worth making the distinction in our case). At a high level, making the required version something that is barely more than a year old feels super, super unhealthy, but it seems supported platforms have mostly been updating quickly. It would be nice to finally get to a point where we don't need to bump the min version so often, is there anything we want in 1.30 - 1.34 (I assume we'll at least be stuck on 1.34 for a long time, given Debian stable is currently shipping it).

@apoelstra
Copy link
Member

It does seem unhealthy in general, but I really don't expect this situation to persist very long. In 20 years maybe we'll be using 18-year-old versions of Rust without issue.

@elichai
Copy link
Member Author

elichai commented Nov 7, 2019

Does oldstable-proposed-updates go into oldstable/updates or into oldstable main?

I don't know.

At a high level, making the required version something that is barely more than a year old feels super, super unhealthy, but it seems supported platforms have mostly been updating quickly.

I agree. it seems like the reason distros are updating quickly is so they can build firefox (https://wiki.mozilla.org/Rust_Update_Policy_for_Firefox)

It would be nice to finally get to a point where we don't need to bump the min version so often, is there anything we want in 1.30 - 1.34 (I assume we'll at least be stuck on 1.34 for a long time, given Debian stable is currently shipping it).

  1. Atomic Types - 1.34 (don't think here but definitely in core you'll probably want it).
  2. Multiple patterns in if let and while let expressions.(nice, not serious though) - 1.33 (Stabilize #![feature(if_while_or_patterns)] rust-lang/rust#57532)
  3. from_*_bytes/to_*_bytes (native support for endianness) - 1.32.
  4. Edition 2018 - 1.31.
  5. const fn - Started in 1.31, but from then on it's getting more and more useful.
  6. Proc Macros - 1.30.
  7. more pub(*) visibilities. - 1.30.
  8. #[panic_handler] Maybe for core? (specify our own panic handler.) - 1.30.
  9. Fixed type safety vulnerability (https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-12083) - 1.34.2
  10. alloc crate is stable (using heap allocation in no-std) - 1.36.

Anyway, the main problem is that rust is still evolving really fast. I'm not sure these changes will stop in the next year(const fn are still less than half of what constexpr is in C++17, and const generics is still a long way), but maybe in 2-3 years we'll get to a stop and that's it.

@apoelstra
Copy link
Member

I really really want !. Which was rumored for 1.40 but I don't know?

@elichai
Copy link
Member Author

elichai commented Nov 7, 2019

Why do you want it so much?

@elichai
Copy link
Member Author

elichai commented Nov 7, 2019

Looks like 1.41 hopefully rust-lang/rust#65355

@TheBlueMatt
Copy link
Member

TheBlueMatt commented Nov 7, 2019

I agree. it seems like the reason distros are updating quickly is so they can build firefox

Isn't that the point of Firefox ESR? You don't have to upgrade Rust to upgrade to the latest ESR release, no?

Atomic Types - 1.34

As long as you only need atomic_u32, AtomicUsize should suffice, no?

As for the rest of the things in your list they all seem purely ergonomic, and only marginally so? I don' think anything in that list is too helpful for core, though we do really need/want GlobalAlloc, so 1.29 seems to be what we'll need for Core, too, admittedly.

@elichai
Copy link
Member Author

elichai commented Nov 17, 2019

@apoelstra
Copy link
Member

@elichai 3rd party void types have a ton of disadvantages (and very few advantages over just defining your own), vs one that the compiler understands.

@elichai
Copy link
Member Author

elichai commented Nov 21, 2019

@apoelstra IIUC this is literally ! not a custom type. It just requires a type indirection to be used on stable (through a trait)

@TheBlueMatt
Copy link
Member

Apparently CentOS 7 is on 1.24 https://twitter.com/bk2204/status/1213980937744211968 and EOL isn't until 2024 https://wiki.centos.org/Download

@elichai
Copy link
Member Author

elichai commented Jan 6, 2020

Apparently CentOS 7 is on 1.24 https://twitter.com/bk2204/status/1213980937744211968 and EOL isn't until 2024 https://wiki.centos.org/Download

weird. this says otherwise: https://pkgs.org/download/rust
I guess i'll install CentOS 7 in a VM to check.

@elichai
Copy link
Member Author

elichai commented Jan 17, 2020

FWIW it looks like bitcoin core requires the EPEL repositories in CentOS too (which currently contain rust 1.40 even for CentOS 7)
https://github.com/bitcoin/bitcoin/blob/master/ci/test/04_install.sh#L91

@TheBlueMatt
Copy link
Member

That's just the CI scripts, though, no? Did you actually test building Core without them?

@elichai
Copy link
Member Author

elichai commented Jan 17, 2020

That's just the CI scripts, though, no? Did you actually test building Core without them?

I was trying to word it as maybe but I guess that didn't come out as I wanted heh.
So I looked over all the packages it is installing through the distro and it looks like only python36-zmq and dash are from EPEL, the first is obviously only for testing and the second is I belive convenience. anyhow just FUD on my part :)

@elichai
Copy link
Member Author

elichai commented Jan 23, 2020

FIY the whole serde ecosystem is sadly slowly climbing to MSRV 1.31
See: #398
#398
serde-rs/serde#1602

@TheBlueMatt
Copy link
Member

TheBlueMatt commented Jan 23, 2020 via email

@real-or-random
Copy link
Contributor

Supported Distros:
* Debian: Weird. it seems like Jessie(oldoldstable) and Buster(stable) are 1.34. but Strech(oldstable) is 1.24. (https://packages.debian.org/search?keywords=rustc&searchon=names&suite=all&section=all)

FWIW, stretch is on 1.34 now.

@elichai
Copy link
Member Author

elichai commented Feb 23, 2020

@apoelstra
Copy link
Member

I think it'd be reasonable to require 1.36 (or even higher) for no_std while retaining the older version for everything else. Embedded users unfortunately need to keep up with the latest compilers anyway because there's so much iteraton on this front still.

@kiminuo
Copy link
Contributor

kiminuo commented Apr 13, 2020

Also a nice webpage for tracking rustc version in Debian distribution versions: https://tracker.debian.org/pkg/rustc

@thomaseizinger
Copy link
Contributor

I just stumbled over https://github.com/dtolnay/rustversion and thought I might share it here.

It has trade-offs in terms of maintenance effort but could allow the library to make use of newer language features for some parts of the code without necessarily requiring every consumer to use a newer version of Rust.

Now the irony is, I think that this library in itself has a MSRV of 1.31 😬

@elichai
Copy link
Member Author

elichai commented Jun 1, 2020

FYI, for #430 and the cc problems, rust 1.31 is required.

I also updated the main post and the distributions post: #338 (comment), the only distro we care about that is under 1.31 is CentOS 7 under the SCL repositories, I'm not a CentOS user so I don't really know the usage and difference between SCL and EPEL but rust is not included in the main repos anyway.

also 1.31 is more than 1.5 years old, and mrustc supports 1.29, I can try writing a bootstrap script from mrustc to 1.31 stable if it helps

@elichai
Copy link
Member Author

elichai commented Jun 3, 2020

Note that when bitcoin/bitcoin#18942 is merged bitcoin core will officially stop supporting compiling core in CentOS 7

@stevenroose
Copy link
Collaborator

I'm not in total disagreement with raising the MSRV. It think we could have a planned discussion on IRC once (or perhaps a CoreDev meeting or so) to agree on a specific version. The we can merge all our pending changes, do a release and then raise the MSRV for next releases. If we find out there are people still using version we don't support anymore, we can potentially do security patches or specific feature requests to the 1.22 branch.

@dr-orlovsky
Copy link
Collaborator

If we'd like to have async support (as in discussion of #455), it seems MSRV has to be 1.36

@TheBlueMatt
Copy link
Member

Sadly, 1.36 is a long ways off from practical for everyday rust - if you want to do that you force a lot of distro users into rustup, which is totally unacceptable for security-conscious users.

@TheBlueMatt
Copy link
Member

We ended up bumping MSRV for rust-lightning to 1.30, as there's a bug in 1.29 cargo which breaks compilation when you have a subcrate with an edition, even though 1.22 allows it. See lightningdevkit/rust-lightning#671

@apoelstra
Copy link
Member

I think we could bump to 1.29 today.

Going all the way to 1.31 is tempting -- it would require mrustc users to do two more compilations of the compiler (which is actually better than the situation we had back when we moved to 1.22, when mrustc was at 1.19) -- and it would give us basic access to Rust 2018.

@real-or-random
Copy link
Contributor

I personally don't think that the ability to bootstrap is very relevant because I doubt that users do this in practice.

And since I don't write a lot of Rust code I don't feel competent enough to judge whether it's worth to bump to a particular version, so I'm happy with whatever people here agree on.

@elichai
Copy link
Member Author

elichai commented Sep 12, 2020

@elichai elichai closed this as completed Sep 12, 2020
@Kixunil
Copy link
Collaborator

Kixunil commented Oct 1, 2020

For the record, Debian stable now contains 1.41.1.

@apoelstra
Copy link
Member

1.41.1 is not even a year old, and mrustc only supports 1.29.

@Kixunil
Copy link
Collaborator

Kixunil commented Oct 1, 2020

Didn't want to imply we should update MSRV right now. :) Just hope it's not too far away. Async/await would be very nice.

@apoelstra
Copy link
Member

apoelstra commented Oct 1, 2020

Definitely :) though unfortunately it may be quite a difficult thing for mrustc to support.

@Kixunil
Copy link
Collaborator

Kixunil commented Oct 1, 2020

I think mrustc will not need to support it since rustc doesn't need async/await. Or am I missing something?

@bjorn3
Copy link

bjorn3 commented Oct 1, 2020

Rustc needs generators anyway (in rustc_interface), so implementing async/await should by a matter of just desugaring it to a generator like rustc does.

@apoelstra
Copy link
Member

Oh nice, that's an encouraging observation.

@devrandom
Copy link
Contributor

mrustc now supports 1.39.0

@dr-orlovsky
Copy link
Collaborator

dr-orlovsky commented May 10, 2021

@devrandom: MSRV bump is already sort of WIP - pls check #510 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests