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

[Bug][move-compiler-v2] Copy mutable ref twice for == #14096

Closed
zzjas opened this issue Jul 23, 2024 · 0 comments · Fixed by #14282
Closed

[Bug][move-compiler-v2] Copy mutable ref twice for == #14096

zzjas opened this issue Jul 23, 2024 · 0 comments · Fixed by #14282
Assignees

Comments

@zzjas
Copy link

zzjas commented Jul 23, 2024

🐛 Bug

module 0xCAFE::Module0 {
    public fun function2() {
        let x = &mut 0u8;
        (copy x == copy x);
    }
}

This compiles with V1, but V2 will report:

error: mutable reference in local `x` requires exclusive access but is borrowed
  ┌─ ~/debug_package/sources/repro.move:4:20
  │
4 │         (copy x == copy x);
  │         -----------^^^^^^-
  │         │          │
  │         │          requirement enforced here
  │         conflicting reference used here

error: same mutable reference in value is also used in other value in argument list
  ┌─ ~/debug_package/sources/repro.move:4:9
  │
3 │         let x = &mut 0u8;
  │                 -------- previous mutable local borrow
4 │         (copy x == copy x);
  │         ^^^^^^^^^^^^^^^^^^ requirement enforced here

The operations are safe so probably just a difference in V1/V2's ref safety algorithm.

@zzjas zzjas added bug Something isn't working compiler-v2 move-smith labels Jul 23, 2024
@wrwg wrwg self-assigned this Jul 25, 2024
wrwg added a commit that referenced this issue Aug 15, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
wrwg added a commit that referenced this issue Aug 15, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
wrwg added a commit that referenced this issue Aug 16, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
wrwg added a commit that referenced this issue Aug 16, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
wrwg added a commit that referenced this issue Aug 17, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
wrwg added a commit that referenced this issue Aug 17, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
wrwg added a commit that referenced this issue Aug 17, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
wrwg added a commit that referenced this issue Aug 17, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
wrwg added a commit that referenced this issue Aug 17, 2024
Operators like Eq and Neq need to have their reference arguments frozen. This happened until now only for arguments of regular function calls.

Fixes #14060
Fixes #14096
@wrwg wrwg closed this as completed in d392f93 Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants