Rellum Rellum

S0136: cannot return reference to local value

Generated from rellum-diagnostics/src/db.rs.

Explanation

Local bindings and temporaries are dropped when their function or block region ends. Returning a reference to one would let callers observe storage that no longer exists.

Common causes

Canonical fixes

Before:

bad() : &Int =
    x = 1
    &x

After:

ok() : Int =
    x = 1
    x

Code example

bad() : &Int =
    x = 1
    &x