Skip to content

NLL: named lifetimes in closures can be unrelated to those in parent function #98589

Description

@aliemjay

Update: I originally thought it's a soundness issue, but it may not be, see comment #98589 (comment).

This code compiles after #95565 although it shouldn't: (playground)

fn lives_as_long<'a, T>() where T: 'a, {}

fn test<'a, T>()
where
    &'a (): Sized, // any predicate containing `'a`
{
    || {
        lives_as_long::<'a, T>();
    };
}

@rustbot label C-bug T-types regression-from-stable-to-nightly I-unsound A-NLL

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.P-criticalCritical priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions