# Rustのborrow checkerに11年前から潜むunsoundnessバグが発見される

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

> Hacker News story 50069499 · language: ja · submitted 2026-10-13
> Web version: https://zeli.app/ja/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

Rustのborrow checkerに、少なくとも1.4以降から存在するunsoundnessの脆弱性がGitHub issue #164250で報告された。structのlifetime要件がcovariantなフィールド代入によって回避され、use-after-freeやメモリ解放後の参照が発生する。複数の再現コードが示され、型システムの根本的な問題としてP-highの優先度で修正が進められている。

## Key quote

> 私のバージョンのコードは1.18.0（2017年）以来ずっとコンパイルされてきた。一体どうしてこれが今まで見つからなかったのか？？？

## HN discussion (424 comments)

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

> 型システムは難しい！ https://counterexamples.org/ を見てみて。
>
> Rustの例をざっと探してみたけど、以下のページに11個のサンプルがある：
>
> 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
>
> いつも最初に探すのは可変性（他のトリッキーな機能と組み合わさったもの）だ。例えば「今は Just(3):Maybe<Int>、今は Nothing:Maybe<Int>、今は Nothing:Maybe<String>」みたいなやつ。
>
> TFAの例が可変性なしで再現できるか気になる。

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

> このバグがこんなに長い間見過ごされてきたのは驚きだが、少なくとも修正は簡単だ。型システム自体のバグではなく、単にコンパイラのバグだからね。コンパイラはRustの型システムのライフタイム規則に従って、常にこのコードを拒否すべきだった。だから修正は、ライフタイムの根本的な規則を変えるのではなく、単にこのコードを拒否するようにするだけで済む。

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

> これは注目に値するが、それほど珍しいことでもない。現在、unsoundとラベル付けされたissueが100以上ある。中には長年放置されているものもあるが、私の理解では、新しいtrait solverがいくつかの修正のブロックを解除するだろう（ただし、おそらくOPのものではない）。

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

> 皮肉なことに、AIベースのRustコンパイラのバグ探索は、こうしたものをさらに見つける可能性が高く、Rustを完全な信頼性にどんどん近づけていく。
>
> 最終的にはRustの形式化と、形式的に証明されたコンパイラの作成が、このプロセスの終着点になるだろう。

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

> こういうのは、実際のコードに影響があるかどうかを気にせず、落とし穴として振りかざされることが多い気がする。
>
> このバグを修正することで、実際にコンパイルできなくなるクレートが出るかどうかは興味深い。

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

> 問題は、もしRustがRustを使っていたら、これは防げたのか？ということだ。

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

> これはLLMがやったのか？という疑問がある。最近、こうしたバグ報告をよく見るからね。

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

> かつてvariance関連のlintに携わったことがあるが、恐ろしいのは、誰も手でvarianceを書かないことだ。だからそこにあるバグは十年間テストされずに放置される。

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

> Rustがメモリ不足をもっと普通のエラーのように優雅に扱ってくれたらいいのに。

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

> こういうのに対する感情的な反応は本当に奇妙だ。そう、ソフトウェアにはバグがある、驚きだね。だからといって静的保証が無意味だとか、CでYOLOし続けるべきだということにはならない。

---

## Cite

- Page: https://zeli.app/ja/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

- en: https://zeli.app/story/50069499 · markdown: https://zeli.app/story/50069499.md
- zh: https://zeli.app/zh/story/50069499 · markdown: https://zeli.app/zh/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
