TL;DR
Prime made for students and young adults
- Fast, free delivery for dorm and study essentials
- Prime Video and Amazon Music included
- Member-only deals
A report filed in the Rust repository describes an 11-year-old type-system unsoundness that can let a program compile despite a reference outliving its data. The report says the example works on current nightly and at least as far back as Rust 1.85.0; triggering memory unsafety requires an intentionally malicious Drop implementation, according to a Rust team member.
A Rust issue report has exposed an 11-year-old type-system soundness bug that can allow code containing a reference to expired data to compile. The report says its example runs on current nightly and stable versions back to at least 1.85.0; a Rust team member says exploiting it to cause memory unsafety requires an intentionally malicious Drop implementation.
The report, filed in the Rust project’s GitHub repository as issue 164250, gives a minimal program that stores a reference in a value with a custom destructor. That destructor moves the reference into a global collection when the value is dropped, allowing it to outlive the local string it points to. The reporter expected Rust to reject the program, but says it compiles and prints text from a later string occupying the same stack area.
The report says the example triggers an AddressSanitizer stack-use-after-scope error when run with the sanitizer. It also links to demonstrations with and without AddressSanitizer. These details describe the supplied reproducer; they do not establish how often the issue has affected real programs or whether it has been exploited outside a demonstration.
In a note on the issue, Rust contributor @lcnr described the bug as a high-priority type-system issue. The contributor said it would be critical regardless of whether it had been encountered in real use, but explained the high-priority rating in part by the bug’s age and the difficulty of reaching it. They also said it was very likely the flaw had not caused accidental memory unsafety, because exploitation requires a malicious destructor.
Why a Borrow-Checking Gap Matters
Rust relies on its ownership and borrowing rules to prevent invalid memory access in safe code. A soundness flaw that lets a reference escape the lifetime of its data matters because it challenges that safety guarantee, even if the triggering conditions are unusual. Developers and maintainers need to determine the scope of the flaw and whether any existing code could reach it.
The reported example hinges on a custom destructor that deliberately retains a reference. That condition narrows the immediate risk described by the contributor, but does not make the underlying type-system issue irrelevant. The distinction is important: the report demonstrates a path to unsound behavior, while the available source does not document an in-the-wild incident or show that ordinary programs are affected.
The issue also highlights the maintenance challenge of compiler guarantees. A bug can remain unnoticed for years and still warrant prompt investigation once a reproducible case is reported. The Rust team says resolving type-system unsoundness and strengthening the system’s foundations are ongoing priorities.
Popular right now

Samsung QN65LS03FAFXZA 65 The Frame QLED 4K Art Mode Vision AI Smart TV (2025)

Ninja Mega Kitchen System Blender and Food Processor, 1500W, 72-oz Pitcher, 8-Cup Bowl, Black (BL770)

Apple AirPods Pro 3 Wireless Earbuds with Active Noise Cancellation
As an affiliate, we earn on qualifying purchases.
How the Report Reaches a Dangling Reference
The reproducer defines a generic type whose Drop implementation takes its stored value and places it in a global, mutex-protected vector. In the example, the stored value is a reference to a local String. The local string goes out of scope, but the destructor has moved its reference into storage that remains available later.
The program then creates another string and reads through the retained reference. The report says this prints the later string’s contents without AddressSanitizer, while the sanitizer detects access beyond the original value’s lifetime. The discrepancy illustrates why a program compiling successfully is not, by itself, proof that every accepted program is memory-safe.
The issue note says the Rust project is working on efforts including a next-generation trait solver, a region-constraint rework, and Project Zero. The contributor presents these as part of broader work to address type-system soundness, rather than as fixes already delivered for this specific bug.
“This bug is a P-high issue and would have been P-critical regardless of whether people encountered it in the wild.”
— Rust contributor @lcnr, in a note on GitHub issue 164250
Scope and Fix Status Remain Open
The supplied material does not state whether a fix has been merged, which release will contain one, or whether maintainers have completed an assessment of affected compiler versions. It identifies current nightly and stable versions back to at least 1.85.0 as reproducing the example, but does not establish the full version range or whether earlier releases are affected.
It is also unclear whether the flaw has caused memory unsafety in a real application. The Rust contributor said accidental harm was very unlikely and described malicious destructor behavior as necessary for exploitation; the source does not provide an independent audit or incident investigation confirming that assessment. The issue report is evidence of a reproducible problem, not evidence of widespread exposure.
Maintainers Must Confirm the Remediation
The next steps are for Rust maintainers to investigate the reproducer, determine the precise scope, and develop and test a correction. The issue’s priority indicates that the project treats the problem seriously, but the source material does not give a target date, a patch, or a release plan.
Users should follow issue 164250 and subsequent Rust project announcements for confirmed guidance, including any affected-version list or recommended upgrade. Until maintainers publish those details, the report supports a clear conclusion about the demonstrated compiler behavior but not a broader claim about the prevalence of risk or the timing of a fix.
Key Questions
What did the Rust issue report?
It reports a type-system soundness bug that can let a program compile even though a reference is retained after the referenced local value goes out of scope.
Which Rust versions are reported to reproduce the example?
The issue says it reproduces on current nightly and stable versions back to at least 1.85.0. The supplied material does not establish the complete range of affected versions.
Does the report show that Rust users have been harmed?
No real-world incident is documented in the supplied material. A Rust contributor said accidental memory unsafety was very unlikely and that exploitation requires an intentionally malicious Drop implementation.
Has Rust released a fix?
The source material does not say that a fix has been merged or released, and it gives no remediation timetable. The issue’s status and later project updates should be checked for confirmed details.
Source: hn
