Rust programming language 1.37 release

Published system programming language release Rest 1.37founded by the Mozilla project. The language focuses on safe memory management, provides automatic memory management, and provides the means to achieve high job parallelism while avoiding the use of a garbage collector and runtime.

Rust's automatic memory management saves the developer from manipulating pointers and protects against problems arising from low-level memory manipulation, such as accessing a memory area after it has been freed, dereferencing null pointers, buffer overruns, etc. To distribute libraries, ensure assembly and manage dependencies, the project develops a package manager Role, which allows you to get the libraries you need for the program in one click. A repository is supported to host libraries crates.io.

All innovations:

  • In the rustc compiler provided support for optimization based on code profiling results (PGO, Profile-Guided Optimization),
    allowing you to generate more optimal code based on the analysis of statistics accumulated during program execution. To generate a profile, the “-C profile-generate” flag is provided, and to use the profile during assembly - “-C profile-use” (initially, the program is assembled with the first flag, runs around, and after creating the profile, it is reassembled with the second flag);
  • When executing the “cargo run” command, which is convenient to use for quickly testing console applications, the ability to automatically select an executable file to run has been added if there are several executable files in the package. The default file to be executed is determined through the default-run directive in the [package] section with package parameters, which allows you to avoid explicitly specifying the file name through the “-bin” flag each time you run “cargo run”;
  • The “cargo vendor” command, previously supplied as separate package. The command allows you to organize work with a local copy of dependencies - after executing “cargo vendor”, all source codes of the project’s dependencies are downloaded from crates.io to a local directory, which can then be used for work without accessing crates.io (after executing the command, a hint for changing the configuration is shown to use the directory for builds). This feature is already used to organize the delivery of the rustc compiler with packaging of all dependencies in one archive with the release;
  • It is now possible to create links to enum options using type aliases (for example, in the body of the function “fn increment_or_zero(x: ByteOption) you can specify “ByteOption::None => 0”), type calculation constructs (‹MyType‹.. ››::option => N) or Self accesses (in blocks c &self you can specify “Self::Quarter => 25”);
  • Added the ability to create unnamed constants in macros. Instead of defining the element name in "const", you can now use the "_" character to dynamically select a non-repeating identifier, avoiding name conflicts when calling the macro again;
  • Added the ability to use the "#[repr(align(N))" attribute with enums using a syntax similar to defining an AlignN‹T› structure with alignment and then using AlignN‹MyEnum›;
  • A new portion of the API has been moved to the stable category, including the BufReader::buffer, BufWriter::buffer, and
    Cell::from_mut,
    Cell::as_slice_of_cells,
    DoubleEndedIterator::nth_back,
    Option::xor
    {i,u}{8,16,64,128,size}::reverse_bits, Wrapping::reverse_bits and
    slice::copy_within.

Additionally, it can be noted start testing project Async-std, which offers an asynchronous variant of the Rust standard library (a port of the std library, in which all interfaces are offered in an async version and are ready for use with the async/await syntax).

Source: opennet.ru

Add a comment