A developer discovered a genuine rustc miscompilation bug while refactoring a JavaScript engine parser written in Rust. The bug involved `bool as u32` casting producing incorrect assembly — the increment instruction was silently dropped when using `self.0 += x as u32` compared to the equivalent `if x { 1 } else { 0 }` form. By inspecting LLVM IR with `-Cno-prepopulate-passes` and MIR with `-Zmir-opt-level=0`, the author confirmed the bug was in Rust's MIR optimization layer. The issue was filed against rustc, labeled `p-critical` and `i-miscompile`, and a fix was merged within 18 hours — one of only 7 issues ever tagged with both labels in the entire rustc issue tracker.

10m read timeFrom parsa.wtf
Post cover image
457 Impressions