Rust 1.78 has already been released and these are its news

rust logo

Rust is a multi-paradigm, general-purpose, compiled programming language.

The new version of Rust 1.78 has already been released and new features are implemented, as well as the stabilization of some APIs, improvements in Cargo and more.

For those who are unaware of this programming language, they should know that focuses on memory safety and provides the means to achieve high parallelism of jobs while avoiding the use of a garbage collector and runtime (runtime is reduced to basic initialization and standard library maintenance).

Main new features of Rust 1.78

In this new version presented by Rust 1.78 has increased its minimum requirement for Windows 10, Besides that the compiler was changed to use LLVM 18. When using LLVM 18 for x86-32 and x86-64 architectures, the ABI associated with the u128 and i128 types has been changed.

Regarding the changes, one of the characteristics that stands out is that Rust now supports an attribute namespace  «#[diagnosis]", what provides a means to influence the error messages produced by the compiler. These are treated as hints that the compiler is not required to use, nor is it an error to provide a diagnostic that the compiler does not recognize. This allows source code to provide diagnostics even when they are not supported by all compilers, whether different versions or completely different implementations.

Furthermore, a global cache has been stabilized in Cargo which stores information about the most recent data usage. This cache is located in $CARGO_HOME/.global-cache and uses SQLite for its implementation. It automatically updates to reflect the latest changes to the index, crate file, code directory, git clone, and git checkout, improving the efficiency and speed of dependency management operations in development projects.

Another new feature of Rust 1.78 is that the Rust standard library has Various statements for preconditions of unsafe functions which can now be deferred until code generation. This allows these checks to be carried out historically they had only been enabled in builds «#[cfg(debug_assertions)]» to avoid affecting performance in the release version. With this change, users can now detect undefined behavior in their code, although details on how much is checked are not generally stable. To enable checks, it is now sufficient to enable debug assertions for test or debug builds of the code.

In addition to that, now behavior of standard library functions that affect the alignment of pointers and sectors it is now predictable at runtime and depends on the input data. The function pointer::align_offset, which calculates the offset to align the pointer now returns usize::MAX only if the operation fails. The functions slice::align_to and slice::align_to_mut, which transform slices into a representation with an aligned middle slice and the original start and end slices, now always return the largest middle part.

On the other hand, it is mentioned that The following APIs have been moved to the “stable” category: impl Read for &Stdin, impl From for io::Error and the implementation impl which allows the use of ?Sized.

Of the Other changes that stand out of this new version:

  • The second level of support for the Add wasm32-wasip1 target platform has been implemented. The second level of support involves an assembly guarantee.
  • The wasm32-wasi-preview1-threads platform has been renamed to wasm32-wasip1-threads.
  • In the Cargo package manager, version 4 of the lock files (lockfile v4) has been stabilized. Cargo now uses this version as a standard to ensure consistency and efficient management of dependencies across projects.

If you are interested in knowing more about it, you can check the details in the following link.

Finally, for those who are Interested in upgrading from a previous version of Rust installed via rustup, you can get the new version of Rust 1.78 with:

rustup update stable

If you don't already have Rust installed on your system, you can do so by running the following command in a terminal:

curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh