Skip to content

RA cannot resolve a trait implementation of a structure #18580

@pan93412

Description

@pan93412

rust-analyzer cannot resolve the import of the trait SeriesMethods:

Image

This issue prevents rust-analyzer from finding the method value_counts:

Image

It might be related to #15243.

rust-analyzer version: 0.3.2196-standalone (327ab29 2024-11-24)

rustc version: rustc 1.82.0 (f6e511eec 2024-10-15)

editor or extension: VS Code, 0.3.2196

relevant settings: N/A

repository link (if public, optional): https://github.com/pan93412/aoc2024rs/blob/master/src/bin/polars_bug.rs

code snippet to reproduce:

[dependencies]
polars = { version = "0.44.2", features = ["polars-ops"] }
use polars::prelude::*;

fn main() {
    let df = df!(
        "column_1" => [1, 2, 3, 4, 5],
        "column_4" => [5, 4, 3, 2, 1]
    ).unwrap();

    dbg!(df.column("column_1").unwrap().as_series().unwrap().value_counts(false, false, "counts".into(), false).unwrap());
}

Workaround: find the definition of SeriesMethods, and use it directly:

Image

Metadata

Metadata

Labels

A-nameresname, path and module resolutionC-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions