Skip to content

Trait method should not appear in the auto complete if bounds not satisfied #19868

@XavDesbordes

Description

@XavDesbordes

Hi,
Using rust nightly rustc 1.89.0-nightly (777d372 2025-05-17).

I will copy paste the question I asked on the (rust forum) with a playground link.


Hi,

The issue:
I would like Vscode/rust-analyzer not to show some trait functions in auto complete if the bounds are not satisfied.
I mean, for the type B in the playground, ra still show get_value_from_key when it should only show get_value_from_key2 and vice versa for A when auto-complete popup is displayed.

(This is a very simplified example, the trait is much more complex than this with dozen of functions with varying constraints)

Is there a way to make that behave properly?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions