Open Lingepumpe opened 2 weeks ago
After playing around with it some more, I realized that the polars-ops
feature should also be enabled to find diff
, as the prelude of polars has this code:
And diff should come from the line 8 pub use polars_ops::prelude::*;
, which is conditional on the feature polars-ops
. Interestingly, everything also compiles fine without that feature added, in fact adding the feature to Cargo.toml had no effect at all, also not to rust-analyzer.
Maybe the actual issue for rust-analyzer is that polars has "outsourced" diff
into a crate called polars_ops
, and that one is not parsed with the diff
feature still enabled by rust-analyzer
?
Here in line 76 you can see where diff should finally come from. This is hidden behind the diff
feature. So if rust-analyzer no longer has the diff
feature active (given this is a different crate!), then this would cause the issue:
I am having issues with the
diff
function of polars within vscode: rust-analyzer does not seem to find this function, I cannot ctrl+click it to go to its definition and also I don't see any type annotations in vscode (e.g. for the type ofweight_differences
in the example):Could it be related to the fact that
diff
is only available when thediff
feature is enabled? In myCargo.toml
I havepolars = { version=">=0.44.2", features = ["diff"]}
.Note that other features from the polars package that are feature gated are not behaving the same, so this cannot be the only thing that causes ruff-analyzer to miss/ignore the function.
I have created a repo with the above code and the necessary Cargo.toml files to reproduce it: https://github.com/Lingepumpe/minimal_rust_demo
Versions: rust-analyser version: 0.4.2176-standalone (this is the nightly version, I was on stable before, with the same issue) rustc 1.82.0 (f6e511eec 2024-10-15) vscode Version: 1.95.1