Skip to content

Suggest adding a generic lifetime parameter #64579

Description

@varkor
fn foo(
    mut x: &(),
    y: &(),
) {
    x = y;
}

gives the error:

error[E0623]: lifetime mismatch
 --> src/lib.rs:5:9
  |
2 |     mut x: &(),
  |            ---
3 |     y: &(),
  |        --- these two types are declared with different lifetimes...
4 | ) {
5 |     x = y;
  |         ^ ...but data from `y` flows into `x` here

but does not suggest the solution: adding a new lifetime parameter 'a to foo and giving both variables the same lifetime.

Activity

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 lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.T-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

      Issue actions