about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser/expr.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2019-08-08 03:36:24 -0400
committerNiko Matsakis <niko@alum.mit.edu>2019-08-19 13:50:42 -0400
commitaf86fb1959b520ae0256272899df5c43b11df2a7 (patch)
treec1a076002aabb33c37bc366694a4dc940addce24 /src/libsyntax/parse/parser/expr.rs
parentb51df1def0e621fd5fd6cb777511d64d490c0363 (diff)
downloadrust-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