Published the release of the system programming language Rust 1.58, based on the Mozilla project, but now developed under the auspices of an independent non-profit organization RUST FOUNDATION. Language is focused on safe memory operation, provides automatic memory management and provides tools to achieve high parallelism to perform tasks, while paying without using garbage collector and runTime (Runtime is reduced to the basic initialization and support of the standard library).
Automatic memory management in RUST eliminates the developer from errors when manipulating pointers and protects against problems arising from low-level memory work, such as referring to the memory area after its release, making zero pointers, output beyond the borders of the buffer, etc. P. To disseminate libraries, ensuring the assembly and management of the project, the Cargo batch manager is developing. To place libraries, the repository crates.io .
Basic innovations :
- In the string formatting blocks, in addition to the previously available feature features are clearly listed after the variables in the number and name, the possibility of substituting arbitrary identifiers through the addition of the “{identifier” expression string is implemented.
For example: // previously supported designs: PrintLN! (“Hello, {}!”, Get_person ()); PrintLN! (“Hello, {0}!”, Get_person ()); PrintLN! (“Hello, {Person}!”, person = get_person ()); // Now you can specify Let Person = get_person (); PrintLN! (“Hello, {Person}!”);Identifiers can also be specified directly in the formatting parameters.
Letth (Width, Precision) = get_format (); For (Name, Score) in Get_SCores () {PrintLN! (“{name}: {Score: Width $ .Precision $}”); }
The new substitution works in all macros supporting the definition of a string format, with the exception of the macro “PANIC!” In versions of the RUST 2015 and 2018 language, in which Panic! (“{Ident}”) is processed as a regular string (in Rust 2021, the substitution is triggered).
- changed the behavior of the STD :: Process :: Command on the Windows platform, which, when executing commands, no more executable files in the current directory are no longer searched for. The current directory is excluded as it can be used to organize the execution of an attacker code in case of launch of programs in non-credible directories ( CVE-2021 -3013 ). The new logic for defining executable files implies search in the RUST directories, in the application directory, the Windows system directory and directories specified in the PATH environment variable.
- in the standard library Expanded The number of functions marked “# [Must_use]” for warning output In case of ignoring the returned value, which helps to identify errors caused by the assumption that the function will change the values, and will not return a new value.
- In the category of stable, a new portion of the API is translated, including stabilized methods and implementations of the type:
- Metadata :: is_symlink
- Path :: is_symlink
- {integer} :: Saturating_div
- option :: unwrap_unchecked
- Result :: unwrap_unchecked
- Result :: unwrap_err_unchecked