Skip to content

rust-analyzer fails on this repository #1949

@e00E

Description

@e00E

When I open this repository in vscode with rust-analyzer (both release and preview) it errors with

rust-analyzer failed to run build scripts

The log shows

[ERROR project_model::workspace] cyclic deps: sqlx_core(CrateId(246)) -> sqlx(CrateId(218)), alternative path: sqlx(CrateId(218)) -> sqlx_core(CrateId(246))
[ERROR project_model::workspace] cyclic deps: sqlx_test(CrateId(255)) -> sqlx(CrateId(218)), alternative path: sqlx(CrateId(218)) -> sqlx_test(CrateId(255))
[ERROR rust_analyzer::lsp_utils] rust-analyzer failed to run build scripts

error: only one of ['runtime-actix-native-tls', 'runtime-async-std-native-tls', 'runtime-tokio-native-tls', 'runtime-actix-rustls', 'runtime-async-std-rustls', 'runtime-tokio-rustls'] can be enabled
  --> sqlx-rt/src/lib.rs:21:1
   |
21 | / compile_error!(
22 | |     "only one of ['runtime-actix-native-tls', 'runtime-async-std-native-tls', \
23 | |      'runtime-tokio-native-tls', 'runtime-actix-rustls', 'runtime-async-std-rustls', \
24 | |      'runtime-tokio-rustls'] can be enabled"
25 | | );
   | |_^


error: aborting due to previous error


error: could not compile `sqlx-rt` due to 2 previous errors

My rust-analyzer config is

{
    "rust-analyzer.cargo.features": [
        "runtime-tokio-native-tls"
    ],
    "rust-analyzer.checkOnSave.features": [
        "runtime-tokio-native-tls"
    ],
}

Note that cargo check --features runtime-tokio-native-tls --all-targets works.

Rust-analyzer is very useful during development so I would like it to work. I am not sure if this is something that should be fixed here or a bug in rust-analyzer. Is this problem known? Is there a workaround that fixes it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions