Red Hat Training

A Red Hat training course is available for Red Hat Developer Tools

Chapter 5. Changes in Rust Toolset in Red Hat Developer Tools 2018.2

This chapter lists some notable changes in Rust Toolset since its previous release.

5.1. Rust

Rust has been updated from version 1.22.1 to 1.25.0. Notable changes include:

  • Incremental compilation has been added to the Rust compiler. The compiler can reuse artifacts from previous builds and rebuild only the neccessary parts of code.
  • The default amount of code generation units for compilation has been changed to 16.
  • The methods from the AsciiExt trait are now implemented directly in the string and character types.

    Note that this change may cause unused_imports warnings to appear for code bases using the AsciiExt trait.

  • Several library functions such as mem::size_of() can be used in const expressions.
  • Structs can be aligned using the #[repr(align(x))] attribute.
  • The std::ptr::NonNull<T> type has been added to the standard library for holding a non-null covariant pointer.
  • The rustfmt code formatting tool has been added. For more information, see Chapter 3, rustfmt.

Additionally, the following bugs have been fixed:

  • Previous changes in the glibc library caused Rust to not recognize stack guard code. As a consequence, when a stack overflow happened in a Rust thread, Rust terminated with a segmentation fault signal SIGSEGV instead of an abort signal SIGABRT. Additionally, the error message "thread '{}' has overflowed its stack" was not displayed. Rust has been updated to recognize the stack guard correctly and terminates again with the correct signal and error message. (BZ#1540329)

5.2. cargo

The cargo tool has been updated from version 0.23.0 to 0.26.0. Notable changes include:

  • Support for unit tests has been added to the cargo check command.
  • Support for selecting specific versions has been added to the cargo install command.
  • Support for removing multiple packages at once has been added to the cargo uninstall command.
  • Debug builds enable incremental compilation by default.
  • The cargo new command now defaults to creating a project for a binary instead of a library. Additionally, it no longer mangles supplied project names when they include substrings related to Rust.

5.3. Container Image

Notable changes include:

  • Source-to-Image (S2I) support has been added to the rust-toolset-7-rhel7 container image. As a result, S2I can be used to build Rust application containers. (BZ#1535050)