# error[E0271]: type mismatch resolving `<X as Y>::Z` -- expected bound lifetime parameter `'a`, found concrete lifetime

- **ID:** `rust/e0271-expected-bound-lifetime-parameter`
- **Domain:** rust
- **Category:** type_error
- **Error Code:** `E0271`
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

A trait bound or associated type expects a generic lifetime parameter, but the implementation provides a concrete lifetime, causing a mismatch in higher-ranked trait bounds.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| rustc 1.72.0 | active | — | — |
| rustc 1.75.0 | active | — | — |
| rustc 1.80.0 | active | — | — |

## Workarounds

1. **Explicitly annotate the higher-ranked lifetime using `for<'a>` syntax in the trait bound, e.g., `T: for<'a> MyTrait<'a>`.** (85% success)
   ```
   Explicitly annotate the higher-ranked lifetime using `for<'a>` syntax in the trait bound, e.g., `T: for<'a> MyTrait<'a>`.
   ```
2. **Refactor the associated type to use a generic lifetime parameter instead of a concrete one, e.g., change `type Output = &i32` to `type Output<'a> = &'a i32`.** (80% success)
   ```
   Refactor the associated type to use a generic lifetime parameter instead of a concrete one, e.g., change `type Output = &i32` to `type Output<'a> = &'a i32`.
   ```
3. **Use a boxed trait object with dynamic dispatch to avoid lifetime parameter mismatches.** (75% success)
   ```
   Use a boxed trait object with dynamic dispatch to avoid lifetime parameter mismatches.
   ```

## Dead Ends

- **** — Forces all references to be 'static, which is often too strict and may cause new borrow-checker errors. (65% fail)
- **** — Lifetime elision often defaults to '_, which may still not match the expected bound, and the error may shift to a different location. (55% fail)
