# Rust's borrow checker has been unsound since version 1.4, a new bug report reveals

Original title: 11 year old unsoundness bugs found in Rust borrow checker

> Hacker News story 50069499 · language: en · submitted 2026-10-13
> Web version: https://zeli.app/story/50069499
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 741 · by [formerly_proven](<https://news.ycombinator.com/user?id=formerly_proven>) · 💬 424
[original](<https://github.com/rust-lang/rust/issues/164250>) · [HN discussion](<https://news.ycombinator.com/item?id=50069499>)

## Summary

A GitHub issue filed by jsnell shows that Rust's lifetime requirements can be bypassed through covariant field assignment. A struct with a 'static bound can be handed a non-'static reference, letting Drop code treat a dangling pointer as valid. The bug compiles on stable releases back to 1.4, and ASan flags a stack-use-after-scope. Rust maintainers have labeled it I-unsound and P-high.

## Key quote

> My version of the code has been compiling ever since 1.18.0 (2017). How on earth was this not found before this???

## HN discussion (424 comments)

### [mrkeen](<https://news.ycombinator.com/item?id=50069883>)

> Type systems are hard!  Check out https://counterexamples.org/
>
> I gave it a quick scan for Rust examples; there are 11 samples among the following pages:
>
> https://counterexamples.org/eventually-nothing.html
>
> https://counterexamples.org/mutable-matching.html
>
> https://counterexamples.org/selfishness.html
>
> https://counterexamples.org/scope-escape.html
>
> https://counterexamples.org/nearly-universal.html
>
> The first thing I always look for is mutability (combined with some other tricky feature), e.g. "Now it's a Just(3):Maybe<Int>, now it's a Nothing:Maybe<Int>, now it's a Nothing:Maybe<String>."
>
> I wonder if TFA's example could be reproduced without mutability.

### [GrantMoyer](<https://news.ycombinator.com/item?id=50070882>)

> It's surprising this bug went unnoticed for so long, but at least it's easy to fix, since it's not a bug with the type system itself; it's just a bug in the compiler. The compiler should always have been rejecting that code according to lifetime rules of Rust's type system, so the fix is to just make it reject the code, rather than having to change the fundamental rules of lifetimes.

### [weinzierl](<https://news.ycombinator.com/item?id=50070471>)

> This is remarkable but not super unusual. There are more than 100 issues labeled unsound currently. Some are long standing but from what I understand the new trait solver will unblock fixes for some of them (but probably not the one in OP).

### [lambdaone](<https://news.ycombinator.com/item?id=50070224>)

> Perhaps ironically, AI-based searching of the Rust compiler for bugs is likely to find more of these, pushing Rust closer and closer to the point of complete reliability.
>
> The eventual formalization of Rust and a creation of a formally proven compiler is presumably going to be the end point of this process.

### [Eridrus](<https://news.ycombinator.com/item?id=50071964>)

> I feel like these things get waved around as gotchas without any sense for whether any real code is impacted.
>
> It will be interesting to see if fixing this bug actually causes any crates to not compile.

### [Surac](<https://news.ycombinator.com/item?id=50071860>)

> The question is. If rust used rust would that have prevented this?

### [sreekanth850](<https://news.ycombinator.com/item?id=50074835>)

> Was this done by LLM? this is a doubt. because recently we are seeing many such bug reports.

### [FuzzywarmWalnut](<https://news.ycombinator.com/item?id=50069792>)

> Worked on a variance-related lint once and the scary part is how rarely anyone writes down variance by hand, so bugs there just sit untested for a decade.

### [randyrand](<https://news.ycombinator.com/item?id=50071104>)

> I just wish Rust handled out of memory more gracefully like a normal error.

### [wat10000](<https://news.ycombinator.com/item?id=50072101>)

> The emotional reactions to this stuff are so weird. Yeah, software has bugs, what a surprise. That doesn't mean that static safety is useless or that we should all just continue YOLOing stuff in C.

---

## Cite

- Page: https://zeli.app/story/50069499
- Date: 2026-10-13
- Source: github.com (https://github.com/rust-lang/rust/issues/164250)
- Hacker News: https://news.ycombinator.com/item?id=50069499

## Other languages

- zh: https://zeli.app/zh/story/50069499 · markdown: https://zeli.app/zh/story/50069499.md
- ja: https://zeli.app/ja/story/50069499 · markdown: https://zeli.app/ja/story/50069499.md
- ko: https://zeli.app/ko/story/50069499 · markdown: https://zeli.app/ko/story/50069499.md
- de: https://zeli.app/de/story/50069499 · markdown: https://zeli.app/de/story/50069499.md
- es: https://zeli.app/es/story/50069499 · markdown: https://zeli.app/es/story/50069499.md
- ru: https://zeli.app/ru/story/50069499 · markdown: https://zeli.app/ru/story/50069499.md
