Explore the intricacies of constant evaluation in Rust with this RustConf 2019 talk by Oliver Schneider. Delve into the new theoretically unrestricted constant evaluator in rustc, nicknamed Miri (MIR interpreter), and discover its potential for complex static initializations, microcontroller programming, and runtime code reduction. Learn about the grading of constant evaluators, necessary and unnecessary restrictions, and the challenges of heap allocations. Examine practical examples, including String implementations and unsafe operations in constants, while understanding the stricter rules applied at compile-time. Gain insights into compile-time undefined behavior, const assertions on stable Rust, and even witness a Fibonacci sequence calculated at compile-time. Perfect for Rust developers seeking to push the boundaries of constant evaluation and optimize their code.
Taking Constant Evaluation to the Limit - RustConf 2019