Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA breaks incremental compilation when using dev profile for wasm #12551

Open
Azorlogh opened this issue Jun 16, 2022 · 5 comments
Open

RA breaks incremental compilation when using dev profile for wasm #12551

Azorlogh opened this issue Jun 16, 2022 · 5 comments
Labels
C-support Category: support questions

Comments

@Azorlogh
Copy link
Contributor

Azorlogh commented Jun 16, 2022

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

@lnicola
Copy link
Member

lnicola commented Jun 16, 2022

I can't really reproduce it:

# start Code, save the file
$ cargo build --target wasm32-unknown-unknown
   Compiling ra_wasm_bug v0.1.0 (ra_wasm_bug)
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s

I've seen this before, and a cargo clean fixed it. It can also happen if you're setting the target in the RA settings, but have different environment variables in Code and in the terminal.

Try cargo clean, then restart Code from the same terminal.

@Azorlogh
Copy link
Contributor Author

Unfortunately cargo clean that doesn't fix it for me, and merely restarting vscode triggers RA "Indexing" and other stuff, which causes incremental compilation to fail as well.
I'm not settings the target either, it happens with fully default settings.

@Azorlogh
Copy link
Contributor Author

I don't know if this can be useful for debugging, but I've attached my target directory after compiling, and after saving (after RA ran cargo check)
target_after_compile.tar.gz
target_after_ra.tar.gz

@flodiebold flodiebold added the C-support Category: support questions label Jun 16, 2022
@d4h0
Copy link

d4h0 commented Jan 11, 2023

I seem to have the same issue.

If I edit a file with nano (which doesn't have RA), incremental compilation works.

If I edit a file with my regular editor (which is Helix, and has RA), the app is re-compiled fully (no incremental compilation).

The following steps reproduces this:

  1. Follow these instructions to set up a demo app with Dioxus
  2. As mentioned at the end, execute dioxus serve (this starts a dev-server that re-compiles the code on changes)
  3. Edit and save src/main.rs with an editor that doesn't run RA (e.g., nano)
  4. Notice that automatic re-compilation of the dioxus serve process is very fast (~800 ms)
  5. Now close the editor, and edit and save src/main.rs with an editor that does run RA (e.g., VSCode, or Helix)
  6. Now dioxus serve has often to wait until RA finished (which takes a long time), and after that dioxus serve has to do a full re-build (which takes a long time)

A few odd things I've noticed are:

  • Sometimes dioxus serve has to wait until RA is finished, sometimes not
  • Sometimes incremental compilation works, but most of the time, it doesn't

Just adding a variable declaration somewhere (e.g, let x = 1;), and changing the name or value seems to work, most of the time.

Fortunately, using a different profile works (thanks, @Azorlogh!)

@alkeryn
Copy link

alkeryn commented Mar 16, 2023

any news on this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Category: support questions
Projects
None yet
Development

No branches or pull requests

5 participants