Rust 1.94 Release. Experimenting with Rust in the FreeBSD Kernel. Turso Database and VCAD in Rust

The Rust 1.94 programming language, founded by the Mozilla project but now developed under the auspices of the independent non-profit Rust Foundation, has been released. The language focuses on memory safety and provides tools for achieving high parallelism of task execution, while doing without the use of a garbage collector and runtime (the runtime is reduced to basic initialization and maintenance of the standard library).

Rust's memory management methods are designed to eliminate errors in pointer manipulation and protect against issues arising from low-level memory management, such as accessing memory after it has been freed, dereferencing null pointers, buffer overruns, and so on. The project is developing the Cargo package manager to distribute libraries, facilitate builds, and manage dependencies. The crates.io repository is maintained for hosting libraries.

Memory safety is provided in Rust at compile time through reference checking, keeping track of object ownership, keeping track of object lifetimes (scopes), and assessing the correctness of memory access during code execution. Rust also provides protection against integer overflows, requires mandatory initialization of variable values ​​before use, handles errors better in the standard library, applies the concept of immutable references and variables by default, offers strong static typing to minimize logical errors.

Main innovations:

  • The slice type now has an array_windows method. This method creates an iterator for traversing slices in fixed-size windows that advance one element at a time. Unlike the previously available windows method, array_windows operates on a constant window size and returns a reference to a fixed-size array (&[T; N]) instead of a slice of undefined size (&[T]) for each iteration. Since the array size is initially known to the compiler, performance can be improved by avoiding bounds checking at each iteration stage. let slice = [0, 1, 2, 3]; let mut iter = slice.array_windows(); assert_eq!(iter.next().unwrap(), &[0, 1]); assert_eq!(iter.next().unwrap(), &[1, 2]); assert_eq!(iter.next().unwrap(), &[2, 3]); assert!(iter.next().is_none());
  • The Cargo package manager's configuration files (.cargo/config.toml) implement the "include" directive, which allows you to in-place insert the contents of other files. include = [ "frodo.toml", "samwise.toml", ] include = [ { path = "required.toml" }, { path = "optional.toml", optional = true }, ]
  • Support for the new version of the TOML 1.1 markup language has been added to manifest and configuration files. This new version adds support for multi-line embedded tables, the "\xHH" escape sequence for inserting hexadecimal byte representations, and the "\e" escape sequence for "\u001B," along with the ability to leave a trailing comma at the end of the last element and omit seconds in time values. serde = { version = "1.0", features = ["derive"] } can now be replaced with serde = { version = "1.0", features = ["derive"], }
  • A new portion of the API has been moved to the category of stable, including the methods and implementations of traits have been stabilized:
    • <[T]>::array_windows
    • <[T]>::element_offset
    • LazyCell::get
    • LazyCell::get_mut
    • LazyCell::force_mut
    • LazyLock::get
    • LazyLock::get_mut
    • LazyLock::force_mut
    • impl TryFrom for use
    • std::iter::Peekable::next_if_map
    • std::iter::Peekable::next_if_map_mut
    • Intrinsics for x86 avx512fp16 instructions
    • Intrinsics for AArch64 NEON fp16 instructions
    • f32::consts::EULER_GAMMA
    • f64::consts::EULER_GAMMA
    • f32::consts::GOLDEN_RATIO
    • f64::consts::GOLDEN_RATIO
  • The "const" sign is used in functions:
    • f32::mul_add
    • f64::mul_add
  • The riscv64im-unknown-none-elf platform has been moved to support level 3. Support level 3 includes basic support, but does not include automated testing, official build releases, or build verification.

