The optional hints allow source code to provide diagnostics even when they are not supported by all compilers. Credit: cortixxx Rust 1.78, just released as the latest version of the popular, memory-safe programming language, adds backing for a #[diagnostic] attribute namespace to influence compiler messages. These messages are treated as hints that the compiler is not required to use, the Rust team said. Also it is not an error to provide a diagnostic that the compiler does not recognize. The feature is designed to allow source code to provide diagnostics even when they are not supported by all compilers. Announced May 2, Rust 1.78 can be installed via rustup: $ rustup update stable Another feature in Rust 1.78 pertains to asserting unsafe preconditions. The Rust standard library has a number of assertions for preconditions of unsafe functions, but historically they have been enabled only in #[cfg(debug_assertions)] builds of the library to avoid affecting release performance. Since the library usually is compiled and distributed in release mode, most Rust developers were not executing these checks. With Rust 1.78, the condition for these assertions is delayed until code generation, so they will be checked depending on the user’s setting for debug assertions, enabled by default in debug and test builds. This change will help catch undefined behavior in code, the Rust team said. However, the details of how much is checked generally are not stable. Deterministic realignment also is featured in Rust 1.78. The standard library has functions that change alignment of pointers and slices, but they previously had caveats that made them difficult to rely on in practice. These caveats mostly existed as a hedge against const evaluation, but they were only stable for non-const use. Now, they are promised to have consistent runtime behavior according to actual inputs. Rust 1.78 also stabilizes a number of APIs, raises its minimum requirement to Windows 10 for targets such as x_86-pc-windows-msvc, and upgrades its bundled LLVM to LLVM 18. Rust 1.78 follows the March 21 release of Rust 1.77, which featured support for C-string literals. Two subsequent point releases also were made, Rust 1.77.1, which disabled new Cargo behavior on Windows for targets using MSVC (Microsoft C and C++), and Rust 1.77.2, which included a vulnerability fix. Related content analysis Beyond the usual suspects: 5 fresh data science tools to try today The mid-month report includes quick tips for easier Python installation, a new VS Code-like IDE just for Python and R users, and five newer data science tools you won't want to miss. By Serdar Yegulalp Jul 12, 2024 2 mins Python Programming Languages Software Development analysis Generative AI won’t fix cloud migration You’ve probably heard how generative AI will solve all cloud migration problems. It’s not that simple. Generative AI could actually make it harder and more costly. By David Linthicum Jul 12, 2024 5 mins Generative AI Artificial Intelligence Cloud Computing news HR professionals trust AI recommendations HireVue survey finds 73% of HR professionals trust AI to make candidate recommendations, while 75% of workers are opposed to AI making hiring decisions. By Paul Krill Jul 11, 2024 3 mins Technology Industry Careers how-to Safety off: Programming in Rust with `unsafe` What does it mean to write unsafe code in Rust, and what can you do (and not do) with the 'unsafe' keyword? The facts may surprise you. By Serdar Yegulalp Jul 11, 2024 8 mins Rust Programming Languages Software Development Resources Videos