Release of Rust 1.53. Google will fund adding Rust support to the Linux kernel.

The release of the Rust programming language 1.53 has been published, originally based on the Mozilla project, but now developed under the auspices of the independent non-profit organization Rust Foundation. The language focuses on safe memory handling, provides automatic memory management, and offers means for achieving high parallelism in task execution without relying on a garbage collector and runtime (runtime is limited to basic initialization and support for the standard library).

Automatic memory management in Rust frees developers from errors when manipulating pointers and protects against issues arising from low-level memory work, such as accessing memory after it has been freed, dereferencing null pointers, buffer overflows, etc. To facilitate library distribution, building, and dependency management, the Cargo package manager is being developed. Libraries are supported through the crates.io repository.

Key innovations:

  • The IntoIterator trait has been implemented for arrays, allowing for element iteration by value: for i in [1, 2, 3] { .. }

    It is now also possible to pass arrays to methods that accept iterators, for example: let set = BTreeSet::from_iter([1, 2, 3]); for (a, b) in some_iterator.chain([1]).zip([1, 2, 3]) { .. }

    Previously, IntoIterator was implemented only for references to arrays, meaning that iteration by value required using references (‘&[1, 2, 3]’) or ‘[1, 2, 3].iter()’. The implementations of IntoIterator for arrays were hindered by compatibility issues caused by an earlier transformation in the compiler from array.into_iter() to (&array).into_iter(). These issues have been resolved in a roundabout way — the compiler will continue to transform array.into_iter() to (&array).into_iter() as if the IntoIterator implementation were absent, but only when invoking the method using the syntax ‘.into_iter()’ and not affecting calls of the form ‘in [1, 2, 3]’, ‘iter.zip([1, 2, 3])’, ‘IntoIterator::into_iter([1, 2, 3])’.

  • It is now possible to specify expressions ‘|’ (logical OR operation) in any part of the pattern, for example, instead of ‘Some(1) | Some(2)’ you can now write ‘Some(1 | 2)’: match result { Ok(Some(1 | 2)) => { .. } Err(MyError { kind: FileNotFound | PermissionDenied, .. }) => { .. } _ => { .. } }
  • Usage of non-ASCII characters in identifiers is allowed, including any national characters defined in the Unicode UAX 31 specification, but excluding emoji characters. When using different but visually similar characters, the compiler will emit a warning. const BLÅHAJ: &str = «🦈»; struct 人 { 名字: String, } let α = 1; let sos = 2; warning: identifier pair considered confusable between ‘s’ and ‘s’
  • A new batch of the API has been promoted to stable, including the stabilization of:
    • array::from_ref
    • array::from_mut
    • AtomicBool::fetch_update
    • AtomicPtr::fetch_update
    • BTreeSet::retain
    • BTreeMap::retain
    • BufReader::seek_relative
    • cmp::min_by
    • cmp::min_by_key
    • cmp::max_by
    • cmp::max_by_key
    • DebugStruct::finish_non_exhaustive
    • Duration::ZERO
    • Duration::MAX
    • Duration::is_zero
    • Duration::saturating_add
    • Duration::saturating_sub
    • Duration::saturating_mul
    • f32::is_subnormal
    • f64::is_subnormal
    • IntoIterator for arrays
    • {integer}::BITS
    • io::Error::Unsupported
    • NonZero*::leading_zeros
    • NonZero*::trailing_zeros
    • Option::insert
    • Ordering::is_eq
    • Ordering::is_ne
    • Ordering::is_lt
    • Ordering::is_gt
    • Ordering::is_le
    • Ordering::is_ge
    • OsStr::make_ascii_lowercase
    • OsStr::make_ascii_uppercase
    • OsStr::to_ascii_lowercase
    • OsStr::to_ascii_uppercase
    • OsStr::is_ascii
    • OsStr::eq_ignore_ascii_case
    • Peekable::peek_mut
    • Rc::increment_strong_count
    • Rc::decrement_strong_count
    • slice::IterMut::as_slice
    • AsRef<[T]> for slice::IterMut
    • impl SliceIndex for (Bound<usize>, Bound<usize>)
    • Vec::extend_from_within
  • The third level of support for the wasm64-unknown-unknown platform has been implemented. The third level implies basic support, but without automated testing, publishing official builds, and verifying the ability to build code.
  • The Cargo package manager has by default switched to using the name "main" for the primary branch of the Git repository (HEAD). For dependencies hosted in repositories using the name main instead of master, it's no longer necessary to specify in the settings branch = "main".
  • The requirements for the minimum LLVM version in the compiler have been raised to LLVM 10.

Additionally, it is worth noting the funding provided for the development of integration into the Linux kernel for components written in Rust. The work will be carried out within the Prossimo project under the auspices of the ISRG (Internet Security Research Group), which is the founder of the Let’s Encrypt project and promotes HTTPS and the development of technologies to enhance internet security. The funding will be provided by Google, which will pay Miguel Ojeda, the author of the Rust-for-Linux project. Previously, ISRG and Google have already funded the creation of an alternative HTTP backend for the curl utility and the development of a new TLS module for the Apache HTTP server.

According to Microsoft and Google, around 70% of vulnerabilities are caused by unsafe memory operations. It is believed that using the Rust programming language for developing core components, such as device drivers, will reduce the risk of vulnerabilities arising from unsafe memory handling, eliminating issues like accessing memory after it has been freed and buffer overflows.

Safe memory handling in Rust is ensured at compile time through reference checking, ownership tracking of objects, and considerations of object lifetimes (scope), as well as runtime checks for correctness in memory access. Rust also provides protections against integer overflows, requires variables to be initialized before use, manages errors more effectively in the standard library, employs immutability by default for references and variables, and offers strong static typing to minimize logical errors.

Source: opennet.ru

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