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

推荐订阅源

雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
V
V2EX
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
Recent Announcements
Recent Announcements
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
美团技术团队
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks

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
Bisecting Rust Compiler Regressions with cargo-bisect-rus...
Santiago Pastorino on behalf of the compiler team · 2019-12-18 · via Rust Blog

Let's say that you've just updated the Rust compiler version and have tried to compile your application and see a failure that wasn't there before. That's likely due to a regression in the compiler. We've just released cargo-bisect-rustc, a tool that makes it super easy to find exactly when the regression happened.

cargo-bisect-rustc automatically downloads rustc artifacts and tests them against a project you provide until it finds the regression. At minimum, it will identify the nightly release which triggered the regression; but if the regression occurred in the last 168 days, it will even figure out the exact PR, which is often very useful in helping us fix the problem.

cargo-bisect-rustc was created originally by Mark Rousskov. I extended it recently to make it easier to use.

To install the tool run:

cargo install cargo-bisect-rustc

Finding a regression

We are going to use this "old" reported rustc regression as an example:

Our application consists only of this file:

pub struct Slice<'a, T>(&'a [T]);

impl<'a, T: 'a> Slice<'a, T> {
    pub const EMPTY: Self = Slice ({
        let v: &[T] = &[];
        v
    });
}

fn main() {
    let s = Slice(&[1, 2]);
    assert!(s.0 != Slice::EMPTY.0);
}

Then we run cargo bisect-rustc --end=2019-10-02.

Since this bug was fixed on 2019-10-03, we're using 2019-10-02 as the end We need to provide the end point for this particular example, given that this bug was fixed on 2019-10-03, we're using 2019-10-02 as the end point. If you don't provide an ending point it assumes that the end point is today's nightly or your currently installed nightly. If you don't provide a start point as we're doing it tries to find one by regressing in time. If you know if a failing starting point it would be faster if you just provide that one.

By default it will run cargo build in the project and check whether or not it fails. After finding a nightly that has regressed it is going to automatically search for the commit that introduced the regression.

Let's see the tool in action:

The tool starts by downloading various nightly compilers, trying to find a date when the program worked ...

checking nightly-2019-10-02
std for x86_64-unknown-linux-gnu: 172.87 MB / 172.87 MB [===============================================================================================================================================================] 100.00 % 10.67 MB/s uninstalling nightly-2019-10-02
checking nightly-2019-09-30
...

Once it has one failing and working point it starts bisecting ...

std for x86_64-unknown-linux-gnu: 173.43 MB / 173.43 MB [===============================================================================================================================================================] 100.00 % 12.82 MB/s uninstalling nightly-2019-09-29
tested nightly-2019-09-29, got No
searched toolchains nightly-2019-09-28 through nightly-2019-09-30
regression in nightly-2019-09-30

Once it finds a nightly, it starts to search the PRs that went into that nightly build ...

looking for regression commit between 2019-09-30 and 2019-09-29
fetching commits from 488381ce9ef0ceabe83b73127c659e5d38137df0 to 8431f261dd160021b6af85916f161a13dd101ca0
...
searched toolchains 488381ce9ef0ceabe83b73127c659e5d38137df0 through 8431f261dd160021b6af85916f161a13dd101ca0
regression in 0bbab7d99dde8620604fb265706dc8bff20345a7

Finally, when it finds the PR that broke the compiler, it generates a bug report that you can copy and paste!

==================================================================================
= Please open an issue on Rust's github repository                               =
= https://github.com/rust-lang/rust/issues/new                                   =
= Below you will find a text that would serve as a starting point of your report =
==================================================================================

# Regression found in the compiler

searched nightlies: from nightly-2019-09-28 to nightly-2019-09-30
regressed nightly: nightly-2019-09-30
searched commits: from https://github.com/rust-lang/rust/commit/488381ce9ef0ceabe83b73127c659e5d38137df0 to https://github.com/rust-lang/rust/commit/8431f261dd160021b6af85916f161a13dd101ca0
regressed commit: https://github.com/rust-lang/rust/commit/0bbab7d99dde8620604fb265706dc8bff20345a7
source code: URL OF A REPOSITORY THAT REPRODUCES THE ERROR

## Instructions

Please give the steps for how to build your repository (platform, system dependencies, etc.)
## Error

<details><summary>COLLAPSIBLE ERROR STACKTRACE</summary>
<p>

```bash
$ Paste the error the compiler is giving
```

</p></details>

This tells us that the regression started with 0bbab7d99dde8620604fb265706dc8bff20345a7 and you can look at the git log to find the PR. In this case is #64470.

Call for action: try the tool

Please, give this tool a try and if you find yourself updating your application and it stops building, it's likely that you're hitting a regression. As you can see at the end of the execution of the tool, if a regression is found the tool gives you a report that you can paste on a github issue on the Rust repo.

Call for action: get involved in the development of cargo-bisect-rustc

There are also a lot of things to improve in the tool and a lot of bugs to fix. There are a bunch of reported issues that are easy to fix, check them out. You can also, reach us out. You can find me and the rest of the compiler contributors and members in Zulip's #t-compiler/cargo-bisect-rustc stream. Sign up there if you haven't already and do not hesitate to ask questions or even to send me a direct message if you don't know where to start.