Announcement

Collapse
No announcement yet.

Rust Support In The Linux Kernel Undergoing Another Round Of Discussions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rust Support In The Linux Kernel Undergoing Another Round Of Discussions

    Phoronix: Rust Support In The Linux Kernel Undergoing Another Round Of Discussions

    Last month the initial infrastructure for allowing the Rust programming language to be used within the Linux kernel landed in the Linux-Next tree for more widespread testing ahead of its possible inclusion in the mainline kernel. Now a "request for comments" has been started again on the kernel mailing list around the prospects of Rust code for the Linux kernel...

    https://www.phoronix.com/scan.php?pa...April-2021-RFC

  • #2
    Is memory safety so hard people had to create another language to address it?

    Comment


    • #3
      Originally posted by angrypie View Post
      Is memory safety so hard people had to create another language to address it?
      Considering it's a problem that has costed billions of dollars and uncountable man-hours over the past 50 years yet is nowhere near solved in traditional languages, I'd say yes.

      Comment


      • #4
        I’ve finally gotten around to learning Rust. It’s a great modern language that makes me actually consider doing systems programming. (Not a fan of how error prone c and c++ are) There are some unfortunate aspects of the language though.

        The lack of variadic functions and default/optional/labeled parameters is sad. People seem to love macros or the using the builder pattern as solutions. The builder pattern looks cool from a caller’s perspective, but it’s so verbose to implement...

        Those two off the top of my head are a pain compared to other languages that I use. I’ll add more if I remember them later.

        Comment


        • #5
          Originally posted by angrypie View Post
          Is memory safety so hard people had to create another language to address it?
          1. Yes it's extremely hard and 2. The point is not even memory safety as such but its PROVABILITY. It is possible to write code that is effectively memory safe in C but it's strictly impossible to prove it.

          PS: Rust is not just about memory safety.

          Comment


          • #6
            Originally posted by cynical View Post
            I’ve finally gotten around to learning Rust. It’s a great modern language that makes me actually consider doing systems programming. (Not a fan of how error prone c and c++ are) There are some unfortunate aspects of the language though.

            The lack of variadic functions and default/optional/labeled parameters is sad. People seem to love macros or the using the builder pattern as solutions. The builder pattern looks cool from a caller’s perspective, but it’s so verbose to implement...

            Those two off the top of my head are a pain compared to other languages that I use. I’ll add more if I remember them later.
            In rust there is no way to temporarily disable a part of your code, like #if 0-#endif in C.

            Comment


            • #7
              The Linux kernel build process has already a laundry list of dependencies; adding LLVM to the mix won't change much as this stage. I think the single strong argument against Rust in the kernel at the moment is that it doesn't support all the legacy architectures that Linux can run on (SPARC, HPPA etc). On the other hand, those are already not supported by the major distros, and whatever works only offers a subset of the modern features anyway. Their dropping is only a matter of time, so the introduction of Rust could be a good moment to officially deprecate them.

              Comment


              • #8
                Originally posted by zxy_thf View Post
                In rust there is no way to temporarily disable a part of your code, like #if 0-#endif in C.
                Rust has "features" that let you selectively enable parts of the code; but it doesn't have any #ifdef/#endif which is a Very Good Thing.

                Comment


                • #9
                  Originally posted by zxy_thf View Post
                  In rust there is no way to temporarily disable a part of your code, like #if 0-#endif in C.
                  Of course there is you can just use cfg see https://doc.rust-lang.org/rust-by-ex...ibute/cfg.html for example. The target can be replaced by custom featuresets you create and choose build-time.

                  Comment


                  • #10
                    Originally posted by Almindor View Post

                    Of course there is you can just use cfg see https://doc.rust-lang.org/rust-by-ex...ibute/cfg.html for example. The target can be replaced by custom featuresets you create and choose build-time.
                    The tricky part is the editor integration.
                    Vim can recognize #if 0 #endif, but afaik there is no standard pattern for cfg (no, "if cfg!(false)" doesn't work)

                    Comment

                    Working...
                    X