UP | HOME

Fix rust-analyzer error "rustc [E0463]: can't find crate for `test`"

When working in projects that set a custom build-std value that do not include the std crate, rust-analyzer reports the following error.

rustc [E0463]: can't find crate for `test`

Placing a .dir-locals.el file in the root directory of the project with the following contents fixes it.

((nil . ((eglot-workspace-configuration
          . (:rust-analyzer (:cargo (:allTargets :json-false)))))))

Date: 2025-05-16 Fri 00:00

Author: Roi Martin

Created: 2025-05-16 Fri 23:51

Validate