Slashdot Mirror


Rust 1.31 Released As 'Rust 2018' In Major Push For Backwards Compatibility (rust-lang.org)

"The Rust programming language team has announced the first major edition of Rust since 1.0 was released in 2015," reports SD Times -- specifically, Rust 1.31, the first edition of "Rust 2018," described by Rust's developers as "the culmination of feature stabilization."

An anonymous reader writes: The Rust team is working hard to maintain backwards compatibility, for example with the way they're handling the ongoing addition of an async/await feature. "Even though the feature hasn't landed yet, the keywords are now reserved," notes the Rust Team. "All of the breaking changes needed for the next three years of development (like adding new keywords) are being made in one go, in Rust 1.31." The keyword "try" has now also been reserved, but "Almost all of the new features are 100% compatible with Rust as it is. They don't require any breaking changes... New versions of the compiler will continue to support "Rust 2015 mode", which is what you get by default... [Y]ou could think of Rust 2018 as the specifier in Cargo.toml that you use to enable the handful of features that require breaking changes."

The Rust language's blog adds, "Your 2018 project can use 2015 dependencies, and a 2015 project can use 2018 dependencies. This ensures that we don't split the ecosystem, and all of these new things are opt-in, preserving compatibility for existing code. Furthermore, when you do choose to migrate Rust 2015 code to Rust 2018, the changes can be made automatically, via cargo fix." Tooling improvements include faster and smarter "incremental" compilation (along with better IDE support), plus the addition of function-like and attribute-like (procedural) macros. There's also a rustfmt tool which can automatically reformat your code's style "like clang format does for C++ and Prettier does for JavaScript," plus an optional diagnostics linter named clippy, and automated code fixes via rustfix. There's even upgrades to Rust's module system and other path clarity improvements.

But this is only the beginning, SD Times reports: With the release of Rust 2018, the team is now starting to look at Rust's future. The team is asking developers to reflect on what they liked, didn't like or hoped to see in Rust during the last year, and propose any goals or directions for the upcoming year.

