Internal Compiler Error when building an async closure that calls methods on a referenced variable and a cloned referenced variable in a specific order #123697
Labels
C-bug
Category: This is a bug.
F-async_closure
`#![feature(async_closure)]`
F-async_fn_traits
`#![feature(async_fn_traits)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
This bug only happens when calling a method on two different referenced variables inside an async closure. For some reason, this bug will not happen if the lines are flipped (calling it on test first then temp). It also will not happen if test isn't cloned outside the closure first.
This will error:
This will not:
Neither will:
Nor will:
But if both the order is flipped and the line order is flipped it will crash (variable name changed to make sure shadowing wasn't the issue):
This setup for the bug was found entirely through trial and error. The original issue was found in a nightly build of a project I'm working on (https://github.com/BigBadE/Raven-Language/actions/runs/8608806965/job/23628381189).
Meta
This bug was introduced in the latest version of nightly (2024-04-08). It was not present in 2024-04-07.
rustc 1.79.0-nightly (ab5bda1 2024-04-08)
binary: rustc
commit-hash: ab5bda1
commit-date: 2024-04-08
host: x86_64-pc-windows-msvc
release: 1.79.0-nightly
LLVM version: 18.1.3
Error output
The text was updated successfully, but these errors were encountered: