diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2019-08-08 03:36:24 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2019-08-19 13:50:42 -0400 |
| commit | af86fb1959b520ae0256272899df5c43b11df2a7 (patch) | |
| tree | c1a076002aabb33c37bc366694a4dc940addce24 /src/libsyntax/parse/parser/expr.rs | |
| parent | b51df1def0e621fd5fd6cb777511d64d490c0363 (diff) | |
| download | rust-af86fb1959b520ae0256272899df5c43b11df2a7.tar.gz rust-af86fb1959b520ae0256272899df5c43b11df2a7.zip | |
distinguish object-lifetime-default elision from other elision
Object-lifetime-default elision is distinct from other forms of elision; it always refers to some enclosing lifetime *present in the surrounding type* (e.g., `&dyn Bar` expands to `&'a (dyn Bar + 'a)`. If there is no enclosing lifetime, then it expands to `'static`. Therefore, in an `impl Trait<Item = dyn Bar>` setting, we don't expand to create a lifetime parameter for the `dyn Bar + 'X` bound. It will just be resolved to `'static`. Annoyingly, the responsibility for this resolution is spread across multiple bits of code right now (`middle::resolve_lifetimes`, `lowering`). The lowering code knows that the default is for an object lifetime, but it doesn't know what the correct result would be. Probably this should be fixed, but what we do now is a surgical fix: we have it generate a different result for elided lifetimes in a object context, and then we can ignore those results when figuring out the lifetimes that are captured in the opaque type.
Diffstat (limited to 'src/libsyntax/parse/parser/expr.rs')
0 files changed, 0 insertions, 0 deletions