44 of 81 comments (clear)

  1. What is with the death of backwards compatability? by Anonymous Coward · · Score: 1

    Seems like every language is making backwards incomparable changes. I guess after Python 3, everyone thinks backwards incompatible changes are ok, even though Perl6 was DOA. Every version of Swift is backwards incompatible, Tensorflow 2 totally incompatible with 1.x, and these days even Java is doing it with backwards incompatible changes involving JavaFX and some other libraries. I want to like Swift, but having all your code break every 12 months is getting old. You won't be replacing C/C++ if you break everyone's code every 18 months.

  2. Anyone remember Ruby by Anonymous Coward · · Score: 1

    Rust is just another ruby. It will die out in a couple years for the next programming language fad.

  3. async/await? by 110010001000 · · Score: 1

    I hope it is better than the cluster that is async/await in Python. I am not sure how you have a new language in 2018 though that doesn't have concurrency built in. It is understandable for Python, but not Rust.

    1. Re:async/await? by HiThere · · Score: 1

      FWIW, I rather like Ruby. Too bad it's so slow. I'm not sure 3 times as fast is going to be fast enough...and so far that's just a promise.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    2. Re:async/await? by TechyImmigrant · · Score: 1

      I hope it is better than the cluster that is async/await in Python. I am not sure how you have a new language in 2018 though that doesn't have concurrency built in. It is understandable for Python, but not Rust.

      That didn't call it 'cluster' without a good reason.

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
    3. Re:async/await? by phantomfive · · Score: 1

      Ruby is faster than Python by many metrics. It doesn't really matter: execution speed isn't the bottle-neck for the vast majority of websites.

      --
      "First they came for the slanderers and i said nothing."
    4. Re:async/await? by HiThere · · Score: 1

      If you're talking about web sites, you aren't talking about my area of interest or application.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    5. Re:async/await? by phantomfive · · Score: 1

      What are your areas of interest and application?

      --
      "First they came for the slanderers and i said nothing."
    6. Re:async/await? by HiThere · · Score: 1

      It's a desktop application with a bit of graphics. It's not really heavy in computation...well, it off-loads the heavy computation to other routines...but it still isn't exactly light-weight.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    7. Re:async/await? by phantomfive · · Score: 1

      You tried it in Ruby and Ruby was too slow?

      --
      "First they came for the slanderers and i said nothing."
  4. Curious Decisions by djbckr · · Score: 1

    There are a few aspects of Rust that I like, but there are more things that I dislike about it, and I'm afraid async/await is another thing I would probably dislike. I looked over some of the reasoning behind it, and I'm frankly not finding particularly solid reasons for it. OTOH, Go's several different ways of handling concurrency are much easier to grok and "get stuff done".

    1. Re:Curious Decisions by serviscope_minor · · Score: 4, Insightful

      OTOH, Go's several different ways of handling concurrency are much easier to grok and "get stuff done".

      Well yes. But that's the problem. It's easier to hack stuff out in go because when it comes to threading it doesn't do much to stop you shooting yourself in the foot. Pretty much the entire reason for the existence of Rust was to enable the moz devs to write fine grained multithreaded code without creating a nest of subtle threading bugs.

      The reason it looks harder in Rust is because writing correct multithreaded code is in fact hard. Annoyingly so.

      --
      SJW n. One who posts facts.
    2. Re:Curious Decisions by TechyImmigrant · · Score: 1

      I am enamored with Jai's approach of pulling everything into the the source - the code, build stuff, test etc. I tried the new rust command line tutorial and it created a directory with multiple files before I ever got to write a line of code. importing a library needed two files with different syntaxes. It took a long time to compile Hello World.

      I want to like rust - It has great security properties - but it's so ugly.

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
    3. Re:Curious Decisions by RoccamOccam · · Score: 1

      I tried the new rust command line tutorial and it created a directory with multiple files before I ever got to write a line of code. importing a library needed two files with different syntaxes. It took a long time to compile Hello World.

      I'm questioning your results. Here are the step to create and run Hello World:

      cargo new hello
      cd hello
      cargo run

      That's it. 11 seconds start-to-finish, including fixing a typing mistake.

    4. Re:Curious Decisions by djbckr · · Score: 1

      Well, I never said that writing concurrent/multithreaded apps is easy. But the features in Go make it a lot more palatable. You still have to be aware what's running concurrently.

    5. Re:Curious Decisions by TechyImmigrant · · Score: 1

      I tried the new rust command line tutorial and it created a directory with multiple files before I ever got to write a line of code. importing a library needed two files with different syntaxes. It took a long time to compile Hello World.

      I'm questioning your results. Here are the step to create and run Hello World:

      cargo new hello

      cd hello

      cargo run

      That's it. 11 seconds start-to-finish, including fixing a typing mistake.

      Look in the directory.
      Cargo created a directory with some files in it and two sub directories with files in them.
      You cd into that directory and 'cargo run' it, which both builds and runs it. The build takes a long time (compared say to gcc, which completes pretty much instantly).
      To follow the command line tutorial I can had to edit a .toml file to declare a library dependency and edit the rust source file to do the import of the library.

      Quite a lot for hello world.

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
    6. Re: Curious Decisions by TechyImmigrant · · Score: 1

      I did wonder how the file structure malarky scaled with project size. Most of my programming these days is for command line tools that do data analysis or data transformation from test chip data, so I'm interested in efficiency of the programming process. I'm also old and intolerant of seeing the same old mistakes repeated. Dependency declaration files? No thanks. Python is great when performance and security isn't an issue.

      The other part of my programming is for publicly released secure cryptographic software libraries for which rust would seem to be appropriate (no dead store elimination problems, no UCB problems etc.), but the pull of C is strong for reference libraries. I'd love to move this stuff off of C, which is why I'm not giving up. I used to think C++ was nice when I first tried it and it was C with classes. Oh how that changed.

      My real job is crypto hardware in chips, for which the languages are way, way worse. Software engineers can consider themselves lucky.

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
    7. Re:Curious Decisions by RoccamOccam · · Score: 1

      I specified the commands needed to create, build, and *run* the Hello, World program. Note, that Hello, World is the default program that is created for you when you type "cargo new", so you don't even have to edit it. 11 seconds. Try it just like I typed it.

    8. Re:Curious Decisions by RoccamOccam · · Score: 1

      Well, if that was the argument that the OP made, then you might have a point. But it wasn't, and you don't. The OP specifically claimed that the time to compile a Hello World program was very long. I pointed out that the time to create, compile, and run said program was only 11 seconds. I gave the three commands to do that, so that everyone can check it for themselves.

    9. Re:Curious Decisions by TechyImmigrant · · Score: 1

      11 seconds is very long for one line of active code.

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
    10. Re:Curious Decisions by RoccamOccam · · Score: 1

      That includes the time to type the three commands, which was probably 99% of the time (I'm not a particularly good typist). Try it for yourself. See if the original complaint seems valid to you.

    11. Re: Curious Decisions by Phillip2 · · Score: 1

      Files in rust and cargo are up to the developer. It has a notion of modules, and you can declare one or many in each file, or you can do file/directory structure reflects module structure. In practice, starting a new file when the old one gets to big seems a reasonable way to go.

      In terms of dependency declaration files, this is not actually duplicated information. One is the package import (which is a namespacing thing) and also occurs within a single crate (Rust's name for a package). The other is higher level (i.e. dependency between crates). It also tells you when the dependency is relevant (dev, build, test) and what version is relevant. You certainly don't want the latter everywhere in your source and the former only implicitly so. It seems okay to me.

  5. Diamonds and Rust by Anonymous Coward · · Score: 1

    Sounds like a tune from Judas Priest, the heavy metal gods of folk.

  6. Re:What is with the death of backwards compatabili by alexo · · Score: 1

    Seems like every language is making backwards incomparable changes.
    [snip]
    You won't be replacing C/C++ if you break everyone's code every 18 months.

    C and C++ are different languages. While C++ is mostly a superset of C99, and there was some cross-pollination of features between them since, there are enough idiomatic differences between them to make "C/C++" meaningless, unless you refer to "writing C style code while using some C++ features" (a.k.a "C with classes"), which, IMHO, is not a good choice of programming style in most cases.

    Regardless, both C an C++ try to be backward compatible in their corresponding revisions, and most breaking changes fall into the category of "you shouldn't have been doing it anyway".

    And no, this is not intended to be a discussion on the merits (or lack thereof) of those languages, though I suspect it will devolve to it.

  7. Well said (and I don't like Rust). Concurrency is by raymorris · · Score: 1

    > It's easier to hack stuff out in Go because when it comes to threading it doesn't do much to stop you shooting yourself in the foot. ...
    > The reason it looks harder in Rust is because writing correct multithreaded code is in fact hard. Annoyingly so.

    Well put. I'm not a Rust fan, not even know much about it other than that Rust fans have done some over-the-top hype about features most other languages have too. I'm dealing with a codebase that has a lot of concurrency problems though. The languages make it easy to do concurrency. You don't have to understand concurrency issues to write multithreaded code in these languages. You can easily spin off threads that cause all kinds of subtle bugs that pop up rarely - infrequently enough that you're unlikely to catch them in tests, but often enough to cause problems for customers or even lock up the entire occasionally.

    Concurrency and multithreading IS hard to do right. Languages that make multithreading easy only make it easy to create very complex bugs.

  8. Can we have better names? by Futurepower(R) · · Score: 3, Insightful

    "Could cut years off some of the development time for projects."

    I understand Rust is excellent software, but why give it a name that sounds degrading. "Rust" is something you don't want to happen.

    Other foolish names:

    "Lisp" is a speech impediment.

    "Gimp" is a person who limps or is lame.

    Why restrict technology names to only 1 alphabet? LaTeX uses Greek letters, also, and requires two paragraphs in the Wikipedia article to explain the name.

    Or... Go with the flow? The next time you create open-source software, call it "Garbage"? Or "Feces"? Or maybe "Vomit"? Or, invent a new word. Maybe "Flonorba-gorba"?

    1. Re:Can we have better names? by serviscope_minor · · Score: 3, Funny

      "Gimp" [gimp.org] is a person who limps or is lame [dictionary.com].

      Limps or lame? Is that really what springs to mind? Booooriiiiing. Personally I always think "Bring out the gimp!" whenever I need to edit a picture.

      --
      SJW n. One who posts facts.
    2. Re:Can we have better names? by ShanghaiBill · · Score: 2

      In my opinion, SATAN was the best name ever.

      Unfortunately, it has been superseded by SAINT.

    3. Re:Can we have better names? by jimbo · · Score: 1

      I never saw a problem with this. Whenever a word with a previous meaning is used as a name I automatically start associating it purely with the project/person/etc. instead of the word meaning, when used in that context. It's just automatic for me. Same for family names with a original meaning - the meaning fades away and the name is associated with the person.

      Well, except for my urologist - Dr Waters.

    4. Re:Can we have better names? by Sun · · Score: 1

      I'm calling the programming language I'm creating Practical. I trust the name passes your approval?

  9. Re:What is with the death of backwards compatabili by Anonymous Coward · · Score: 1

    C++ is mostly a superset of C99 ...

    Not even close. The const operator is the biggest difference
    between the two languages. C++ is not an improved C language.

    Arrays and compound literals are handled differently; some integer
    math is different; variable promotion is not intuitive nor intrinsic;
    there's no simplified cast in C++, it's a tangled web of nutty cast
    operators to perform a straightforward task. That's the short list, too.

    Also, I have 20-year old C code that compiles and runs today. I
    have 20-year old C++ code that crashes and burns under modern
    compilers (when it ran fine in it's day, like molasses, but ran).

    CAP === 'tapestry'

  10. Re:Well said (and I don't like Rust). Concurrency by serviscope_minor · · Score: 3, Interesting

    You can easily spin off threads that cause all kinds of subtle bugs that pop up rarely - infrequently enough that you're unlikely to catch them in tests, but often enough to cause problems for customers or even lock up the entire occasionally.

    I think a good rule of thumv is that if you see some sort of general purpose class (i.e. not something like a message queue) with a mutex or atomic in it, you've seen a bug even if you don't know where it is yet.

    --
    SJW n. One who posts facts.
  11. Funny! by Futurepower(R) · · Score: 1

    Wow! Thanks for the links. From SATAN to SAINT. They seem to have learned something.

  12. Remember what people said about Micro-soft? by Futurepower(R) · · Score: 1

    "Well, except for my urologist - Dr Waters."

    Ha!

    There is a woman who is a manager in city government here whose last name is "Lust".

    Remember what people said about Microsoft? It was small and soft.

  13. 6 months by RoccamOccam · · Score: 2

    I'm about 6 months in to seriously using Rust and I absolutely love it! The ecosystem is fantastic (cargo and crates.io), the zero-cost, high-level abstractions are great, and the borrow checker is amazing!

  14. Why I love Rust by dremon · · Score: 3, Informative
    I've been lucky to persuade our PM to give Rust a try. Our main server product is written in Scala and now it also includes several Rust components which I develop and maintain. What a difference it makes! As a pro developer with decades of experience in Java/C/C++ I fully embrace it.

    Learning curve is quite steep, yes, due to unusual concepts (mainly borrow checker and move semantics). Once you get past struggling with that everything clicks in it's place and coding becomes fun again, way more so than in C/C++.

    My bullet points why I like it so much:
    • Great compiler/tooling design, cargo build tool, rustup compiler management, crates.io central repository
    • Amazing built-in unit test support, it's SO easy to write unit tests next to your production code and they are not included into the production build!
    • Very modern language features: traits, higher-order functions, closures, iterators, generics, threads, very good standard library, great external asynchronous modules which are being added now to stdlib
    • It's hard to make a messy design with sea of objects, compiler kind of enforces you to think over relations
    • No data inheritance
    • Great module system, which just became even better with 2018 edition
    • Safety, safety, safety. It's next to impossible to shoot yourself in the leg unless you do unsafe code (which is normally localized to few source locations for few special cases)
    • Fast growing collection of crates (modules), I think the intrinsic safety of the language makes them in general more stable than 3rd-party stuff written for example in Java
    • Semantic versioning, no jar hell
    • Consistent tooling, no freakin' sea of hundred build tools (cmake/make/nmake/meson/autotools/msbuild/whatever_stuff_of_the_day) and no manually managed external dependencies
    • Working IDE support, although not as polished as for Java, the IntelliJ and VSCode/RLS are working ok, especially IntelliJ
    • Very easy to integrate with existing C/C++ code via FFI, which is one of the design goals
    • No runtime and no dependencies for the target executable
    • No garbage collection, fine control over heap/stack allocations, runs blazingly fast
    • Easy to do cross compilation
    • Based on LLVM, supports all major targets
    1. Re:Why I love Rust by dremon · · Score: 2

      Static linking is a default option but you can also link dynamically and deploy with a bunch of dependent DLLs/SOs if you want.

  15. Not every version of Swift by SuperKendall · · Score: 1

    Swift has said that at this point they plan not to introduce source breaking changes again (I think there may be one more they were strongly considering).

    As someone who has been using Swift professional since the start, I really do not care though. Partly that is because of migration tools helping, but in large part it's because I'll probably be using Swift for 10 more years at least, so I'd WAY rather have the language be better to work in for a decade or longer, then complain just because I had to spend a few days making what were mostly bulk changes to code.

    Even the worst of the conversions (Swift 2 to 3) was no more than a handful of days, and that was only a painful conversion because it required a tiny bit of thought.

    I fully support the idea that languages, especially now ones, should be able to alter course until after some time it's apparent what syntax gels best with the language and developers using it.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  16. Noobs never understand backwards compatibility by Anonymous Coward · · Score: 1

    Noobs never understand backwards compatibility: a product's user base will abandon it if it abandons backwards compatibility. Get a reputation for not maintaining backwards compatibility, and the product won't gain significant new users. And every non-backwards compatible change will drive away more and more users.

    Nobody with a real job wants to have to redo their work just because you have the attention span and planning ability of a baby squirrel who stole a pot of espresso.

  17. Re:What is with the death of backwards compatabili by alexo · · Score: 1

    C++ is mostly a superset of C99 ...

    Not even close. The const operator is the biggest difference
    between the two languages. C++ is not an improved C language.

    Arrays and compound literals are handled differently; some integer
    math is different; variable promotion is not intuitive nor intrinsic;
    there's no simplified cast in C++, it's a tangled web of nutty cast
    operators to perform a straightforward task. That's the short list, too.

    Also, I have 20-year old C code that compiles and runs today. I
    have 20-year old C++ code that crashes and burns under modern
    compilers (when it ran fine in it's day, like molasses, but ran).

    1. Ugh, typo! I meant C89, not C99. My bad. That said, I do not claim that C++ is a strict superset of C89, only "mostly", but I don't see it as a problem because they are different languages. C programs should be compiled with C compilers.

    2. C++ has always supported C-style casts.

    3. Conformant C++98 code should work the same when compiled under compilers conforming to newer versions of the standard. Other than the obvious cases of adding keywords and deprecating auto_ptr, I would be interested to see code examples to the contrary. Please note that relying on undefined behaviour or nonstandard extensions does not count.

  18. Re:What is with the death of backwards compatabili by alexo · · Score: 1

    C and C++ are different languages. While C++ is mostly a superset of C99

    Sorry, I meant to type C89. Thank you AC!

  19. Never played it... by dohzer · · Score: 1

    Did this game ever really take off? Why are people still talking about it?

  20. Re:Well said (and I don't like Rust). Concurrency by phantomfive · · Score: 1

    When you add a thread, you add a bug.

    --
    "First they came for the slanderers and i said nothing."
  21. Re:Well said (and I don't like Rust). Concurrency by serviscope_minor · · Score: 1

    When you add a thread, you add a bug.

    No arguing there.

    I've definitely seen code where the author clearly believed that sprinkling "atomic" around like magic pixie dust makes the code thread safe.

    --
    SJW n. One who posts facts.