Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E0623 Lifetime elision error emitted twice #90250

Open
Noratrieb opened this issue Oct 25, 2021 · 0 comments
Open

E0623 Lifetime elision error emitted twice #90250

Noratrieb opened this issue Oct 25, 2021 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Noratrieb
Copy link
Member

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

@Noratrieb Noratrieb added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 25, 2021
@TaKO8Ki TaKO8Ki self-assigned this Mar 28, 2022
@TaKO8Ki TaKO8Ki removed their assignment Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants