Rust 1.79 has been released. A consortium has been created for developing highly reliable systems in Rust.

The release of the general-purpose programming language Rust 1.79 has been published. Originally developed by Mozilla, it is now managed under the auspices of the independent non-profit organization Rust Foundation. The language focuses on safe memory handling and provides tools for achieving high parallelism in task execution without relying on a garbage collector or runtime (the runtime is limited to basic initialization and maintenance of the standard library).

The memory management methods in Rust relieve developers from errors when manipulating pointers and protect against issues arising from low-level memory operations, such as accessing memory after it has been freed, dereferencing null pointers, buffer overflows, and so on. For distributing libraries, ensuring builds, and managing project dependencies, the package manager Cargo is being developed. A repository at crates.io supports library hosting.

Safe memory handling in Rust is ensured at compile time through reference checking, ownership tracking of objects, lifetime consideration (scope) of objects, and assessment of memory access correctness during code execution. Rust also provides means to protect against integer overflows, mandates the initialization of variable values before use, improved error handling in the standard library, employs the concept of immutability for references and variables by default, and offers strong static typing to minimize logical errors.

Key innovations:

  • Support has been added for inline constants, which can be specified directly in the code using blocks like “const { … }”. These are processed in the context of constants and allow for avoiding separate constant definitions. The code specified in the “const { … }” block is computed at compile time and used as a constant, without execution during the program's runtime. Unlike defining constants through the expression “const ITEM: … = …”, type does not have to be specified in the “const { … }” blocks, as they support type inference. For example, code with a separate constant definition

    const EMPTY: Option<Vec> = None;
    let foo = [EMPTY; 100];

    can be replaced with in-place usage:

    let foo = [const { None }; 100];

  • The syntax “T: Trait” has been stabilized for specifying constraints in the position of associated types, allowing for shorter definitions of expressions with nested type constraints, which previously required specifying a nested impl Trait or multiple “where” conditions.
  • Automatic lifetime extension for temporary values used in match and if constructs has been ensured.

    let a = if true {
    ..;
    &temp() // the lifetime will be extended
    } else {
    ..;
    &temp() // the lifetime will be extended
    };

  • The ability to import the main function from other modules and crate packages has been stabilized.
  • When building the standard library, the compiler uses the flag “-Cforce-frame-pointers=yes”, which adds data for stack reconstruction during program profiling.
  • A new batch of APIs has been promoted to stable, including stabilized methods and trait implementations:
    • {integer}::unchecked_add
    • {integer}::unchecked_mul
    • {integer}::unchecked_sub
    • ::split_at_unchecked
    • ::split_at_mut_unchecked
    • ::utf8_chunks
    • str::Utf8Chunks
    • str::Utf8Chunk
    • ::is_aligned
    • ::is_aligned
    • NonNull::is_aligned
    • ::len
    • ::len
    • ::is_empty
    • ::is_empty
    • NonNull::::is_empty
    • CStr::count_bytes
    • io::Error::downcast
    • num::NonZero
    • path::absolute
    • proc_macro::Literal::byte_character
    • proc_macro::Literal::c_string
  • The 'const' keyword, defining the ability to be used in any context instead of constants, is applied in functions:
    • Atomic*::into_inner
    • io::Cursor::new
    • io::Cursor::get_ref
    • io::Cursor::position
    • io::empty
    • io::repeat
    • io::sink
    • panic::Location::caller
    • panic::Location::file
    • panic::Location::line
    • panic::Location::column
  • Stabilized
    part of the capabilities that can be used when compiling to WebAssembly (WASM) intermediate representation.
  • The third level of support has been implemented for platforms aarch64-apple-visionos, aarch64-apple-visionos-sim, and riscv32ima-unknown-none-elf. This level implies basic support but without automated testing, the release of official builds, and the verification of the ability to compile code.
  • The second level of support has been implemented for the target platforms aarch64-pc-windows-gnullvm, i686-pc-windows-gnullvm, and x86_64-pc-windows-gnullvm. The second level of support guarantees successful builds.

In addition, the Rust Foundation, which oversees the Rust language ecosystem, announced the creation of the 'Safety-Critical Rust Consortium', aimed at using the Rust language in solutions requiring high reliability (Safety-Critical Software), where failures can threaten lives, harm the environment, or lead to serious equipment damage. Companies such as ARM, AdaCore, Ferrous Systems, OxidOS, Synopsys, HighTec EDV-Systeme GmbH, TrustInSoft, Veecle, and Woven by Toyota have joined the consortium. Among the tasks the consortium will tackle are writing guidelines and developing libraries, linters, and static analyzers, as well as applying formal verification methods for reliability and developing subsets of the language for high-reliability systems.

Among the projects related to high-reliability systems is Verus — a toolkit for verifying the correctness of Rust code. Verification is performed by defining a specification that describes the acceptable behavior of the code. During the execution of the code, Verus checks compliance with the specification to confirm correctness.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster