Published general purpose programming language release Rust 1.77, founded by the Mozilla project, but now developed under the auspices of the independent non-profit organization Rust Foundation. The language focuses on memory safety and provides a means to achieve high task parallelism without using garbage collector And runtime (runtime boils down to basic initialization and maintenance of the standard library).
Rust's memory management techniques free the developer from pointer manipulation errors and protect against problems arising from low-level memory manipulation, such as after-free accesses, null pointer dereferences, buffer overruns, and the like. A package manager is being developed to distribute libraries, ensure assembly and manage dependencies by the project. Cargo. A repository is supported to host libraries crates.io.
Memory safety is enforced in Rust at compile time through reference checking, object ownership tracking, object lifetime (scoping) consideration, and memory access evaluation at runtime. Rust also provides protection against integer overflows, requires that variable values be initialized before use, has better error handling in the standard library, uses the concept of immutable references and variables by default, and offers strong static typing to minimize logical errors.
Basic innovations:
- Added support for literals for C-strings (c”text”), which are stored in memory with a null-terminated character and associated with the type “CStr“It is expected that C-string support will simplify writing code that interacts with layers in programming languages that use null-terminated strings, and will allow necessary checks to be performed at the compilation stage.
const HELLO: &core::ffi::CStr = c"Hello, world!";
- In asynchronously executed functions declared using the expression “async fn”, the use of recursion is allowed, i.e. such functions can now call themselves.
async fn fib(n: u32) -> u32 { match n { 0 | 1 => 1, _ => Box::pin(fib(n-1)).await + Box::pin(fib(n-2)).await } } - Macro stabilized offset_of!, which allows you to determine the byte offset of the fields of structures, enumerations, unions and tuples, relative to the beginning of the type. In practice, a macro can be useful in situations where you need to work at the field offset level in the absence of an instance of the type. In particular, offset_of functionality is needed when developing low-level components such as drivers.
use std::mem; #(repr(C)) struct FieldStruct { first: u8, second: u16, third: u8 } assert_eq!(mem::offset_of!(FieldStruct, first), 0); assert_eq!(mem::offset_of!(FieldStruct, second), 2); assert_eq!(mem::offset_of!(FieldStruct, third), 4); - In the Cargo package manager, in release profiles, cleaning of files from debugging data is enabled by default (strip = “debuginfo”), unless debug mode is explicitly enabled in the Cargo profile, i.e. if parameter debug = 0).
- The option “-Zthir-unsafeck=on” is enabled by default. providing unsafe check for THIR (“Typed High-Level Intermediate Representation”).
- Added lint check static_mut_refs to warn when using references to mutable static values.
- Implemented the ability to use the “From‹&(T; N)›” type for the “Cow‹(T)›” type.
- The compiler provides alignment of the 16-byte i128 and u128 types for x86 systems.
- A new portion of the API has been transferred to the stable category, including the methods and implementations of traits:
array::each_refarray::each_mutcore::netf32::round_ties_evenf64::round_ties_evenmem::offset_of!slice::first_chunkslice::first_chunk_mutslice::split_first_chunkslice::split_first_chunk_mutslice::last_chunkslice::last_chunk_mutslice::split_last_chunkslice::split_last_chunk_mutslice::chunk_byslice::chunk_by_mutBound::mapFile::create_newMutex::clear_poisonRwLock::clear_poison
- Implemented third level of support for platforms aarch64-unknown-illumos hexagon-unknown-none-elf riscv32imafc-esp-espidf riscv32im-risc0-zkvm-elf . The third level involves basic support, but without automated testing, publishing official builds, or checking whether the code can be built.
Thanks for reading: