Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does features in [dependencies] in the Cargo.toml will be enabled by RA? #17230

Open
huang-jl opened this issue May 14, 2024 · 0 comments
Open
Labels
C-support Category: support questions

Comments

@huang-jl
Copy link

huang-jl commented May 14, 2024

The following toml settings is part of a rust project. Note that it specify the features in the vm-memory dependency.

[package]
name = "vmm"
version = "0.1.0"
authors = ["Amazon Firecracker team <firecracker-devel@amazon.com>"]
edition = "2021"
license = "Apache-2.0"

[dependencies]
vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-bitmap"] }

I have set the rust-analyzer.cargo.features to default value (i.e. []) and DO NOT enable allFeatures.

When I edit the .rs source code files in the project directory, everything works fine, and the RA seems to recognize the features in Cargo.toml, i.e., it enables the "backend-mmap" and "backend-bitmap".

But when I jump into the source code files in the dependency crate (e.g., files in ~/.cargo/registry/src/......), which is outside the project directory, the RA DO NOT enable "backend-mmap" and "backend-bitmap". RA seems use the rust-analyzer.cargo.features for those files outside the project directory, instead of using that in [dependencies] section in Cargo.toml.

My questions are:

  1. Why features in [dependencies] not enable when I jump into source code in the dependency crate? Is there something I missed?
  2. Because I do not want to enable all features in the dependencies (which means I do not want to enable rust-analyzer.cargo.allFeatures), how can RA only enables the features in the [dependencies] section in Cargo.toml when I jump into the source code files in that crate?
@huang-jl huang-jl added the C-support Category: support questions label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Category: support questions
Projects
None yet
Development

No branches or pull requests

1 participant