Additionally, we'd like to highlight recently announced projects and events related to Rust:

  • Ayrton MuΓ±oz, who implemented support for the Sony PlayStation 1 platform in the Rust compiler and ported FreeBSD to computers with Apple Silicon chips, has implemented the ability to write kernel components and device drivers in Rust for FreeBSD. A set of KPI (Kernel Programming Interface) bindings enabling the use of Rust code in the FreeBSD kernel has been provided for testing, along with the virtio sound driver (virtio_snd), the DockChannel HID driver for the M2 MacBook keyboard, and several low-level drivers for Mac computer subsystems on Apple Silicon chips, all created using these bindings.

    Work on the Rust bindings has been ongoing since late 2024. Currently, the bindings only implement a portion of the C-KPIs and are considered unstable, but over time, they plan to improve their stability to match that of a similar interface for the C language. The virtio_snd driver, proposed as an example, is suitable for playing music in QEMU. It is expected that by 2026, the Rust bindings will be sufficiently stable for interested developers to begin using them for writing code.

  • NetBSD developer Benny Siegert offered a rationale for why Rust support will not appear in the NetBSD kernel: NetBSD supports architectures for which Rust is not available; maintaining the existing Rust toolchain in pkgsrc is a significant effort and is supported by only a few developers; kernel support for Rust requires the Rust compiler to be included in the base system; bootstrapping Rust on NetBSD uses a legacy binary package, which is unacceptable for self-contained distributions distributed as source; Rust's release cycles are incompatible with NetBSD's development and support cycles for legacy branches (for example, NetBSD 9, released in 2020, continues to be supported, which would require shipping and supporting a six-year-old Rust compiler).
  • ΠžΠΏΡƒΠ±Π»ΠΈΠΊΠΎΠ²Π°Π½ выпуск встраиваСмой Π² прилоТСния Π‘Π£Π‘Π” Turso 0.5, написанной Π½Π° языкС Rust ΠΈ совмСстимой с SQLite Π½Π° ΡƒΡ€ΠΎΠ²Π½Π΅ Π΄ΠΈΠ°Π»Π΅ΠΊΡ‚Π° SQL, Ρ„ΠΎΡ€ΠΌΠ°Ρ‚Π° Ρ„Π°ΠΉΠ»ΠΎΠ² Π‘Π” ΠΈ C API. Из Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½Π½Ρ‹Ρ… возмоТностСй отмСчаСтся ΠΌΠ΅Ρ…Π°Π½ΠΈΠ·ΠΌ CDC (Change data capture) для отслСТивания измСнСния Π‘Π” Π² Ρ€Π΅Π°Π»ΡŒΠ½ΠΎΠΌ Π²Ρ€Π΅ΠΌΠ΅Π½ΠΈ, использованиС io_uring для асинхронного Π²Π²ΠΎΠ΄Π°/Π²Ρ‹Π²ΠΎΠ΄Π° Π² Linux, ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅ΠΊΡ‚ΠΎΡ€Π½ΠΎΠ³ΠΎ поиска, Π½Π°Π»ΠΈΡ‡ΠΈΠ΅ выраТСния ALTER для измСнСния схСмы Π‘Π”, Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ ΡˆΠΈΡ„Ρ€ΠΎΠ²Π°Π½ΠΈΡ Π΄Π°Π½Π½Ρ‹Ρ… Π² Π‘Π”, Ρ€Π΅ΠΆΠΈΠΌ ΠΈΠ½ΠΊΡ€Π΅ΠΌΠ΅Π½Ρ‚Π°Π»ΡŒΠ½Ρ‹Ρ… вычислСний, конструкция Β«BEGIN CONCURRENTΒ».
  • A project to enable the use of the Rust standard library in GPU-side programs.
  • Emuko β€” эмулятор RISC-V, написанный Π½Π° Rust, способный Π·Π°Π³Ρ€ΡƒΠΆΠ°Ρ‚ΡŒ Linux, ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°ΡŽΡ‰ΠΈΠΉ JIT-ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡ†ΠΈΡŽ, способный ΡΠΎΡ…Ρ€Π°Π½ΡΡ‚ΡŒ ΠΈ Π²ΠΎΡΡΡ‚Π°Π½Π°Π²Π»ΠΈΠ²Π°Ρ‚ΡŒ ΡΠ½Π°ΠΏΡˆΠΎΡ‚Ρ‹ состояния.
  • RustConn (flatpak) is a graphical interface for managing external network connections to other hosts, supporting SSH, RDP, VNC, SPICE, Telnet, Serial, Kubernetes, Zero Trust, and SFTP. The code is written in Rust using GTK4 and Wayland.
  • A new branch of the zlib-rs 0.6 project has been released, marking it as the first stable version fully compatible with the zlib C API and suitable for a transparent replacement for zlib. The project aims to create a secure alternative to the zlib data compression library. Development is being conducted with an eye on the zlib-ng project, which develops a high-performance variant of zlib.
  • The VCAD project is a development of a parametric computer-aided design (CAD) system written in Rust and integrated with AI agents using the MCP protocol. It supports 3D modeling, simulation, 2D sketching, component assembly, STEP import, and STL/GLB/STEP/DXF export.
  • A speech recognition system written in Rust and using the Mistral Voxtral Mini 4B Realtime AI model and the Burn machine learning framework has been published. The project focuses on on-the-fly speech recognition for live streaming transcription.
  • The c2rust 0.22 toolkit has been released. It is designed for translating C code (C99) into an unsafe Rust representation, similar in structure to the original C code. The resulting working framework can be used for gradual migration to idiomatic Rust and the removal of unsafe blocks.

Source: opennet.ru

Buy reliable hosting for sites with DDoS protection, VPS VDS servers πŸ”₯ Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster