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

推荐订阅源

D
Docker
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
博客园_首页
Microsoft Security Blog
Microsoft Security Blog
Blog — PlanetScale
Blog — PlanetScale
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
Jina AI
Jina AI
N
Netflix TechBlog - Medium
量子位
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
InfoQ
J
Java Code Geeks
T
Tailwind CSS Blog
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Engineering at Meta
Engineering at Meta
腾讯CDC

The Rust Programming Language Forum - Latest topics

Beginner building a Rust backend framework (AI-assisted) — feedback appreciated C++ to Rust -- Exceptions Re-exporting a trait with a custom derive_macro Gold linker is deprecated Why is using PhantomData valid in this case? Code review for Static Pool Allocator Looking for a pool based allocator Why is this legal? What does it mean for Rustc to run "out of TLS keys"? Using async/await internally with no internal runtime, but exposing a nonblocking poll API — is this a reasonable design? Testing functions that use randomness `cargo-path`: improve coding agents&#39; ability to find Rust documentation Rust task runners Lifetime weird case Windows - USB device not detected A random rustc-ice-[...].txt file appeared Develop rust where the environment is setup in a docker Undefined Behavior: in-bounds pointer arithmetic failed: attempting to offset pointer by 20 bytes, but got alloc238 which is only 1 byte from the end of the allocation Unbug 0.5 - Runtime debug assertions Is there a tiny error in section 6.2 Reference types? Lifetime woes implementing ratatui::Widget for a reference Rusqlite + Chrono: How do I simplify code to obtain chrono datetime value From OOP to Rust – struggling with code organization and data structure design Way to avoid a self-referential struct Rust RF and audio resources/communities Whyhttp - HTTP mocks that fail where the bug actually is Using tokio channel permits in a tower service Arc::increment_strong_count design question (cross-post) `&T`, `&mut T`, `Pin<&mut T>` and `&Cell<T>`: Ways of Borrowing a `T` Ratatui detect arrow key press and release
VSCode - rust-analyzer - annoying re-builds due to RUSTC_...
stefan-huber · 2026-04-20 · via The Rust Programming Language Forum - Latest topics

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.