This ensures that if we emit the same diagnostic twice, the error count will match the real number of errors shown to the user. Fixes #42106
12 lines
427 B
Text
12 lines
427 B
Text
error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable
|
|
--> $DIR/issue-42106.rs:13:5
|
|
|
|
|
12 | let _a = &collection;
|
|
| ---------- immutable borrow occurs here
|
|
13 | collection.swap(1, 2); //~ ERROR also borrowed as immutable
|
|
| ^^^^^^^^^^ mutable borrow occurs here
|
|
14 | }
|
|
| - immutable borrow ends here
|
|
|
|
error: aborting due to previous error
|
|
|