No reliable rust docs with clion

Is anyone else unable to see rust documentation within clion utilizing the rust plugin?  The only code that reliably gives me any data is project code I've written. Lets say I have the following 

fn main() {
    let names = vec!["Bob", "Frank", "Ferris"];

    for name in names.iter() {
        match name {
            _ => println!("Hello {}", name),
  println!("names: {:?}", names);

Mousing over or clicking on and crtl-q'ing ".iter()" gives me the message "no documentation found", same for any function that is used by the project.  There are a few macros that do produce documentation, println!() and vec![] both show correct documentation, 

I've tried Help | Find Action > Refresh Cargo Projects, invalidating caches, re-installing etc.  Has anyone had any luck fixing this?


Official comment

Hello! Thank you for your report about the issue.
I couldn't reproduce the described behavior in my environment (CLion2023.2.1 and Rust plugin, neither with the thread author's example nor by adding Regex crate to my project (manually and using the 'cargo add' command).
My algorithm is:
1. Add the Regex crate to the project.
2. Perform “Load cargo changes”.
3. Write test code.
4. Hover over the code and ensure the documentation is displayed correctly.

The "Refresh Cargo Projects" action picks up the new docs successfully.

Please clarify your steps: Did you add a crate, perform the “Load cargo changes”, observe the issue, perform “Refresh Cargo Projects”, and the problem was solved?

Today, I used the regex crate in CLion 2022.3 and got "no documentation found". But after "Refresh Cargo Projects", the documentation was found when using Ctrl-Q. So yes, in 2022.3 "Refresh Cargo Projects" was fixing it for me.


I'm also seeing this with CLion 2023.1.3, and Rust plugin, especially after adding a new crate to the Cargo.toml file. The "Refresh Cargo Projects" action picks up the new docs successfully.


Maksim Semenov Zendesk makes it unclear if you're addressing me or the original poster, but you quoted part of my reply so I'll assume the former:

Please clarify your steps: Did you add a crate, perform the “Load cargo changes”, observe the issue, perform “Refresh Cargo Projects”, and the problem was solved?

Not quite - I do not know what “Load cargo changes” is. Instead, I did:

  1. `cargo add <new crate name>` on the command line,
  2. Observe no docs, no IDE recognition of new crate references,
  3. Click “Refresh Cargo Projects” in the Cargo fold-out on the right hand side,
  4. Observe that docs now work, and IDE recognises new crate references.

I suspect this is working as intended, but it could be nice if the plugin detected changes to `Cargo.toml` and suggested a refresh, like CLion does with CMakeLists.txt files?



Thank you for your responce D Antliff 
After adding a new crate, reloading the project model is necessary. It allows IDE to update its indexes for the new dependencies to provide code autocompletion, show documentation, etc.
This behavior is controlled by setting "Reload project after changes in the build scripts" 
By default, the "Reload project after changes" in the build scripts checkbox is ticked, and the "External changes option" is selected. This means that the project model will be reloaded automatically only for external changes (for example, when you add a crate by the "cargo add" command, as you mentioned) and you need to wait until reloading is finished.
You can see progress at the bottom of the IDE window. Note that the indexing and loading process may take some time, especially for crates with many dependencies. Code autocompletion, documentation, etc., are unavailable for new-added crate during this.  I made a little screencast for the demonstration link
So please check your settings, add a new crate, wait for the finishing reloading project process, and try reproducing the issue.

If the issue still exists please try to perform Invalidate caches with the checked "Clear file system cache and Local History" option.

If that didn't help either, please send the logs ( Help | Collect Logs and Diagnostic Data) and I will try to figure out what is happening. Please remember that `idea.log` might contain sensitive information (e.g local paths). You can upload your logs to our Uploaded files will only be accessible to JetBrains employees, and we guarantee the privacy of the data.

I do not know what “Load cargo changes” is

 When you make changes in the project configuration (for example add new crate to Cargo.toml manually or If "Reload project after changes in the build script" option is turned off), you’ll be offered the Load Cargo Changes button, which allows you to load changes (reload project model).


Please sign in to leave a comment.