LoginSignup
2
0

More than 1 year has passed since last update.

no_stdでrust-analyzerのcargo checkがスタックするときの対処

Posted at

rust-analyzerで保存時にcargo checkを回すとき、10秒ほどスタックすることがある。

デフォルトだと--all-targetsオプションが設定されているので、no_stdなクレートをコンパイルしようとするとエラーが起こることが原因っぽかった。

コマンドラインだと以下のようなエラーが出るので分かりやすい。

error: language item required, but not found: `eh_personality`
  |
  = note: this can occur when a binary crate with `#![no_std]` is compiled for a target where `eh_personality` is defined in the standard library
  = help: you may be able to compile for a target that doesn't need `eh_personality`, specify a target with `--target` or in `.cargo/config`

rust-analyzerの場合は、checkOnSave時のコマンドを以下のようにオーバーライドすることでクリアできた。

    "rust-analyzer.checkOnSave.overrideCommand": [
        "cargo",
        "clippy",
        "--workspace",
        "--message-format=json",
    ],

参照
https://github.com/rust-lang/rust-analyzer/issues/2142
https://github.com/rust-lang/rust-analyzer/issues/4616

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0