Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OriginalType<A, B>: 'pin bound to projected type #188

Merged
merged 1 commit into from
Apr 14, 2020

Commits on Apr 13, 2020

  1. Add OriginalType<A, B>: 'pin bound to projected type

    Fixes taiki-e#185
    
    Usually, Rust will automatically add lifetime bounds of the form
    `T: 'lifetime` when required (e.g. when a struct contains `&'a T`).
    
    However, the compiler will not normalize associated types before
    performing this analysis, which can require users to manually add
    `T: 'lifetime` bounds themselves. When this happens with a generated
    projection struct, the user has no ability to add such a bound, since
    they cannot name the 'pin lifetime.
    
    This PR adds a bound of the form `OriginalType<A, B>: 'pin` to the
    `where` clause of the generated projection types. This ensures that
    any type parameters which need to outlive 'pin will do so, without
    unnecessarily constraining other type parameters.
    
    The generated bound does not need to be added to the `where` clause of
    any impls for the generated projection types. For more details, see
    https://github.com/rust-lang/rfcs/blob/d89de6a5857597cca9f6e1c7ebb70476f31a9159/text/2093-infer-outlives.md#background-outlives-requirements-today
    Aaron1011 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    9e3dc88 View commit details
    Browse the repository at this point in the history