-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
Consider this error message:
struct Qqq;
fn consume(_:Qqq){}
fn main() {
let a = Qqq;
consume(a);
consume(a);
}<anon>:6:13: 6:14 error: use of moved value: `a` [E0382]
<anon>:6 consume(a);
^
<anon>:5:13: 5:14 note: `a` moved here because it has type `Qqq`, which is non-copyable
<anon>:5 consume(a);
It look more or less clear. But if we move and try to use on the same line:
struct Qqq;
fn consume(_:Qqq){}
fn main() {
let a = Qqq;
loop {
consume(a);
}
}the diagnostic looks less clear:
<anon>:6:17: 6:18 error: use of moved value: `a` [E0382]
<anon>:6 consume(a);
^
<anon>:6:17: 6:18 help: see the detailed explanation for E0382
note: `a` was previously moved here (where?) because it has type `Qqq`, which is non-copyable
Note the absence of filename and line number.
Maybe it should point to the same line <anon>:6 or there should dedicated message mentioning the loop...
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints