Rust programming language 1.68 release

The general-purpose programming language Rust 1.68, founded by the Mozilla project but now developed under the auspices of the independent non-profit organization Rust Foundation, has been released. The language focuses on memory safety and provides the means to achieve high job parallelism while avoiding the use of a garbage collector and runtime (runtime is reduced to basic initialization and maintenance of the standard library).

Rust's memory handling methods save the developer from errors when manipulating pointers and protect against problems that arise due to low-level memory handling, such as accessing a memory area after it has been freed, dereferencing null pointers, buffer overruns, etc. To distribute libraries, provide builds and manage dependencies, the project develops the Cargo package manager. The crates.io repository is supported for hosting libraries.

Memory safety is provided in Rust at compile time through reference checking, keeping track of object ownership, keeping track of object lifetimes (scopes), and assessing the correctness of memory access during code execution. Rust also provides protection against integer overflows, requires mandatory initialization of variable values ​​before use, handles errors better in the standard library, applies the concept of immutable references and variables by default, offers strong static typing to minimize logical errors.

Main innovations:

  • Support for the Sparse protocol has been stabilized in the Cargo package manager and the crates.io repository, which defines a new way to work with an index that reflects the available versions of all packages existing in the repository. The new protocol allows you to significantly increase the speed of working with crates.io and solve problems with scaling with a further increase in the number of packages in the repository.

    To reduce the delays that result from downloading a full index, Sparse instead of accessing the index using Git, directly downloads over HTTPS only the necessary index data, covering the dependencies of a particular project. The new index.crates.io service is used to return index data. By default, the new protocol is planned to be used in the Rust 1.70 branch, and before that, to enable it, you can set the environment variable "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" or add the parameter 'protocol = to the "[registries.crates-io]" section of the .cargo/config.toml file "sparse"'.

  • Added macro "pin!", which allows creating a Pin<&mut T> structure from the expression "T" with local pinning of its state (unlike Box::pin does not allocate memory on the heap, but binds at the stack level).
  • A default memory allocation error handler is proposed, which is used when using the standard alloc package. Applications that only enable alloc (without std) will now call the "panic!" handler on memory allocation failures, which can optionally be intercepted with "#[panic_handler]". Programs that use the std library will still print error information to stderr and crash.
  • A new portion of the API has been moved to the category of stable, including the methods and implementations of traits have been stabilized:
    • {core,std}::pin::pin!
    • impl From for {f32,f64}
    • std::path::MAIN_SEPARATOR_STR
    • impl DerefMut for PathBuf
  • The "const" attribute, which determines the possibility of using it in any context instead of constants, is used in the VecDeque::new function.
  • Android platform now requires at least NDK r25 (API 19), i.e. The minimum supported Android version has been raised to 4.4 (KitKat).
  • The third level of support for the Sony PlayStation Vita platform has been implemented (armv7-sony-vita-newlibeabihf). The third level implies basic support, but without automated testing, publishing official builds and checking the ability to build the code.

Source: opennet.ru

Add a comment