June 27th, 2024

The Inconceivable Types of Rust: How to Make Self-Borrows Safe

The article addresses Rust's limitations on self-borrows, proposing solutions like named lifetimes and inconceivable types to improve support for async functions. Enhancing Rust's type system is crucial for advanced features.

Read original articleLink Icon
The Inconceivable Types of Rust: How to Make Self-Borrows Safe

The article discusses the limitations of Rust regarding self-borrows and the challenges in supporting them within the borrow checker. It explores the idea of enabling self-borrows and safe async functions in Rust by addressing issues related to naming types of local variables, unnameable types, and inconceivable types. The proposal suggests introducing named lifetimes to allow explicit naming of function local lifetimes, enhancing static checking without runtime impact. Additionally, it delves into the concept of inconceivable types, which are types not formally recognized by Rust's type system but play a role in shadow type checking. The article highlights the need to incorporate these inconceivable types, such as partial moves and borrows, into Rust's formal type system to enable better support for async functions and self-borrows. The discussion emphasizes the importance of addressing these challenges to enhance Rust's type system and support advanced features like safe async functions effectively.

Related

Binrw

Binrw

The tool binrw simplifies binary parsing and serialization with a declarative approach, offering readability and maintainability. It supports common tasks, generics, custom parsers, predefined types, and is safe for various environments.

My experience crafting an interpreter with Rust (2021)

My experience crafting an interpreter with Rust (2021)

Manuel Cerón details creating an interpreter with Rust, transitioning from Clojure. Leveraging Rust's safety features, he faced challenges with closures and classes, optimizing code for performance while balancing safety.

SquirrelFS: Using the Rust compiler to check file-system crash consistency

SquirrelFS: Using the Rust compiler to check file-system crash consistency

The paper introduces SquirrelFS, a crash-safe file system using Rust's typestate pattern for compile-time operation order enforcement. Synchronous Soft Updates ensure crash safety by maintaining metadata update order. SquirrelFS offers correctness guarantees without separate proofs, quickly verifying crash consistency during compilation. Comparative evaluations show SquirrelFS performs similarly or better than NOVA and WineFS.

Download Accelerator – Async Rust Edition

Download Accelerator – Async Rust Edition

This post explores creating a download accelerator with async Rust, emphasizing its advantages over traditional methods. It demonstrates improved file uploads to Amazon S3 and provides code for parallel downloads.

Elixir Anti-Patterns

Elixir Anti-Patterns

The document discusses code-related anti-patterns in Elixir v1.18.0-dev, highlighting issues like comments overuse, complex 'with' expressions, dynamic atom creation, long parameter lists, and namespace conventions. It provides examples and refactoring suggestions to improve code quality and maintainability.

Link Icon 0 comments