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

推荐订阅源

Recent Commits to openclaw:main
Recent Commits to openclaw:main
SecWiki News
SecWiki News
Webroot Blog
Webroot Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
N
News and Events Feed by Topic
Recent Announcements
Recent Announcements
Help Net Security
Help Net Security
Jina AI
Jina AI
O
OpenAI News
雷峰网
雷峰网
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 三生石上(FineUI控件)
W
WeLiveSecurity
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
IT之家
IT之家
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Vercel News
Vercel News
N
News and Events Feed by Topic
T
The Exploit Database - CXSecurity.com
爱范儿
爱范儿
Recorded Future
Recorded Future
Google Online Security Blog
Google Online Security Blog
TaoSecurity Blog
TaoSecurity Blog
美团技术团队
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
V
V2EX
T
Tailwind CSS Blog
P
Privacy & Cybersecurity Law Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security
B
Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 【当耐特】
PCI Perspectives
PCI Perspectives
GbyAI
GbyAI
I
Intezer
Spread Privacy
Spread Privacy
Security Archives - TechRepublic
Security Archives - TechRepublic
Cloudbric
Cloudbric
V
Visual Studio Blog
MongoDB | Blog
MongoDB | Blog
Forbes - Security
Forbes - Security
The Last Watchdog
The Last Watchdog
aimingoo的专栏
aimingoo的专栏
C
CERT Recently Published Vulnerability Notes
A
About on SuperTechFans
罗磊的独立博客

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 Iced + Rusqlite + Chrono: Problem with custom error type Why can&#39;t the Rust compiler infer the T type parameter in this BTreeMap::range call? 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 Discussion on Synchronous Crate Concurrency Refactor using Stackful Coroutines Model in Rust Can a future used only by `async fn` assume it won&#39;t be polled again after becoming ready? High-performance `fast-powi` crate 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? Vasya go to (his) Home 🏡 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 Feedback about post in medium Debugger not showing/offering variables? nestrs: a NestJS-style framework for Rust built on Axum and Tower Confusion about struct variance with &mut dyn How do I do hmr in rust How to call struct method as function pointer in loop Loops inside loops and mutable reference on Iterator VSCode - rust-analyzer - annoying re-builds due to RUSTC_BOOTSTRAP changed Borsh v1.6.1 example What's everyone working on this week (14/2026)? What's everyone working on this week (17/2026)? RawWakerVTable functions, did I write them correctly? Cargo test's verbose output - can I quiet it? Sem: semantic entity level version control CLI built with tree-sitter How do i get all the words in a string and convert it into a vector? Looking for feedback on my first tokenizer in Rust Frostmirror - (lightweight airgap alternative inspired from panamax and romt) - an offline cargo repository for airgap system that can be deployed through a docker image Does "ill-formed, no diagnostic required" exist in Rust? If a program is built with software floating-point emulation, is it affected by hardware floating-point environment? Rustc-link-lib static library How does crates.io and docs.rs store crates? Basic Object Oriented Programming in Rust Various input in one line error[E0080]: index out of bounds error when trying to install LuaCAD CSV to SQLite - Is it better to write records as they are being read Looking for feedback for a graph-based task scheduler This is my first project. I invented a new algorithm that even AI don't know. It's about bigint. And I'm 15. Thanks for watching. By the way, my crate named `nna` Why Windows rustc uses a different color scheme? Clap completion question Is RMW operation less prone to reading stale values than a pure load? Type inference of generic parameters Cyw43 on STM32H723 Reducing code repetition with Vecs and fields Are there any object detection libraries out there for the Arduino?
Why are builds of my crate's test not consistent (cargo build vs cargo test vs VSCode-Test-Explorer)
stefan-huber · 2026-04-17 · via The Rust Programming Language Forum - Latest posts

April 17, 2026, 8:10am 1

TL/TR
Why are build results of my crate's test not consistent - I see rebuilds happen for combinations of these without changes in between?

  • cargo build --all-targets
  • cargo test -p create_a
  • VSCode Test Explorer building tests for create_a

Background:

  • we use a rust workspace ~40 creates as members
  • cargo build --all-targets would build ~600 individual crates (i.e. dependencies + workspace crates)
  • one of the crates in workspace "crate_a" would build ~300 individual creates (i.e. dev-dependencies + the crate's test itself)
  • we have equivalent observation (see blow) no matter whether or not we use [workspace.dependencies] consistently (same versions and feature sets) for all creates in our workspace (including their dev-dependencies). (we tested for both cases)

Development practice

  • We use VSCode with rust-analyzer extension as development tool on windows workstations.

  • We use .vscode/settings.json having "rust-analyzer.testExplorer": true,

  • we use any of these when we want to verify/debug test cases:

    • from terminal: {workspace_root} cargo test (for complete workspace)
    • from terminal: {workspace_root}/create_a cargo test (for individual crate in workspace)
    • CodeLens: run individual test cases with or without debug triggered from inside source code editor
    • Testing view (Test Explorer): run all or individual test cases triggered
  • we usually do a {workspace_root} cargo build --all-targets before we run tests hoping for both:

    • a) quick feedback if your change compiles and doesn't break compilation of other test cases
    • b) have build results ready for running any number or selection of tests

We suffer from un-expected rebuilds (even without source code changes) in these scenarios. This way we suffer from slow turnaround times.

Observation
Here comes a scenario (Note: no changes to workspace happen in between)

  • cargo clean
  • cargo build --all-targets
    -> creates (among others) \target\debug\deps\crate_a-<hash_a>.exe
  • cargo test -p crate_a
    -> (unexpected) rebuilds some dependencies and creates
    target\debug\deps\crate_a-<hash_b>.exe
  • using test-lens to run a test case
    -> no rebuild (as expected), uses
    target\debug\deps\crate_a-<hash_b>.exe
  • using test explorer
    -> (unexpected) rebuild some deps + *.exe
    -> seems to re-create
    (target\debug\deps\crate_a-<hash_b>.exe)
  • using test-lens to run a test case
    -> (unexpected) rebuild some deps + *.exe
    -> seems to re-create
    (target\debug\deps\crate_a-<hash_b>.exe)
  • cargo test -p crate_a
    -> (as expected) no rebuild
    -> uses target\debug\deps\crate_a-<hash_b>.exe
  • cd .crate_a
  • cargo test
    -> no rebuild (as expected)
    -> uses target\debug\deps\crate_a-<hash_b>.exe
  • using test lens
    -> (as expected) no rebuild
    -> uses target\debug\deps\crate_a-<hash_b>.exe
  • using test explorer
    -> (unexpected) rebuild some deps + *.exe
    -> uses target\debug\deps\crate_a-<hash_b>.exe

Fazit
It seems there is an (for us) unexpected inconsistency/rebuild happening between
a) cargo build --all-targets (workspace) and the building/running crate_a's test
b) VS Code Test Explorer doesn't seem to 'accept' build result of create_a's test and re-creates it when alredy previously been build.

So for me it comes down to two questions

  1. Why does cargo build --all-targets and individual builds via cargo test -p crate_a don't create/re-use the same build result?
  2. Why does VS Codes's "Test Explorer" and the other ways to create build result for crate_a's do re-builds, even though thy apparently use the same build result?

kpreid April 17, 2026, 4:16pm 2

When you perform a build, the set of enabled features is determined by what is required by all packages being built. Therefore, when you restrict the build to one of your packages with -p crate_a, fewer features are enabled, requiring a different build of the packages with those features and all of their transitive dependents.

I thought I had an answer to this, but I just tested and I don’t. In general, the common things that cause rebuilds besides the above are environment variables being different. Also, if you use cargo build --verbose you can have Cargo print why it thinks something needs rebuilding (as opposed to building a different feature configuration).