Skip to content

bug: Can't complete nest use. can't jump to definition #5958

Closed
@SolaWing

Description

@SolaWing

given the follow in file other.rs

//! other
#[derive(Default, Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
pub struct Foo {
}

pub trait Tr {
    fn bar(&self);
}

impl Foo {
    fn other() {
        println!("other");
    }
}

impl Tr for Foo {
    fn bar(&self) {
        Self::other();
    }
}

and main.rs

//! main.rs
mod other;
// use other::Tr; // if uncomment this, completion fine, but a.bar() can only jump to trait declaration, can't jump to definition.

/// hello
fn main() {
    use other::Tr;
    let a = other::Foo::default();
    a.bar();
    a.b // <-- no completion tip
}

trait is use nest in fn, compile fine but a.b not have completion tip.

if use other::Tr; at top, completion fine, but a.bar() can only jump to trait declaration, can't jump to Foo's definition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions