Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible regression in release 127 - rust edition not detected, file not include in module tree #5861

Closed
clintfred opened this issue Aug 3, 2020 · 38 comments · Fixed by #6075
Labels

Comments

@clintfred
Copy link

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.

@Undin
Copy link
Member

Undin commented Aug 3, 2020

@clintfred Try to invalidate caches and restart your IDE via File | Invidate Caches/Restart action.

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?

You can download any plugin build from Marketplace. https://plugins.jetbrains.com/plugin/8182-rust/versions

@clintfred
Copy link
Author

clintfred commented Aug 3, 2020

@Undin Thanks for the quick response.

I have done Invalidate Caches/Restart a couple of times on both 2020.1 + 127 and 2020.2 + 127 to no avail.

Thanks for the pointer to the plugin. I had missed the 2020.2 version of 126 previously. For now I am using 2020.1 and 126 to try to get some things done while we work through this. I can try 2020.2 + 126 if that would be helpful.

@clintfred clintfred changed the title Possible bug in release 127 - rust edition not detected, file not include in module tree Possible regression in release 127 - rust edition not detected, file not include in module tree Aug 3, 2020
@Cightline
Copy link

Cightline commented Aug 4, 2020

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.

@clintfred
Copy link
Author

@Cightline are you doing any code generation? Do you have a custom build.rs?

@Undin
Copy link
Member

Undin commented Aug 5, 2020

@clintfred @Cightline is it reproduced for your even with a new project?

@Undin
Copy link
Member

Undin commented Aug 5, 2020

@Cightline could you provide a project example where it happens?

@Undin Undin added the bug label Aug 5, 2020
@clintfred
Copy link
Author

clintfred commented Aug 5, 2020

@clintfred @Cightline is it reproduced for your even with a new project?

Yes. I have two separate projects that I have re-created from nothing with the same result.
I have not tried creating a minimal example that reproduces this.

@Undin
Copy link
Member

Undin commented Aug 5, 2020

@clintfred sorry, my question wasn't clear enough. I meant, is it reproducible for you with "Hello World" project?

@clintfred
Copy link
Author

@clintfred sorry, my question wasn't clear enough. I meant, is it reproducible for you with "Hello World" project?

Haha. I realized what you meant and edited my above reply as you were typing this.

No. I haven't tried reproducing it in a "Hello World" project.

@Undin
Copy link
Member

Undin commented Aug 5, 2020

Haha. I realized what you meant and edited my above reply as you were typing this.

😃

No. I haven't tried reproducing it in a "Hello World" project.

Just want to identify the reason because it's not reproducible for me.
Could you check Cargo tool window?
Probably, Cargo "refresh" fails for some reason. In this case, the corresponding item in tool window should be underlined
image

@clintfred
Copy link
Author

clintfred commented Aug 5, 2020

Cargo "refresh" seems to succeed fine. I see it go through all the marco expansion passes in the status in the bottom. But then it just gets into the state I've described.

This screenshot is directly after pressing the "refresh" button in the Cargo view.

image

@Cightline
Copy link

@Cightline are you doing any code generation? Do you have a custom build.rs?

Nope.

@foresterre
Copy link

foresterre commented Aug 8, 2020

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.

@foresterre
Copy link

foresterre commented Aug 8, 2020

I've also just tested CLion 2020.2 with the Rust plugin version 0.3.126.3220-202, and this does seem to work (hurray! 😄) (so it is likely a regression in the plugin)

screenshot of working hello world project

image

@clintfred
Copy link
Author

@foresterre I tried https://github.com/foresterre/sic and https://github.com/foresterre/peekmore with IntelliJ Community 2020.1.4 with Rust plugin version 128 and I was not able to reproduce the "not included in module tree" issue. It did pop up initially, but after indexing finished, everything looked fine. I didn't try on plugin version 127. Does plugin version 128 work for you?

I tried my project on the 128 plugin and it still didn't build. :(

@foresterre
Copy link

@foresterre I tried foresterre/sic and foresterre/peekmore with IntelliJ Community 2020.1.4 with Rust plugin version 128 and I was not able to reproduce the "not included in module tree" issue. It did pop up initially, but after indexing finished, everything looked fine. I didn't try on plugin version 127. Does plugin version 128 work for you?

I tried my project on the 128 plugin and it still didn't build. :(

I just tested version 0.3.128.3278-202 on Windows; for me foresterre/sic it still failed with the same problem.

However, since it seems to work for you, I hypothesised, perhaps the issue is related in some way with some prior cache or index? To that end I removed the full installation caches and configuration folders located at:AppData/Roaming/JetBrains/IdeaIC2020.2 and AppData/Local/JetBrains/IdeaIC2020.2 (and later the respective CLion folders). I also removed the relevant caches and configuration folders at my user folder and the .idea folder in my sic project folder. After starting the IDE, and installing the 0.3.128.3278-202 Rust (+TOML) plugins, I opened sic as a project from the Cargo.toml, and so far it seems to work again 😄. I've re-opened the project a few times, and also opened it in CLion to verify switching between the two IDE's worked.

Initially I only removed the caches/configurations for Intellij CE, not for CLion, and opening the project with CLion showed the same problem as before; I can't recall exactly which removed cache/configuration folder resolved the problem; but it seems to work now... I haven't tried the same steps on Linux yet.

@inzanez
Copy link

inzanez commented Aug 24, 2020

I'm having similar difficulties for versions after 0.2.x on Linux. CLion is either 2019.x or 2020.2 which doesn't make a difference.

To reproduce, I can git clone https://github.com/tokio-rs/tokio and open up the tokio directory in CLion. It analyzes everything, afterwards many files show not included in the module tree.

@eliaskousk
Copy link

eliaskousk commented Aug 28, 2020

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.

@clintfred
Copy link
Author

clintfred commented Aug 28, 2020

@Undin I think we have a decent amount of evidence that a problem exists here, but I don't know that anyone has a fool proof way of reproducing the issue. I've been meaning to try out @inzanez's tokio project suggestion, but haven't yet. Has anyone internally been able to reproduce or have any ideas of root causes here?

While I'm thankful that plugin 126 doesn't have this problem, staying on that old version indefinitely doesn't sound like fun :)

@vlad20012
Copy link
Member

@inzanez what files in tokio should I check?

@inzanez
Copy link

inzanez commented Aug 28, 2020

@vlad20012 I just tried to reproduce the issue on my home machine. And it seems that even with the latest CLion and latest plugin version, I cannot. So I have the suspicion that it's tied to the version of the rust toolchain, as I'm on an older toolchain on this machine I'm using right now.

I will check tomorrow on the work machine and get back with some more insights. It's a bit weird.

@clintfred
Copy link
Author

Based on #5861 (comment) I think it's also possible this is a deeper caching issue that "Invalidate caches" doesn't catch, which might explain why your two systems exhibit different behavior.

Rust toolchain differences is something I hadn't previously considered.... Interesting.

@inzanez
Copy link

inzanez commented Aug 28, 2020

@clintfred well, I tried removing all CLion related data by deleting ~/CLionxxx and the '.idea' directory inside the project, but that didn't do anything...

@foresterre
Copy link

foresterre commented Aug 28, 2020

@vlad20012 I just tried to reproduce the issue on my home machine. And it seems that even with the latest CLion and latest plugin version, I cannot. So I have the suspicion that it's tied to the version of the rust toolchain, as I'm on an older toolchain on this machine I'm using right now.

I will check tomorrow on the work machine and get back with some more insights. It's a bit weird.

This was not a problem for me; I am (/was) at the latest version of stable Rust at the time where the problem occurred for me.

Initially I only removed the caches/configurations for Intellij CE, not for CLion, and opening the project with CLion showed the same problem as before; I can't recall exactly which removed cache/configuration folder resolved the problem; but it seems to work now... I haven't tried the same steps on Linux yet.

I also followed the same steps on Linux, and it now works 🎆

@Cightline
Copy link

Cightline commented Aug 29, 2020

Sorry, I haven't been paying attention to this discussion that much. The only "clue" I can think of is that I moved my Linux installation from one SSD to another (using rsync). After that is when the issue started happening. Are there any logs that I can link for you guys?

@inzanez
Copy link

inzanez commented Aug 29, 2020

Ok, I'm running CLION 2020.2, Intellij-Rust 0.3.129.3308-202, stable toolchain 1.45.2. I cloned the tokio repository, waited until all analyzing was complete, and opened src/net/mod.rs and get File is not included in module tree, analysis not available.

I'm using the same operating system as on the machine at home where things seem to work. I haven't placed an override on the tokio repository, so it's using the default toolchain.

I just upgraded CLion to 2020.3, just to check if that makes a difference, but it doesn't. So I removed all references to CLion from my operating system (install folder, ~/.config ~/.cache ~/.CLionxxx), all '.idea' folders in the projects and did a fresh install, fired it up, opened Tokio. Same again.

So as a last resort I now upgraded to the latest 1.46 toolchain, invalidate cache & restart, remove .idea, restart, remove and re-clone repository, restart, whatever I do it stays the same way :-/

@inzanez
Copy link

inzanez commented Aug 29, 2020

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.

@vlad20012
Copy link
Member

Wow, symlink

@clintfred
Copy link
Author

clintfred commented Aug 31, 2020

I also have a symlink involved in my affected projects. Great detective work @inzanez!

I will try to validate this behavior tomorrow and report back.

@foresterre
Copy link

Indeed, I too use symlinks for my projects.

@vlad20012
Copy link
Member

Do I understand right that before plugin version 127 it works correctly with symlinks? Or not?

@inzanez
Copy link

inzanez commented Aug 31, 2020

@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'.

@foresterre
Copy link

@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'.

For me the latest working release was 0.3.126.3220-201, and the above happened from version 0.3.127.3249-202.

bors bot added a commit that referenced this issue Sep 6, 2020
6075: Fix project under symlinked directory r=vlad20012 a=vlad20012

The bug was introduced in #5690 release-127

Fixes #5861, fixes #5962

_Probably we need a test for symlinked project_

Co-authored-by: vlad20012 <beskvlad@gmail.com>
@bors bors bot closed this as completed in a2a120f Sep 6, 2020
@bors bors bot closed this as completed in #6075 Sep 6, 2020
@clintfred
Copy link
Author

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

@Undin
Copy link
Member

Undin commented Sep 7, 2020

@clintfred the fix will be available in next stable release (around two weeks). Also, you can try in install nightly build. See instruction how to do it

@clintfred
Copy link
Author

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

@Bjohnson131
Copy link

Am seeing this on the 171 release.

@Undin
Copy link
Member

Undin commented Sep 19, 2022

@Bjohnson131 could you update the plugin to the latest version (178 at the moment of writing), please?
If a problem still exists, create a separate issue with more details, please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants