惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
G
Google Developers Blog
B
Blog RSS Feed
A
About on SuperTechFans
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 司徒正美
D
Docker
F
Fortinet All Blogs
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
H
Help Net Security
WordPress大学
WordPress大学
MyScale Blog
MyScale Blog
博客园 - Franky
人人都是产品经理
人人都是产品经理
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
L
LangChain Blog

Rust Blog

Security Advisory for Cargo (CVE-2026-5223) | Rust Blog Security Advisory for Cargo (CVE-2026-5222) | Rust Blog Project goals update — April 2026 (end of 2025H2) | Rust Blog Rust is participating in Outreachy | Rust Blog Raising the baseline for the `nvptx64-nvidia-cuda` target | Rust Blog Announcing Google Summer of Code 2026 selected projects | Rust Blog Announcing Rust 1.95.0 | Rust Blog docs.rs: building fewer targets by default | Rust Blog Changes to WebAssembly targets and handling undefined symbols | Rust Blog Announcing Rust 1.94.1 | Rust Blog Security advisory for Cargo | Rust Blog What we heard about Rust's challenges | Rust Blog Call for Testing: Build Dir Layout v2 | Rust Blog Announcing rustup 1.29.0 | Rust Blog Announcing Rust 1.94.0 | Rust Blog 2025 State of Rust Survey Results | Rust Blog Rust debugging survey 2026 | Rust Blog Update on the October 15, 2018 incident on crates.io Announcing Rust 1.29.2 Announcing Rust 1.29 Announcing Rust 1.28 What is Rust 2018? Announcing Rust 1.27.2 Announcing Rust 1.27.1 Security Advisory for rustdoc Announcing Rust 1.27 Announcing Rust 1.26.2 Announcing Rust 1.26.1 Rust turns three Announcing Rust 1.26
Resolving Rust's forward progress guarantees | Inside Rus...
Mark Rousskov on behalf of the compiler team · 2020-03-19 · via Rust Blog

There has been a longstanding miscompilation in Rust: programs that do not make forward progress. Note that the previous link is to the C++ definition; Rust is not C++, but currently LLVM optimizes all LLVM IR with the assumption that a lack of forward progress is undefined behavior.

Note also that Rust does not define a lack of forward progress as undefined behavior, while C++ does. It is particularly common to encounter the miscompilation "intentionally" when writing panic handlers and other such code with a body of loop {}. Some users also report that they've unintentionally hit this bug in recursive code which accidentally lacks a base case.

Somewhat recently, LLVM added an intrinsic which tells the optimizer that forward progress has been made. On nightly Rust, you can enable this with -Zinsert-sideeffect, which will use some heuristics to insert it where it's possibly needed (currently, massively overshooting the minimal set).

However, recent attempts to enable this intrinsic by default hit a snag: it's very expensive on compile times to do so (3-30% regressions). There is some runtime effect as well; check builds (which do not generate LLVM IR or run LLVM passes) regressed by up to 3-7%.

The current implementation in rustc emits calls to the side effect intrinsic very aggressively; certainly in way more cases than is strictly necessary. However, there's not really any good ideas on how to improve the analysis rustc does without missing edge cases: we'd have to be "as good" as LLVM to emit only when necessary.

Upstream, in LLVM, discussion has been ongoing for some time around whether, and how to, adjust LLVM's model to permit frontends for languages like Rust to opt-out of the forward progress guarantees. It seems unlikely that a solution will materialize in upstream LLVM that allows us to opt-out in the short term.

However, having said that, side effect itself is likely improvable to at least avoid the excessive consecutive calls, as demonstrated by this IR that occurs after LLVM optimizations. It seems plausible that those improvements may also reduce the compile time hit that we see when enabling side effect on the rustc side. Having said that, how simple these improvements are is unclear.

We would love to hear feedback and suggestions on how to resolve this problem! Please leave feedback on this internals thread.