Home > Mobile >  Why does `rust-analyzer.cargo.features` not change the features for the save check (VSCode Extension
Why does `rust-analyzer.cargo.features` not change the features for the save check (VSCode Extension

Time:03-04

I'm working on a rust project and you have to pick some features to decide the linear programming module to get the project to compile. Normally, I can run check with cargo check --features lp_coincbc,blas_openblas-system and everything works fine. However, the Rust Analyzer VSCode Extension gives me errors (compile_error!s that are built into the project) even though I have this set up in my VScode settings.json file.

# ~/.config/Code/User/settings.json
{
  ...
  "rust-analyzer.cargo.features": [
    "lp_coincbc",
    "blas_openblas-system"
  ],
  ...
}

I further checked rust-analyzer.checkOnSave.features and it is supposed to default to rust-analyzer.cargo.features, so I'm just really confused here. Any help would be appreciated.

Edit: Including the language server trace configuration (removed for character limit).

Edit 2: With RA_LOG="flycheck=info" (removed for character limit).

Edit 3: Rust Analyzer Language Server Panel:

[INFO flycheck] restart flycheck "cargo" "check" "--workspace" "--message-format=json" "--manifest-path" "/home/ihowell/Projects/rl/nnv-rs/Cargo.toml" "--all-targets" "--features" "lp_coincbc blas_openblas-system"

Edit 4: Copy of error in mod.rs

[{
    "resource": "/home/ihowell/Projects/rl/nnv-rs/src/lib.rs",
    "owner": "rust",
    "severity": 8,
    "message": "error: Must enable one of \"blas_{{intel_mkl,openblas-system}}\"",
    "startLineNumber": 43,
    "startColumn": 9,
    "endLineNumber": 43,
    "endColumn": 85
}]

CodePudding user response:

To those that come across this question, Rust Analyzer was not the actual issue here. Instead, there was another plugin cargo that was also performing checks and did not have the features specified. After uninstalling the plugin, everything worked fine.

The way I figured out that this was that it was this issue was by following the advice of @ChayimFriedman to analyze what was actually reporting the problem. Since nothing was claiming the error, it couldn't be Rust Analyzer, as when it reports errors, the source shows rust-analyzer. This led me to look into the other plugins installed.

  • Related