Release of Rust 1.91

The release of the Rust programming language 1.91, originally based on the Mozilla project and now developed under the auspices of the independent non-profit organization Rust Foundation, has been announced. The language is focused on safe memory management and provides tools for achieving high parallelism in task execution, while avoiding the use of garbage collection and runtime (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 for 64-bit ARM systems running Windows has been improved. The target platform "aarch64-pc-windows-msvc" has been upgraded from second-level to first-level support. Second-level support has been provided for the architectures aarch64-pc-windows-gnullvm and x86_64-pc-windows-gnullvm. First-level support implies the creation of binary builds, thorough testing, and the highest guarantee of platform support—every change in the compiler is verified by running the complete test suite. Second-level support includes creating binary builds and guarantees builds, but does not ensure passing the test suite. Third-level support covers basic support but lacks automated testing, publication of official builds, and verification of code compilation feasibility.
  • A lint warning "dangling_pointers_from_locals" has been added to detect functions returning dangling raw pointers that point to data stored in local variables defined in the called function. Such variables are removed after the function completes, and raw pointers to data associated with these variables become dangling, i.e., pointing to freed memory. Subsequent dereferencing of such a pointer leads to undefined behavior. fn f() -> *const u8 { let x = 0; &x // warning: a dangling pointer will be produced because the local variable "x" will be dropped }
  • A lint warning "integer_to_ptr_transmutes" has been added, alerting about the conversion of integers to pointers using the std::mem::transmute function.
  • In the Cargo package manager, support for the parameter "build.build-dir" has been stabilized, defining the directory for storing temporary build artifacts created by cargo and rustc during the build process.
  • Support for declaring functions with a variable number of arguments in C style has been stabilized for ABI sysv64, win64, efiapi, and aapcs.
  • Support for inline assembly for the LoongArch32 architecture has been stabilized.
  • A new batch of APIs has been promoted to stable, including stabilized methods and trait implementations:
    • Path::file_prefix
    • AtomicPtr::fetch_ptr_add
    • AtomicPtr::fetch_ptr_sub
    • AtomicPtr::fetch_byte_add
    • AtomicPtr::fetch_byte_sub
    • AtomicPtr::fetch_or
    • AtomicPtr::fetch_and
    • AtomicPtr::fetch_xor
    • {integer}::strict_add
    • {integer}::strict_sub
    • {integer}::strict_mul
    • {integer}::strict_div
    • {integer}::strict_div_euclid
    • {integer}::strict_rem
    • {integer}::strict_rem_euclid
    • {integer}::strict_neg
    • {integer}::strict_shl
    • {integer}::strict_shr
    • {integer}::strict_pow
    • i{N}::strict_add_unsigned
    • i{N}::strict_sub_unsigned
    • i{N}::strict_abs
    • u{N}::strict_add_signed
    • u{N}::strict_sub_signed
    • PanicHookInfo::payload_as_str
    • core::iter::chain
    • u{N}::checked_signed_diff
    • core::array::repeat
    • PathBuf::add_extension
    • PathBuf::with_added_extension
    • Duration::from_mins
    • Duration::from_hours
    • impl PartialEq<str> for PathBuf
    • impl PartialEq<String> for PathBuf
    • impl PartialEq<str> for Path
    • impl PartialEq<String> for Path
    • impl PartialEq<PathBuf> for String
    • impl PartialEq<Path> for String
    • impl PartialEq<PathBuf> for str
    • impl PartialEq<Path> for str
    • Ipv4Addr::from_octets
    • Ipv6Addr::from_octets
    • Ipv6Addr::from_segments
    • impl<T> Default for Pin<Box<T>> where Box<T>: Default, T: ?Sized
    • impl<T> Default for Pin<Rc<T>> where Rc<T>: Default, T: ?Sized
    • impl<T> Default for Pin<Arc<T>> where Arc<T>: Default, T: ?Sized
    • Cell::as_array_of_cells
    • u{N}::carrying_add
    • u{N}::borrowing_sub
    • u{N}::carrying_mul
    • u{N}::carrying_mul_add
    • BTreeMap::extract_if
    • BTreeSet::extract_if
    • impl Debug for windows::ffi::EncodeWide<‘_>
    • str::ceil_char_boundary
    • str::floor_char_boundary
    • impl Sum for Saturating<u{N}>
    • impl Sum<&Self> for Saturating<u{N}>
    • impl Product for Saturating<u{N}>
    • impl Product<&Self> for Saturating<u{N}>
  • The ‘const’ attribute has been applied in the functions:
    • <[T; N]>::each_ref
    • <[T; N]>::each_mut
    • OsString::new
    • PathBuf::new
    • TypeId::of
    • ptr::with_exposed_provenance
    • ptr::with_exposed_provenance_mut
  • The compiler has been updated to LLVM branch 21.

Source: opennet.ru

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