Skip to content

E0623 Lifetime elision error emitted twice #90250

@Noratrieb

Description

@Noratrieb
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

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Oct 25, 2021
self-assigned this
on Mar 28, 2022
removed their assignment
on Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @TaKO8Ki@Noratrieb

        Issue actions

          E0623 Lifetime elision error emitted twice · Issue #90250 · rust-lang/rust