Skip to content

validate-ownership has no leak check: a compiler temporary still Init at return passes #1488

Closed

Description

@ehartford

--validate-all / --validate-ownership have no leak check: a drop-bearing local that is Init at a return (no move, no drop, no StorageDead-after-drop on that path) passes.

Two leaks this week passed the validators with ok:

Expected: the ownership validator reports a drop-bearing, non-user, non-global local (a compiler temporary) whose state reaching a return terminator is Init or Maybe: "temporary _3 (str) is still owned at return on a path from bb2; it leaks". User bindings get a scope-exit drop by construction; temporaries are exactly where the #771/#1390 class lives.

Sweep the corpora with the check before landing it; statement temps that MIR deliberately hands to another owner through a raw copy (not a move) would surface as findings and need a real move there.

Activity

  1. ehartford commented on Sep 26, 2026

    @ehartford
    ContributorAuthor

    Fixed by #1718 with #1384's leak rule, which covers compiler temporaries as well as named locals (the pre-pass keys on any local a drop targets).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions