question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

False Cannot move on primitive types

See original GitHub issue

Environment

  • IntelliJ Rust plugin version: 0.2.114.2151-193
  • Rust toolchain version: 1.42 nightly
  • IDE name and version: CLion 2019.3.3
  • Operating system: Windows 10

Problem description

Since the last update, there are a ton of false positive “Cannot move” errors on copying primitive types:

fn get_time_multiplier(&self) -> f32 {
    self.time_multiplier // Cannot move
}

Steps to reproduce

Create a struct with a filed of primitive type and a getter for it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Octogonapuscommented, Feb 10, 2020

I have also run into this issue. Code to reproduce: https://pastebin.com/4HS4w9Se The issue is on line 37, self.ft * rhs.ft: self and rhs are red-underlined with the tooltip “Cannot move”.

I am not using the experimental macro expansion. I have tried invalidating my caches and restarting.

  • IntelliJ Rust plugin version: 0.2.115.2157-193
  • Rust toolchain version: 1.41.0 (5e1a79984 2020-01-27) x86_64-unknown-linux-gnu
  • IDE name and version: IntelliJ IDEA 2019.3.2 Ultimate Edition (IU-193.6015.39)
  • Operating system: Linux 5.0.0-37-generic
0reactions
ariymarkowitzcommented, Jul 5, 2021

I am having this issue. The following is a minimal example:

struct Test {
    value: u32
}

impl Test {
    fn test(&self) -> u32 { self.value } // 'Cannot move'
}

The error only appears when I include the dependency bevy = "0.5" (even though I am not using the package). I have not found any other packages that replicate this behaviour. Earlier versions of Bevy do not cause this behaviour.

I have tried invalidating the cache and restarting, and making a new project. The problem goes away when I set ‘Expand declarative macros’ to ‘Use old engine’.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot move std::any - c++ - Stack Overflow
The problem is not moving std::any, it's that std::any itself does not support move-only types (std::unique_ptr for example).
Read more >
How to Handle the Incompatible Types Error in Java - Rollbar
The Java incompatible types error happens when a value assigned to a variable or returned by a method is incompatible with the one...
Read more >
Data Types in Java | Primitive and Non-Primitive Data Types
A boolean data type comprises of a bit of information and can store only true or false values. This data type is used...
Read more >
Primitive Data Types (The Java™ Tutorials > Learning the ...
The eight primitive data types supported by the Java programming language ... boolean: The boolean data type has only two possible values: true...
Read more >
Understanding when not to std::move in C++
In this article, I will introduce two new warnings I've implemented for GCC 9 that deal with incorrect usage of std::move . -Wpessimizing-move....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found