SIGN IN SIGN UP

Don't list escaping bound regions in nested `for<...>` binders of E0308 notes

The `for<...>` prefixes in `cmp_fn_sig` are built from the region map
returned by `name_all_regions`. That map also contained regions that are
bound by an enclosing binder and merely escape through the binder being
named, so nested binders in expected/found notes listed lifetimes they
don't bind, printing invalid types such as
`&mut for<'a> fn(for<'a> fn(&'a ()))` for `&mut for<'a> fn(fn(&'a ()))`.

Key the folder's map by the region's binder offset and only return the
regions actually bound by the binder being named. The offset in the key
also fixes a latent collision between a bound and an escaping region
sharing the same bound variable index. The printed text is unaffected:
the `name` closure already skips escaping regions when writing to the
printer, which is why diagnostic labels were already correct.
R
Rani367 committed
2686c8c0128c0cd672f5b6df5603f7743f64b846
Parent: 5503df8