Rust 1.98 miscompilation: null vtable entry triggers segfault
Rust 1.98.0 emits a zero vtable entry for boxed async Service dispatch, causing segfaults in safe code; workaround and related rustc issues detailed.
A critical miscompilation in Rust 1.98.0 has been reported where compiler-generated vtables for boxed dyn Service trait objects contain a zero-valued method slot. Safe Rust code dispatching through that entry crashes with a segmentation fault at address zero.
The bug was reliably reproduced on aarch64-apple-darwin using the rama networking library: identical source code works correctly on Rust 1.97.1 and nightly-2026-07-16, but crashes specifically on the 1.98.0 stable release during a CONNECT request. The likely root cause is that async trait dispatch predicates are incorrectly evaluated as impossible, causing the method to resolve to VtblEntry::Vacant instead of a valid function pointer — a pattern possibly linked to previously reported rustc issues (#152735, #153596, #158148).
A workaround exists: replacing the BoxService abstraction with a manually type-erased Arc<dyn Fn>-based future call avoids the vacant slot. This is a serious concern for any codebase relying on dynamic dispatch of async trait methods for type erasure, and the community is pushing for a fix in a potential 1.98.1 patch release.
This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work