Rust Language

What’s new in Rust 1.55

Rust was designed to make it easy to develop fast and safe system-level software. Here’s what’s new.

1 2 3 Page 3
Page 3 of 3
  • const fn. Use this feature to define a function that can be used in a constant context, and allow it to be evaluated at compile time and not run time. A const fn function has to be deterministic; i.e., it has to yield a constant of some kind.
  • Simpler lifetime syntax. The syntax rules for describing a variable’s lifetime require less boilerplate code in some common circumstances.

Some Rust 2018 features, like non-lexical lifetimes, will eventually be backported to Rust 2015 and made available to Rust users without their having to explicitly opt in.

The new features in Rust 1.30

Version 1.30 of Rust, released on October 25, 2018, adds a few new features:

  • Procedural macros allow you to generate custom attributes and functions by way of macros. Rust 1.30 also makes it easier to apply macros to code by way of the use keyword, so that code that uses macros doesn’t have to be cluttered with as many annotations.
  • A number of improvements to the module system are being rolled out starting with this release, many also involving the use keyword. The upshot is that many module system behaviors will be less cumbersome to apply correctly, allow for clearer code, and make it easier to move use statements around in a codebase without having them break spontaneously.
  • Rust has long made it possible to write libraries that have no dependencies on the standard library. It’s now also possible to build applications that have no standard library dependencies, and thus no dependencies on any specific platform. Work on this has been in progress since Rust 1.6.

The new features in Rust 1.29

Version 1.29 of Rust, released September 13, 2018, provides a small but useful number of new features:

  • Cargo has a new subcommand, cargo fix, that automatically applies suggestions auto-generated by the compiler to the code.
  • Another new subcommand, cargo clippy, provides many more warnings about code supplied to the compiler.

The new features in Rust 1.28

Released in early August 2018, Rust 1.28’s most notable features include:

  • Global allocators. Global allocators allow a developer to define the memory allocation system used by a Rust program. Custom memory allocation strategies come in handy on embedded platforms, or in situations where the developer needs tighter-than-usual control over memory layout strategies.
  • Better error message formatting. Rust’s compiler has traditionally provided verbose and explicit error messages, along with suggestions for how to fix the problem. Rust 1.28 introduces more detailed notes about why some error conditions arise, such as invalid string formatting.
  • NonZero types are now a stable addition to the language. This provides a way to ensure that data types, such as integers, use at least one byte, making it easier to anticipate memory allocations and optimize program data placement.
  • Rust’s cargo utility no longer lets you publish crates with build scripts that modify the src directory for an application. This prevents a whole class of bugs from creeping in during the compilation process.

The new features in Rust 1.27

Rust 1.27 features basic SIMD (single-instruction, multiple-data) capabilities. The std::arch module serves as a gateway to architecture-specific instructions usually related to SIMD. A higher-level std::simd module is planned for the future.

Other new features in Rust 1.27 include:

  • The dyn Trait syntax is stabilized, providing a syntax for trait objects using a contextual dyn. A “bare trait” syntax for trait objects is deprecated, because it is often ambiguous and confusing.
  • The #[must use] attribute can now be used on functions. Previously, it only applied to types, such as Result<T, E>. Parts of the standard library also have been enhanced to use #[must use].
  • Multiple new APIs were stabilized in the release, including DoubleEndedIterator: : rfind and NonNull: :cast.
  • The Cargo package manager for Rust has been upgraded to require a —target-dir flag to change the target directory for a given invocation. Additionally, auto keys have been added to toml, for dealing with targets.

The new features in Rust 1.26

Rleased in mid-May 2018, highlights of Rust 1.26 include:

  • A reduction in compile times, via a fix impacting nested types.
  • Support for 128-bit integers, twice the size of u64 and holding more values.
  • Library stabilizations, specifically fs::read_to_string, providing a convenience over File::open and io::Read::read_to_string for reading a file into memory.
  • The Cargo package manager is expected to offer faster resolution of lock files and require manual cargo update invocations less often. 
  • The impl Trait feature, allowing for abstract types in returns or function parameters, is now stable. Existential types are provided.
  • Better match bindings, with the compiler automatically referencing or dereferencing in match.
  • Basic slice patterns, which allow you to match on slices in a similar way to matching on other data types.

The new features in Rust 1.25

Version 1.25 of Rust features an upgrade to its LLVM (Low-Level Virtual Machine) compiler infrastructure that improves support for the WebAssembly portable code format, which itself is designed to improve the performance of web applications. Rust 1.25 also includes improvements to the Cargo package manager and library stabilizations.

New Rust features from the LLVM upgrade

The Rust language has been upgraded to LLVM 6 from LLVM 4. This lets Rust keep abreast of the upstream WebAssembly back end and pick up new features when they land.

The LLVM upgrade also fixes some SIMD-related compilation errors. For internet of thigs (IoT) development, LLVM 6 brings Rust closer to supporting the AVR microntroller family, leveraged in the Arduino Uno board. Rust, Mozilla claims, can improve security and reliability of IoT devices and is much better at this than the C/C++ languages commonly used to write microcontroller firmware. AVR support is due soon.

New Rust features from the Cargo CLI changes

For the Cargo command-line interface, cargo new will default to generating a binary rather than a library. Rust’s developers said they try to keep the CLI stable but that this change was important and unlikely to result in breakage. They said that cargo new accepts two flags:

  • —lib, for building libraries
  • —bin, to build binaries or executables

In previous versions of Cargo, developers who did not pass one of these flags would default to —lib. This was done because each binary often depends on other libraries, thus making the library case more common. But this behavior is actually incorrect, because each library is depended on by many binaries. Also, some community members found the default surprising.

Other new features in Rust 1.25

Other features in Rust 1.25 include:

  • Library stabilizations include a std::ptr::NonNull<T> type, which is nonnull and covariant.
  • libcore has gained the time module, with the Duration type that had only been available in libstd
  • Checkouts of Git dependenices from the Cargo database folder should be quicker, due to the use of hard links. Cargo caches Git repositories in a few locations.
  • Nested imports groups provide a new way to write use statements, which can reduce repetition and foster clarity.

Copyright © 2021 IDG Communications, Inc.

1 2 3 Page 3
Page 3 of 3
How to choose a low-code development platform