-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6a4dbffaa1c7bfe6e167b40eacaca921
The current output is:
error[E0499]: cannot borrow `decoder` as mutable more than once at a time
--> src/main.rs:15:29
|
15 | while let Some(frame) = decoder.read_next_frame().unwrap() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ `decoder` was mutably borrowed here in the previous iteration of the loop
It looks like the error is pointing to the wrong spot in the code and is quite misleading.
Ideally the output should mention that decoder
is still mutably borrowed because it holds a reference to frame
between loops. Or something, im not actually sure :P
I have confirmed that this occurs in both the latest stable (1.62.1) and nightly (1.64.0-nightly 4d6d601c8 2022-07-26
)
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.