Rust struct lifetime requirements can be bypassed through covariant field assignment
The issue’s author reports that an example compiles but crashes under AddressSanitizer with a stack-use-after-scope error.
TLDR
A Rust contributor reports that assigning a short-lived reference to a struct field can bypass the struct’s lifetime requirements. Their example compiles when they expected it to be rejected; it prints overwritten data, or crashes under AddressSanitizer. The open issue is labeled an unsound, high-priority bug. Another contributor says a related example has produced crashes or printed freed memory since Rust 1.4.
Combined views
—
First seen ago
— likes— comments— saves— reposts