YouTube 影片筆記
Google 將 C++ 搬向 Rust,從記憶體安全到 AI 工具改寫的實例解析
原片標題:AI 時代,只能靠 Rust 了?
原片說明
這支片從記憶體安全講起,帶你看 Rust 到底是什麼、為什麼 AI 公司們逐漸改用 Rust。
⏱️ 章節
0:00 馬斯克的四個字
0:33 Rust 是什麼:記憶體安全
2:17 Rust 在 AI 用在哪裡
3:31 Rust、Python、Go、C++ 比一比
4:19 換成 Rust,漏洞真的變少了嗎?Android 和 Linux
5:13 AI 改寫程式的時代:Codex、Copilot、Claude Code、Google
6:51 標誌是齒輪還是螃蟹?Rust 的名字和 Ferris
▍參考資料
・Bojan Tunguz 的推文(2023):https://x.com/tunguz/status/1649442898537254914
・馬斯克的回覆:https://x.com/elonmusk/status/1649603943033450496
・Google 官方部落格:Gemini 4 Argon:https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-4-argon/
・Microsoft 安全回應中心(MSRC,2019):https://msrc.microsoft.com/blog/2019/07/a-proactive-approach-to-more-secure-code/
・Chromium 專案:記憶體安全:https://www.chromium.org/Home/chromium-security/memory-safety/
・美國白宮國家網路總監辦公室(ONCD)報告(2024):https://bidenwhitehouse.archives.gov/wp-content/uploads/2024/02/Final-ONCD-Technical-Report.pdf
・Google Security Blog:Rust in Android: move fast and fix things(2025-11):https://blog.google/security/rust-in-android-move-fast-fix-things/
・LWN:The state of the kernel Rust experiment(2025-12):https://lwn.net/SubscriberLink/1050174/6b6d55c90ce1100f/
・Codex CLI is Going Native(OpenAI,GitHub Discussions #1174):https://github.com/openai/codex/discussions/1174
・GitHub Blog:Migrating the GitHub Copilot runtime to Rust, using Copilot:https://github.blog/2026-09-17-migrating-the-github-copilot-runtime-to-rust-using-copilot/
・Bun 用 AI 改寫成 Rust:https://simonwillison.net/2026/Jul/8/rewriting-bun-in-rust/
・The Pragmatic Engineer:What can we learn from Bun's rapid Rust rewrite with AI:https://blog.pragmaticengineer.com/the-pulse-what-can-we-learn-from-buns-rapid-rust-rewrite-with-ai/
・Google Bug Hunters:Scaling Memory Safety(giflib 改寫成 Rust):https://bughunters.google.com/blog/scaling-memory-safety
・giflib-rs:https://github.com/google/giflib-rs
・MIT Technology Review:Rust 名字的由來(2023-02-14):https://www.technologyreview.com/2023/02/14/1067869/rust-worlds-fastest-growing-programming-language/
・Ferris(rustacean.net,CC0):https://rustacean.net/
・The Rust Programming Language(官方教學書,Ferris 的意思):https://doc.rust-lang.org/book/ch00-00-introduction.html
・Stack Overflow 2025 開發者調查:https://survey.stackoverflow.co/2025/technology/
・鏽菌照片:John Tann,CC BY 2.0:https://commons.wikimedia.org/wiki/File:Myrtle_rust_on_brush_turpentine_(8583107849).jpg
#Rust #程式語言 #AI #記憶體安全 #Python #Cpp #軟體工程
馬斯克只回四個字「Rust」,三年後 Google 真的把整個 C 和 C++ 程式碼往 Rust 搬,這轉折也太戲劇性。這支影片從記憶體安全講起,用一個 C++ 印出亂碼、Rust 直接編譯失敗的例子,把「指標還指著舊位置」講得很清楚,再一路查到 AI 工具底層早就換成 Rust 了。

影片時間軸
- 00:10馬斯克回覆 Bojan Tunguz 的推文,只寫了 Rust
- 00:44用陣列擴容解釋 C++ 指標懸空、Rust 編譯器直接擋下
- 02:01Microsoft 與 Chrome 團隊都說約七成漏洞是記憶體安全問題
- 02:31上 GitHub 查 Codex、tiktoken、uv 等專案的語言比例
- 03:37把 Python、Go、C++、Rust 放一起比速度、記憶體與多執行緒
- 04:24Android 改用 Rust 後記憶體漏洞首度降到兩成以下
- 05:31Codex CLI、Copilot、Bun 接連改寫成 Rust
- 07:09電梯當機爬 21 樓的故事,解釋 Rust 這個名字怎麼來的

編譯器變成不會累的審稿員
以前不全部換掉,是因為要改的程式太多,靠人一行一行改好幾年也改不完。現在改寫交給 AI,Codex CLI 從 TypeScript 改寫成 Rust,GitHub 把 Copilot 的 runtime 八十三萬行改成 Rust,主要由一位工程師指揮 AI agent,大約十四週半完成。Rust 強型別、規則嚴格,AI 編譯一次就知道錯在哪,寫錯就退回改到通過。
螃蟹不是官方標誌
官方標誌是中間有字母 R 的齒輪,紅色螃蟹 Ferris 是社群吉祥物,作者放棄版權誰都能用。名字來自生命力超強的鏽菌,用創辦人的話說是「為了活下去而過度設計」。2006 年 Graydon Hoare 因為大樓電梯軟體當機、住 21 樓只能爬樓梯,越爬越火大,回家就開始設計這個語言。

值得下載嗎
值得。它把記憶體安全這個抽象概念用一個具體例子講到懂,又附上 Android、Linux 核心的實際數據,想理解 AI 時代為什麼選 Rust 的人留著很划算。
覺得這篇筆記有幫助嗎?