Add this note to lifetime errors:
```text
error[E0521]: borrowed data escapes outside of function
--> $DIR/static-impl-obligation.rs:163:9
|
LL | fn bar<'a>(x: &'a &'a u32) {
| -- - `x` is a reference that is only valid in the function body
| |
| lifetime `'a` defined here
LL | let y: &dyn Foo = x;
LL | y.hello();
| ^^^^^^^^^
| |
| `x` escapes the function body here
| argument requires that `'a` must outlive `'static`
|
note: `'static` requirement for `<(dyn o::Foo + 'static)>::hello` introduced here
--> $DIR/static-impl-obligation.rs:158:40
|
LL | impl dyn Foo + 'static where Self: 'static {
| ^^^^^^^ `'static` requirement introduced here
LL | fn hello(&'static self) where Self: 'static {}
| ^^^^^^^ `'static` requirement introduced here
```
This currently only accounts for explicit bounds, other obligations like those arising from `Self` in a `impl dyn Trait {}` or from the receiver in `fn foo(&'static self)` are not accounted for.