Skip to content

Import trait not suggested #16989

@tamasfe

Description

@tamasfe

rust-analyzer version: rust-analyzer version: 0.4.1905-standalone
rustc version: rustc 1.76.0 (07dca489a 2024-02-04)

editor or extension: vscode

issue:

We have an example trait somewhere:

trait NotInScope {
  fn not_in_scope(&self) {}
}

impl<T> NotInScope for T {}

When calling a trait function on a variable (foo.not_in_scope()) and the trait is not in scope, import of the trait is not offered anymore. rustc correctly fails with the following trait is implemented but not in scope; perhaps add a use for it: ....

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions