Rust

E0309 Type May Not Live Long Enough Fix

An impl can promise that T lives for 'a while the struct, enum, or function using that impl's associated type promises nothing - and E0309 is the compiler refusing to connect the two. This guide works that mismatch on a struct, an enum, and a function parameter, shows the two places the missing bound can be written, and separates this error from the 'static form, E0310, and from a borrowed value that dies too soon, E0597.

Written November 30, 2026 · Tested with Rust 1.99.1 · 17 min read

By the end of this guide
  • The rule underneath: a bound on the impl is not a bound on the user
  • How to read the diagnostic
  • The first failure: a struct field
  • The same error on an enum variant

Written November 30, 2026

Tested with Rust 1.99.1

What this guide is

Error E0309 is a bound that exists in one place and is missing in another. The error codes index states it in one line - "A parameter type is missing an explicit lifetime bound and may not live long enough" - and its erroneous example is a struct Foo<'a, T> with a field of the associated type <T as SomeTrait<'a>>::Output, where the impl of SomeTrait requires T: 'a and the struct states no matching bound. Its explanation: "The type definition contains some field whose type requires an outlives annotation", and "the where clause T: 'a that appears on the impl is not known to be satisfied on the struct".

The practical payoff is that nothing here is wrong with the data or with a value's lifetime. No variable dies too soon in the programs below - the failure is at the definition, before any value exists, and the repair is one bound written on the definition that uses the associated type: on the struct, the enum, or the function. The forms in this guide each reproduce E0309 with a small, complete program - a struct field, an enum variant, a function parameter, and a struct carrying a second lifetime - followed by the shapes that raise no error, the neighbors with near-identical wording, and the repairs.

Build every program in this guide with rustc --edition 2021. In the compiler transcripts below, the file names are the bare names shown on the command line.

The rule underneath: a bound on the impl is not a bound on the user

A lifetime bound T: 'a is an outlives annotation. The trait and lifetime bounds chapter of the Rust Reference states it directly: "T: 'a means that all lifetime parameters of T outlive 'a", and bounds "can be provided on any type in a where clause", with the shorter form written after the generic parameter - fn f<A: Copy>() {} "is the same as" the where-clause form. So the missing bound has two equivalent spellings, inline and in a where clause, and the fixes section uses both.

The mismatch that produces E0309 is about who has to state the bound. The impl in the programs below promises T: 'a for its own associated type. A struct that stores <T as SomeTrait<'a>>::Output is a different definition, and the impl's promise is not inherited by it: the struct must state, for itself, that any T it is used with meets the requirement its field's type carries. Until it does, the compiler cannot know that the field type is well-formed for every T a caller might choose, so the definition itself is rejected - which is why main in the failing programs below does nothing at all and is never reached.

Two consequences follow. First, the error is reported at the definition - at the field, the variant, or the signature - not at a use of a value. Second, every repair works by closing the gap between the two definitions: state the bound where it is missing, or, in the one probed program where that was tried, remove the requirement from the impl so there is no gap left.

How to read the diagnostic

The header is "the parameter type T may not live long enough", with the code E0309, naming the parameter that lacks the bound. Two labels frame the gap. The first sits on the definition's lifetime parameter and reads "the parameter type T must be valid for the lifetime 'a as defined here..." - that is the lifetime the bound has to name. The second underlines the associated type itself, at the field, variant, or parameter, and reads "...so that the type T will meet its required lifetime bounds". Below them, the help is the repair in its inline spelling: "consider adding an explicit lifetime bound", shown as T: 'a added to the definition's parameter list.

One diagnostic detail separates this error from its closest neighbor at a glance: the lifetime in the labels is a named lifetime from the definition, 'a - when the required lifetime is 'static and the field is a plain reference, the same header sentence arrives under a different code, E0310, covered below.

The first failure: a struct field

This is the index's own form - a struct whose only field is an associated type, an impl that requires T: 'a, and a struct that states nothing:

Rust
struct Foo<'a, T> {
    foo: <T as SomeTrait<'a>>::Output,
}

trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn main() {
    println!("ok");
}
Output
error[E0309]: the parameter type `T` may not live long enough
 --> q1.rs:2:10
  |
1 | struct Foo<'a, T> {
  |            -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
2 |     foo: <T as SomeTrait<'a>>::Output,
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
  |
help: consider adding an explicit lifetime bound
  |
