# error[E0759]: `X` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement

- **ID:** `rust/e0759-has-an-anonymous-lifetime`
- **Domain:** rust
- **Category:** type_error
- **Error Code:** `E0759`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A reference with an elided lifetime (anonymous `'_`) is passed where a `'static` lifetime is required, often in async or thread spawning contexts.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.74.0 | active | — | — |
| 1.76.0 | active | — | — |
| 1.78.0 | active | — | — |

## Workarounds

1. **Use `Arc<T>` and move the `Arc` into the closure/task: `let shared = Arc::new(data); tokio::spawn(async move { /* use shared */ });`** (85% success)
   ```
   Use `Arc<T>` and move the `Arc` into the closure/task: `let shared = Arc::new(data); tokio::spawn(async move { /* use shared */ });`
   ```
2. **Annotate the lifetime explicitly: `fn foo<'a>(x: &'a str) -> impl 'a + Future { ... }` and ensure the caller owns the data.** (78% success)
   ```
   Annotate the lifetime explicitly: `fn foo<'a>(x: &'a str) -> impl 'a + Future { ... }` and ensure the caller owns the data.
   ```

## Dead Ends

- **Adding `'static` lifetime bound to the generic parameter without ensuring the data lives long enough** — Causes borrow checker errors or requires `unsafe`; often the data is not actually static. (80% fail)
- **Using `Box::leak` to create a `&'static mut` reference** — Memory leak; only works if the data is truly intended to live forever, rare in practice. (70% fail)
