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

推荐订阅源

量子位
Vercel News
Vercel News
Microsoft Azure Blog
Microsoft Azure Blog
爱范儿
爱范儿
N
Netflix TechBlog - Medium
Google DeepMind News
Google DeepMind News
H
Help Net Security
罗磊的独立博客
The Cloudflare Blog
J
Java Code Geeks
博客园 - 叶小钗
I
InfoQ
B
Blog
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
腾讯CDC
月光博客
月光博客
博客园_首页
雷峰网
雷峰网
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
美团技术团队
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美

The Rust Programming Language Forum - Latest posts

What's everyone working on this week (21/2026)? Rust Function Call with one Param Iced + Canvas + Text: How do I create a style for canvas text "Value dropped while borrowed" as a lifetime mismatch Weird `use of moved value` behaviour Slightly surprising behavior of a while loop Clap: how to disable options after a certain positional argument How do i tell rust-analyzer what kind of bracket to use for a macro? Iterator + Borrow Checker: Work around borrowing already borrowed mutable variable Requesting data via mavlink SKILLS.md for Rust development 🧵 Stringlet UTF-8 Hack Option Niche? Iterator + Map - How do divide every element, including the last element, by the last element Why can't we store returned value of a function in a variable if one of the parameters goes out of scope My first crate :D, floop: A more convenient and less error prone replacement for loop `{ select! { .. }}` Sorting is slow because architectures are wrong — zan-sort redesigns the architecture, not the algorithm Iced Font - Create a custom monospace font to display dollar amounts Is the UnsafePinned RFC wrong about being able to return `&mut T` from `get_mut_unchecked`? Fixing Polars 0.37 compilation errors: Hashbrown 0.17 dependency conflict and decimal parsing Any plans for improving error diagnostic in Rust 2.0? How do I build completely offline? Is `&mut T -> &mut ManuallyDrop<T>` well-defined and sound? Would you use this? — fixtura, declarative fake data injection for tests Foreign trait restrictions on native types make generics hard to use Cargo Exclude Directive Compiler reasoning around a modulo counter Multiple mutable references to elements within one vector Handling non-`Send` data in a `Send` closure Review: Static Multi Pool Allocator Rmquickjs - High-level MicroQuickJS bindings for Rust
VSCode - rust-analyzer - annoying re-builds due to RUSTC_...
stefan-huber · 2026-04-20 · via The Rust Programming Language Forum - Latest posts

1

TL/TR
what can I do to avoid the re-builds to happen and instead have consistent, reusable build results for these: cargo test, CodeLens, TestExplorer?

Backgound
(Note: this is a more specific spin of from Why are builds of my crate's test not consistent (cargo build vs cargo test vs VSCode-Test-Explorer))
Using: rust-analyzer extension for VSCode
Name: rust-analyzer
Id: rust-lang.rust-analyzer
Description: Rust language support for Visual Studio Code
Version: 0.3.2870
Publisher: The Rust Programming Language
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer

Reprocue:

  1. cargo new ra_rebuild_test
  2. cargo add proc-macros2
  3. use rust-analyzer.testExplorer": true (e.g. in ./vscode/settings.json)
  4. add any test into main.rs, e.g.
#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}
  1. Use VSCode's TestExplorer to run it_works
  2. cargo test --no-run --verbose

Expected: no rebuild necessary.
Observe: it says this and rebuilds:

 Dirty proc-macro2 v1.0.106: the env variable RUSTC_BOOTSTRAP changed
   Compiling proc-macro2 v1.0.106
[...]

This is no big deal for a simple project, however gets ugly when the project grows larger, as described in Why are builds of my crate's test not consistent (cargo build vs cargo test vs VSCode-Test-Explorer)).

Note: I don't observe this, when useing VSCode's CodeLense feature to run the individual test (which I suppose is also a feature brought in by rust-analyzer extension into VSCode)

Questions

  1. why is it necessary for rust-analyzer to make use of RUSTC_BOOTSTRAP in TestExplorer, but - as it seems - not in the CodeLens feature?
  2. why is this environment variable relevant for rebuilding proc-macro2 (and as it seems not for some other dependencies)?
  3. what can I do to avoid the re-builds to happen and instead have consistent, reusable build results for these: cargo test, CodeLens, TestExplorer?

2

I reported that issue years ago to proc-macro2. It still might be worth to add a comment there that this is now triggering rebuilds due to rust-analyzer + also report it to rust-analyzer as well.