The Linux Kernel Matures To Having A Minimum Rust Toolchain Version

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • phoronix
    Administrator
    • Jan 2007
    • 67317

    The Linux Kernel Matures To Having A Minimum Rust Toolchain Version

    Phoronix: The Linux Kernel Matures To Having A Minimum Rust Toolchain Version

    Nearly every Linux kernel cycle has bought patches to bump the version of the Rust language targeted by the kernel as it worked toward having a suitable minimum version. With the latest Linux kernel patches, it looks like we may be finally approaching the point where a safe minimum version can be specified and for the Linux kernel to in turn allow supporting multiple different versions of the Rust compiler...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite
  • ahrs
    Senior Member
    • Apr 2021
    • 580

    #2
    In addition, Rust for Linux is now being built-tested in Rust's pre-merge CI. That is, every change that is attempting to land into the Rust compiler is tested against the kernel, and it is merged only if it passes -- thanks to the Rust project for that!
    Well done to them for volunteering to do that. "Rust is unstable" is a common complaint, hopefully real-world usage in a large project like Linux will help to catch any issues beforehand.

    Comment

    • duby229
      Senior Member
      • Nov 2007
      • 7779

      #3
      This rust is unstable complaint, I'd like to know more about it if you have the time to point me in the right direction.

      I've been learning rust for the past half year or so and I'm getting more proficient with it. Knowing about stuff like this would be good for me to keep in perspective.

      Comment

      • ahrs
        Senior Member
        • Apr 2021
        • 580

        #4
        Originally posted by duby229 View Post
        This rust is unstable complaint, I'd like to know more about it if you have the time to point me in the right direction.
        The fact that there's no stable language specification and you sometimes can't compile new/old code with differing compiler versions.

        Real-world usage and testing of that in their CI should go a long way to fixing that. If in the future Debian Stable will never have to worry about their Rust compiler being outdated again because Rust has matured to that point now then that can only be a good thing.

        Comment

        • ehansin
          Senior Member
          • Oct 2016
          • 697

          #5
          I thought I read in the past the kernel Rust people had to maintain some external functionality missing from vanilla rustc to allow things to work. Does anyone know if this has been merged so things just work now with vanilla rustc? Using best terminology here I can come up with to describe.

          ** On further thought, it may have been functionality missing from the standard library that had to be externally maintained, with hopes to get it added in eventually.
          Last edited by ehansin; 02 July 2024, 12:26 PM. Reason: ** added additional thoughts...

          Comment

          • bug77
            Senior Member
            • Dec 2009
            • 6513

            #6
            Originally posted by ahrs View Post

            Well done to them for volunteering to do that. "Rust is unstable" is a common complaint, hopefully real-world usage in a large project like Linux will help to catch any issues beforehand.
            It's mostly a thing of the past.
            As expected, initial Rust versions were pretty fluid. But that was years ago. If you read the release notes for anything in the last 3 years or so, you'll see it's mostly small changes, API additions and clarifications. Sure, there's no ISO Rust, but there wasn't an ANSI C either till C was 13 years old...

            Comment

            • Serafean
              Senior Member
              • Dec 2011
              • 614

              #7
              Originally posted by ahrs View Post

              Well done to them for volunteering to do that. "Rust is unstable" is a common complaint, hopefully real-world usage in a large project like Linux will help to catch any issues beforehand.
              Rust, welcome to the path that leads to becoming history-laden as C/C++ is...
              "it seemed sensible at the time" decisions have to stay for backward compatibility.

              Comment

              • CommunityMember
                Senior Member
                • Oct 2019
                • 1374

                #8
                Originally posted by ahrs View Post

                "Rust is unstable" is a common complaint
                So is the complaint that the linux kernel API is unstable. Both statements have a bit of truth behind them, but neither issue is insurmountable with sufficient care and planning and resources to resolve issues are they are identified.

                Comment

                • ssokolow
                  Senior Member
                  • Nov 2013
                  • 5096

                  #9
                  Re: Rust being unstable, the Linux kernel has been doing the equivalent of depending on nightly builds of Firefox or Chrome to get around how they no longer expose things like -webkit-prefixed CSS properties in release builds because websites came to depend on them and de facto forced some of them to become standard.

                  Rust puts a tremendous amount of effort into ensuring that, "If it builds with compiler version X, it'll build with version X+N" unless it's something not covered by that guarantee, such as "The program only built in the first place because it was depending on a soundness hole in the type checker which has no been closed".

                  Basically, "Rust is unstable" is a holdover opinion from when many many more programs needed to depend on nightly compiler builds to access features.
                  Last edited by ssokolow; 02 July 2024, 01:32 PM.

                  Comment

                  • browseria
                    Senior Member
                    • Apr 2018
                    • 152

                    #10
                    Originally posted by ahrs View Post
                    The fact that there's no stable language specification and you sometimes can't compile new/old code with differing compiler versions.
                    ahrs duby229 This is ... misleading. If you compiled "old" code with a stable version of the rustc compiler, it should always be compilable with newer stable rustc compilers. This has held true for me for the last 10 years, at least. In fact, the only time this has not been true for me is when someone required using a nightly or beta build of the rustc compiler to build their code and did not refactor it once whatever they were depending on in the nightly-/beta- hit stable. Also, there was the one bump going from 2015-Edition compilers to 2018-Edition compilers, where "async"/"await" and some others became keywords where before it was possible to use them as variable names. Even then, it wasn't an issue, as long as you stayed with the same "Edition".

                    If you always stick to using a stable version of the rustc compiler, you will never have an issue no matter what version it is, unless you migrate to a newer Edition that appropriates one of your variable names as a keyword. I would love to hear an anecdote where this was NOT the case.

                    See this and this for more details.

                    Also, since they are declaring a minimum version, by definition any "extra" stuff needed to talk to the kernel has already made it to stable. Otherwise they wouldn't be specifying a minimum version! What this basically boils down to is any code marked as "2024-Edition" will work with the linux kernel, from here on out.
                    Last edited by browseria; 02 July 2024, 02:30 PM.

                    Comment

                    Working...
                    X