Rust-analyzer VSC: Associated functions are not linked properly in doc comments

Sorry if that has been asked before - I searched and couldn't find a similar topic.

Hello. I have a problem with associated functions not being linked properly in documentation comments when using rust-analyzer with VSC. Look at the following code sample:

struct Foo {}
impl Foo {
    /// [Foo::baz()] - it links correctly in `cargo doc` but not in VSC!
    fn bar(self) {}

    /// [buzz] - linked properly in VSC and `cargo doc`
    fn baz(self) {}
}

fn buzz() {}

When I run cargo doc --open and go to the documentation page for Foo both implied shortcut reference links link to proper functions:
imgur link to the generated rustdoc page (as a new user only one embed is allowed)

But in VS Code, only buzz (which is not an associated function) is linked properly (i.e. it's in blue and can be clicked on to go to the function definition). For some reason, it cannot find Foo::baz(), but rustdoc obviously can.

So my question here is, is this intended behavior? Is this a bug? How can I make it link to Foo::baz() properly?

Thanks in advance. It's my first post here, please tell me if I did something wrong.

rust-analyzer extension version: v0.3.1123
VSC version: 1.69.0

You should probably check rust-analyzer's issue tracker if this isn't already tracked.

https://github.com/rust-lang/rust-analyzer/issues/9694

Oh, I hadn't thought of doing that. Thanks for finding it for me

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.