intellij-rust: Good code red: cannot move

Environment

  • IntelliJ Rust plugin version: 0.3.132.3395-202
  • Rust toolchain version: 1.47 stable
  • IDE name and version: IntelliJ IDEA 2020.2.3
  • Operating system: Linux Ubuntu 20.04

Problem description

With the recent upgrade of Rust plugin I see plenty of “cannot move” errors, despite the code compiling fine.

Minified example:

pub struct Mean {
    pub value: f64,
    pub std_err: f64,
}

pub fn t_test(mean1: &Mean, mean2: &Mean) -> f64 {
   let v1 = mean1.value;     // << mean1 underlined, "cannot move", despite f64 being Copy
   let s1 = mean1.std_err;   // << mean1 underlined, "cannot move", despite f64 being Copy
   // ... 
    0.0
}

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 4
  • Comments: 17 (3 by maintainers)

Most upvoted comments

I appear to be having the same issue as well. @Undin Invalidating the caches and restarting IntelliJ hasn’t worked. This appears to be a valid bug since it’s also happening to me.

I got this bug with the last update. Invalidating caches does not help, purging .idea/workspace.xml fixes it. Did a bit more investigating, looks like this line within .idea/workspace.xml was causing the issue:

<setting file="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs" root0="SKIP_INSPECTION" />

It is easy to reproduce this bug by array.

image

About CLion
CLion 2022.1
Build #CL-221.5080.224, built on April 14, 2022
Licensed to (removed)
Subscription is active until April 13, 2023.
Runtime version: 11.0.14.1+1-b2043.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.17.1-arch1-1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry:
    run.processes.with.pty=TRUE
    cidr.max.intellisense.file.length=1000000

Non-Bundled Plugins:
    leetcode-editor (8.0)
    YAML/Ansible support (0.11.2)
    org.rust.lang (0.4.168.4555-221)
    izhangzhihao.rainbow.brackets (6.21)

Current Desktop: X-Cinnamon

@pkolaczk try to invalidate caches and restart IDE via File | Invalidate Caches / Restart action