1 | struct Foo<'a, T: 'a> {
  |                 ++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0309`.

The error lands on line 2, the field - the struct definition is rejected as written, and the main that only prints a word is never the problem. The help writes the whole repair: T: 'a on the struct's parameter list. The where-clause spelling of the same repair is worked in the fixes section below.

The same error on an enum variant

An enum variant that carries the associated type as its payload is the same definition shape, and draws the same diagnostic with the underline on the variant:

Rust
enum Wrap<'a, T> {
    Value(<T as SomeTrait<'a>>::Output),
    Empty,
}

trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn main() {
    println!("ok");
}
Output
error[E0309]: the parameter type `T` may not live long enough
 --> q2.rs:2:11
  |
1 | enum Wrap<'a, T> {
  |           -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
2 |     Value(<T as SomeTrait<'a>>::Output),
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
  |
help: consider adding an explicit lifetime bound
  |
1 | enum Wrap<'a, T: 'a> {
  |                ++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0309`.

Only the spans move - the variant line instead of the field line, and the help rewriting the enum's header. The Empty variant and the trait and impl are untouched by the error; the payload type is the whole problem, exactly as the field was for the struct.

The same error on a function parameter

The missing bound is not only a type-definition problem. A function whose parameter is the associated type states no bound either, and here the compiler reports the same gap twice - once at the parameter type and once across the whole signature:

Rust
trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn show<'a, T>(value: <T as SomeTrait<'a>>::Output) -> u32 {
    value
}

fn main() {
    println!("{}", show::<u32>(4));
}
Output
error[E0309]: the parameter type `T` may not live long enough
  --> q3.rs:12:23
   |
12 | fn show<'a, T>(value: <T as SomeTrait<'a>>::Output) -> u32 {
   |         --            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
   |         |
   |         the parameter type `T` must be valid for the lifetime `'a` as defined here...
   |
help: consider adding an explicit lifetime bound
   |
12 | fn show<'a, T: 'a>(value: <T as SomeTrait<'a>>::Output) -> u32 {
   |              ++++

error[E0309]: the parameter type `T` may not live long enough
  --> q3.rs:12:1
   |
12 | fn show<'a, T>(value: <T as SomeTrait<'a>>::Output) -> u32 {
   | ^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |       |
   | |       the parameter type `T` must be valid for the lifetime `'a` as defined here...
   | ...so that the type `T` will meet its required lifetime bounds
   |
help: consider adding an explicit lifetime bound
   |
12 | fn show<'a, T: 'a>(value: <T as SomeTrait<'a>>::Output) -> u32 {
   |              ++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0309`.

That is the one form in this guide where E0309 arrives in duplicate: "error: aborting due to 2 previous errors", both copies naming the same missing T: 'a on the same line, one underlining the parameter type and one underlining the signature that contains it. The repair is the same one bound, written once on the function - worked in the fixes section, where the repaired show runs and prints its argument.

A second lifetime does not stand in for the bound

Giving the struct another lifetime for another field does not dilute the requirement. This struct carries a plain &'b str alongside the associated type, and the error is unchanged - it names 'a, the lifetime on the impl's requirement, and ignores 'b entirely:

Rust
struct Pair<'a, 'b, T> {
    first: <T as SomeTrait<'a>>::Output,
    second: &'b str,
}

trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn main() {
    println!("ok");
}
Output
error[E0309]: the parameter type `T` may not live long enough
 --> q4.rs:2:12
  |
1 | struct Pair<'a, 'b, T> {
  |             -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
2 |     first: <T as SomeTrait<'a>>::Output,
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
  |
help: consider adding an explicit lifetime bound
  |
1 | struct Pair<'a, 'b, T: 'a> {
  |                      ++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0309`.

The reference field is well-formed on its own - a struct holding only a reference like it compiles, as the no-error section shows - and it neither causes nor softens this error. The bound that is missing is specifically T: 'a: a statement about the parameter T, not about any lifetime the struct happens to declare.

The trap: bounding the associated type instead

Trap
A natural first guess is to move the requirement onto the associated type - declare type Output: 'a; in the trait, so the output itself is promised to live for 'a. In this probed program that changes nothing:
Rust
struct Foo<'a, T> {
    foo: <T as SomeTrait<'a>>::Output,
}

trait SomeTrait<'a> {
    type Output: 'a;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn main() {
    println!("ok");
}
Output
error[E0309]: the parameter type `T` may not live long enough
 --> q6.rs:2:10
  |
1 | struct Foo<'a, T> {
  |            -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
2 |     foo: <T as SomeTrait<'a>>::Output,
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
  |
help: consider adding an explicit lifetime bound
  |
1 | struct Foo<'a, T: 'a> {
  |                 ++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0309`.

The transcript is the struct transcript again, span for span: the requirement the compiler is missing is on T, the parameter, and a bound on Output is a statement about a different type. In the programs probed here, the bound has to be written on the definition that uses the associated type, against T itself.

The shapes that raise no error

A type alias for the same associated type, defined on its own, compiles in this probed program - the alias states the projection and nothing stores or passes it, and no E0309 is raised at the alias line:

Rust
type Out<'a, T> = <T as SomeTrait<'a>>::Output;

trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn main() {
    println!("ok");
}
Output
ok

The output is ok. That is a statement about this program only: the alias as written here drew no error. What it shows is where the error attaches - not to the projection written in isolation, but to a definition that builds on it, a field, a variant payload, or a parameter, without restating the bound the impl requires.

A plain reference field needs no parameter bound at all, because there is no generic parameter and no associated type in the definition:

Rust
struct Holder<'a> {
    text: &'a str,
}

fn main() {
    let h = Holder { text: "hi" };
    println!("{}", h.text);
}
Output
hi

The output is hi. Holder ties its field to its own lifetime parameter directly, &'a str, and that is a complete statement - there is no second definition carrying a requirement this one has failed to repeat.

The traps: neighbors that are not E0309

Trap
Two errors share this one's vocabulary and are not it. The first shares the exact header sentence. When the field is a plain &'static T reference and the parameter lacks a 'static bound, the code is E0310, not E0309:
Rust
struct Foo<T: ?Sized> {
    data: &'static T,
}

fn main() {
    println!("ok");
}
Output
error[E0310]: the parameter type `T` may not live long enough
 --> n1.rs:2:11
  |
2 |     data: &'static T,
  |           ^^^^^^^^^^
  |           |
  |           the parameter type `T` must be valid for the static lifetime...
  |           ...so that the reference type `&'static T` does not outlive the data it points at
  |
help: consider adding an explicit lifetime bound
  |
1 | struct Foo<T: ?Sized + 'static> {
  |                      +++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0310`.

The header reads identically - "the parameter type T may not live long enough" - but the labels differ: "must be valid for the static lifetime" and "...so that the reference type &'static T does not outlive the data it points at", and the help adds + 'static to a ?Sized parameter. The line between the two codes, in the forms probed here, is what the field holds: an associated type whose impl carries the lifetime requirement is E0309; a plain reference to the parameter under 'static is E0310.

The second neighbor is about a value, not a parameter. A borrow of a local that is dropped while the borrow is still used is E0597, "y does not live long enough":

Rust
fn main() {
    let x;
    {
        let y = 4;
        x = &y;
    }
    println!("{}", x);
}
Output
error[E0597]: `y` does not live long enough
 --> n2.rs:5:13
  |
4 |         let y = 4;
  |             - binding `y` declared here
5 |         x = &y;
  |             ^^ borrowed value does not live long enough
6 |     }
  |     - `y` dropped here while still borrowed
7 |     println!("{}", x);
  |                    - borrow later used here

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0597`.

There is no parameter, no bound, and no help offering one - the labels walk a timeline instead: "binding y declared here", "borrowed value does not live long enough", "y dropped here while still borrowed", "borrow later used here". E0309's fix is a bound on a definition; E0597's problem is the order of events in a function body, and no bound written anywhere repairs it.

Fixes in reach order

When E0309 appears, close the gap between the impl's requirement and the definition that uses its associated type, in this order. First, state the bound in a where clause on the definition - the repair the error index itself demonstrates. Applied to the first failure:

Rust
struct Foo<'a, T>
where
    T: 'a,
{
    foo: <T as SomeTrait<'a>>::Output,
}

trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn main() {
    let f: Foo<'static, u32> = Foo { foo: 4 };
    println!("{}", f.foo);
}
Output
4

The output is 4: with T: 'a in the struct's where clause, the definition is accepted, and the program constructs Foo<'static, u32> holding 4 and prints the field.

Second, write the same bound inline, in the spelling the diagnostic's help offers - T: 'a in the parameter list instead of a where clause:

Rust
struct Foo<'a, T: 'a> {
    foo: <T as SomeTrait<'a>>::Output,
}

trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn main() {
    let f: Foo<'static, u32> = Foo { foo: 4 };
    println!("{}", f.foo);
}
Output
4

The output is 4 again, from the same construction. The two spellings are the same bound; the inline form suits a definition with one bound to state, and the where clause suits a definition already carrying several. The enum and the function take the where-clause and inline forms the same way. The enum, repaired with a where clause:

Rust
enum Wrap<'a, T>
where
    T: 'a,
{
    Value(<T as SomeTrait<'a>>::Output),
    Empty,
}

trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn main() {
    let w: Wrap<'static, u32> = Wrap::Value(4);
    match w {
        Wrap::Value(v) => println!("{}", v),
        Wrap::Empty => println!("empty"),
    }
}
Output
4

The output is 4, the payload of the Value variant. And the function from the duplicate-error form, repaired inline:

Rust
trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T
where
    T: 'a,
{
    type Output = u32;
}

fn show<'a, T: 'a>(value: <T as SomeTrait<'a>>::Output) -> u32 {
    value
}

fn main() {
    println!("{}", show::<u32>(4));
}
Output
4

The output is 4, the argument show returns - one bound on the function removes both copies of the error that the unbound signature drew.

Third, look at the other side of the gap: the requirement itself. In this probed program the impl's T: 'a was the only place the bound was required, and removing the where clause from the impl also lets the original struct compile:

Rust
struct Foo<'a, T> {
    foo: <T as SomeTrait<'a>>::Output,
}

trait SomeTrait<'a> {
    type Output;
}

impl<'a, T> SomeTrait<'a> for T {
    type Output = u32;
}

fn main() {
    let f: Foo<'static, u32> = Foo { foo: 4 };
    println!("{}", f.foo);
}
Output
4

The output is 4. That is a statement about this program, where the single impl sets Output = u32 for every T: with no requirement on the impl, there is no requirement for the struct to repeat. It is the right move only when the bound on the impl is not doing work the impl actually needs - when it is needed, the repair belongs on the struct, the enum, or the function, not on deleting the requirement. Last, if the diagnostic is not E0309 at all, switch playbooks: E0310 is the same sentence for a plain &'static T field (add the 'static bound the help shows), and E0597 is a borrowed value dropped too early (change the lifetime of the value or the scope of the borrow in the function body - no bound is involved).

Decision summary

E0309, "the parameter type T may not live long enough", is a definition - a struct field, an enum variant payload, or a function parameter in the forms probed here - using an associated type whose impl requires T: 'a, while the definition itself states no such bound. The error is reported at the definition, with one label naming the lifetime 'a and one underlining the associated type, and a help offering the inline bound; on a function signature it is reported twice, at the parameter and across the signature. Bounding the associated type in the trait does not remove it in the probed program, a second unrelated lifetime does not stand in for it, and a type alias for the projection on its own, and a plain reference field, raise no error. The repair states the missing bound on the definition - as a where clause or inline, both worked above - or, in the probed program where the impl's bound was removable, removes the requirement at the impl. Two neighbors are not this error: a plain &'static T field missing its bound is E0310 under the same header sentence, and a borrowed local dropped while still borrowed is E0597.

Checklist

  • The bound is added to the definition that uses the associated type - the struct, enum, or function - not to the trait's associated type.
  • The bound names the same lifetime the impl requires: T: 'a for the impl's 'a, written inline or in a where clause.
  • An unrelated lifetime already on the definition is not treated as covering the requirement.
  • A duplicate E0309 on a function signature is one missing bound, fixed once, not two separate problems.
  • The impl's own bound is removed only when the impl does not actually need it; otherwise the requirement stays and the using definition repeats it.
  • E0309 is told apart from E0310 by the lifetime the impl or field requires (a named 'a on an associated type is E0309; a 'static requirement is E0310, whether the field holds an associated type or a plain &'static reference) and from E0597 by the subject (a parameter type vs a borrowed value).

Sources

  • Rust error codes index, E0309 - a parameter type is missing an explicit lifetime bound and may not live long enough, its erroneous example a struct field of <T as SomeTrait<'a>>::Output whose impl requires T: 'a, its explanation that the type definition contains a field whose type requires an outlives annotation and that the impl's where clause is not known to be satisfied on the struct, and its repair adding a where clause like T: 'a to the struct definition.
  • The Rust Reference, Trait and lifetime bounds - T: 'a means that all lifetime parameters of T outlive 'a, bounds can be provided on any type in a where clause, and bounds written after a generic parameter are the same as the where-clause form.

Keep Exploring