Skip to content

closure rvalue not checked for WF allowing it to assume more implied bounds #123312

Open

Description

The following should not compile because the bound D: 'static is not satisfied in fn test:

struct Static<D: 'static>(Option<D>);

pub fn test<D>() {
    let _ = || {
        Static(None::<D>)
    };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)C-bugCategory: This is a bug.Category: This is a bug.NLL-soundWorking towards the "invalid code does not compile" goalWorking towards the "invalid code does not compile" goalT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions