Skip to content

"Doesn't live long enough" error can be further improved #36537

Closed
@sophiajt

Description

@sophiajt

From @nikomatsakis (based on a chat with @wycats) - we can further improve the "doesn't live long enough" error by talking a bit more about how the values flow through the error. Something like:

error: `x` does not live long enough
 --> <anon>:4:10
  |
4 |     p = &x;
  |          - borrow occurs here
5 | }
  | ^ `x` dropped here while still borrowed
  |
= note: values in a scope are dropped in the opposite order they are created

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions