Skip to content

gen_rust_project creates invalid entries if compile_data is used #3200

Closed as duplicate of#3126
@hauserx

Description

Generated rust-project.json started to contain include_dirs which points to bin directory. Because of that rust_analyzer does not treat any file, other than root_module, as belonging to the crate.

Workaround is to manually remove the source entry, or add appropriate include dir to rust-project.json ("src" in below example).

Bisect pointed to #3176, although reading through it possibly issue was present even before that if crate contained some generated data.

Example on https://github.com/cameron-martin/bazel-lsp after bazel run @rules_rust//tools/rust_analyzer:gen_rust_project

  "crates": [
...
    {
      "display_name": "bazel_lsp",
      "root_module": "/home/hauser/repos/bazel-lsp/src/main.rs",
...
      "source": {
        "include_dirs": [
          "/home/hauser/.cache/bazel/_bazel_hauser/7b35979d7249c8686e26265de57e7009/execroot/_main/bazel-out/k8-fastbuild/bin/src"
        ],
        "exclude_dirs": []
      },
...

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions