rust-lang / rust-lang/rust-analyzer

RA breaks incremental compilation when using dev profile for wasm

Open
#12,551 5 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-support
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer 0.0.0 (366db7242 2022-06-12)
rustc version: rustc 1.63.0-nightly (c52b9c10b 2022-05-16)
os: Linux 5.18.3-arch1-1
editor: vscode 1.67.1

Minimal reproducible example: (vscode)

  • Create lib project with: cargo new --lib ra_wasm_bug
  • Add a some random dependency, eg: clap = "3.2.5"
  • Compile with: cargo build --target wasm32-unknown-unknown
    > Clap and its dependencies get compiled as expected.
  • Rerun the same command
    > Clap is no longer compiled as expected
  • Save lib.rs after no changes
    > We can see in vscode's bottom bar that RA reruns cargo check
  • Rerun the build command
    > Clap gets compiled again, for no reason (interestingly, some of its dependencies get compiled again, and some don't)

Note for people encountering this bug: as a workaround, it's possible to create a custom profile which inherits "dev" as a temporary fix. See the docs on custom profiles for more info

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior in a new cargo library using lib.rs, a dependency such as clap, and repeated cargo build --target wasm32-unknown-unknown commands while observing rust-analyzer in VS Code. Investigate the interaction between cargo check, the dev profile, and wasm incremental compilation; done means unchanged repeated builds no longer recompile dependencies unnecessarily.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
build-system, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.