dfinity / dfinity/cdk-rs

`rust-analyzer` fails with `ic_cdk_bindgen`

Open
#442 3 comments 0 reactions 1 assignee View on GitHub

@lwshang is already working on this.

Since Nov 6, 2023.

Dominant language
Rust
Stars
230
Forks
103
Avg merge
2d 13h
Merged PRs (30d)
2

Description

it seems like ic_cdk_bindgen expects an env variable set for the candid path. if you're not building with dfx, the env variables doens't seem to be present and the rust-analyzer VSCode plugin throws the following error:

[ERROR rust_analyzer::main_loop] FetchBuildDataError:
error: failed to run custom build command for `iluvatar_backend v0.1.0 (/Users/moritz/projects/iluvatar/src/iluvatar_backend)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/Users/moritz/projects/iluvatar/target/debug/build/iluvatar_backend-0919ac66e4da000e/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /Users/moritz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-cdk-bindgen-0.1.1/src/lib.rs:18:58:
  Cannot find candid path: NotPresent
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
     1: core::panicking::panic_fmt
               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
     2: core::result::unwrap_failed
               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1652:5
     3: core::result::Result<T,E>::expect
     4: ic_cdk_bindgen::Config::new
     5: build_script_build::main
     6: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.