intellij-rust: Possible regression in release 127 - rust edition not detected, file not include in module tree

Environment

  • IntelliJ Rust plugin version: Release 127 – also tried 0.3.128.3262-202-nightly
  • Rust toolchain version: 1.45
  • IDE name and version: IntelliJ Community 2020.2 (was also the case on 2020.1)
  • Operating system: Kubuntu Linux 19.10

Problem description

After updating the plugin from 126 -> 127 my project had lots of various errors. I have tried reimporting the project, re-loading the Cargo.toml from the “Cargo” menu. In Release 126, I was using the “experimental macro engine” and I didn’t have any errors across my project.

I don’t really understand which of the following is a root problem, so I will just post some of the issues to give a picture of what I’m experiencing.

Edition is not being correctly detected and async keyword is disallowed

“This feature is only available in Edition 2018”

image

Source files are not being included in the module tree

“File is not included in module tree”

image

Modules declared at the top level are not found

“File not found for module”

see first screenshot

The one thing that makes this project different is that it is using rust-protobuf to do codegen and is including the generated code at the top of main. This means the project not only has a build.rs, but also an include! macro in main.rs.

I downgraded the plugin to 126 in 2020.1 and the project started building properly again. I can’t use plugin 126 in 2020.2. Is there a way I can get a build (or build myself) a version of 126 that I can use in 2020.2 while we work this out?

I did try suggestions in #3628 and #4907, but have not been able to find a resolution.

Thanks for your help, and thanks for an awesome plugin. 😃

Steps to reproduce

Source code for project is not open source, so this may be difficult.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 38 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@vlad20012 Thanks for the fix. What’s the best way to test this?

I’m having the same issue, I’ll try to downgrade for now.

edit: I can confirm version 0.3.126.3220-201 works for me.

I can confirm that on 2020.1 and plugin version 131 fixes this issue. 🎉

@vlad20012 Well, I can’t speak for anyone else here, but for me the latest release that didn’t have any issues with symlinks was ‘0.2.125.3191-202’. So before moving to ‘0.3.xxx’.

Ok, So I do have an update. It’s quite silly, but I figured out that the only remaining difference in my setup is that my projects directory that contains all the sources is a symlink to the real projects directory being located on another drive.

So I made a quick test and cloned tokio inside a test directory. When opening test/tokio directly, it works well. When creating a symlink test2 onto test, and opening the project using the symlink path, I get the issue about the files not being included in the module tree.

I will just remove the symlink and work directly with the projects directory.

I had the ‘File is not included in module tree, analysis is not available’ issue with 127 and 128 plugins on CLion 2020.2. I didn’t try these plugin versions on 2020.1 as I updated both CLion and the Rust plugin.

Solved it by downgrading to the 126 plugin as many here suggested. Thanks for the suggestions!

Update: Plugin 126 doesn’t work on the rustlings repository, but on other small projects I’m using to learn Rust it’s fixed.

I’m having the same problem on Windows (edit: and Linux):

image

logs: clion-logs-20200808-182910.zip

Environment

  • IntelliJ Rust plugin version: 0.3.127.3249-202
  • Rust toolchain version: 1.45.2 (d3fb005a3 2020-07-31) x86_64-pc-windows-msvc
  • IDE name and version: CLion 2020.2 (CL-202.6397.106)
  • Operating system: Windows 10 10.0

I also had the same problem with Intellij CE when I updated it to 2020.2.

The problem does not exist for me on Intellij 2020.1.4 with plugin version 126:

  • IntelliJ Rust plugin version: 0.3.126.3220-201
  • Rust toolchain version: 1.45.2 (d3fb005a3 2020-07-31) x86_64-pc-windows-msvc
  • IDE name and version: IntelliJ IDEA 2020.1.4 Community Edition (IC-201.8743.12)
  • Operating system: Windows 10 10.0

Invalidating caches doesn’t work for me. I’ve had the problem with all Rust projects I opened since updating (CLionn | Intellij) to 2020.2. Unsure if relevant, but since you asked for projects in which it happened: at least peekmore and sic. Peekmore doesn’t have a build.rs and consists of a single lib.rs. sic is a bigger project with multiple workspace crates and does have a build.rs file.

I’ve also just tested it with a freshly created project (shift+shift, new project, Rust, binary) and it has the same result (after indexing etc.):

image

I’ve also tested with plugin version 0.3.128.3273-202-beta on Linux, which has the same problem.