Open
Description
Given the following code:
fn foo(slice_a: &mut [u8], slice_b: &mut [u8]) {
core::mem::swap(&mut slice_a, &mut slice_b);
}
The current output is:
error[E0623]: lifetime mismatch
--> test.rs:2:35
|
1 | fn foo(slice_a: &mut [u8], slice_b: &mut [u8]) {
| --------- --------- these two types are declared with different lifetimes...
2 | core::mem::swap(&mut slice_a, &mut slice_b);
| ^^^^^^^^^^^^ ...but data from `slice_b` flows into `slice_a` here
error[E0623]: lifetime mismatch
--> test.rs:2:35
|
1 | fn foo(slice_a: &mut [u8], slice_b: &mut [u8]) {
| --------- ---------
| |
| these two types are declared with different lifetimes...
2 | core::mem::swap(&mut slice_a, &mut slice_b);
| ^^^^^^^^^^^^ ...but data from `slice_a` flows into `slice_b` here
This error is emitted twice, event though both errors have the same cause.
Ideally it would only be emitted for one direction.
Related: #90179