Skip to content

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

Open
@aliemjay

Description

@aliemjay

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>)
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerA-closuresArea: Closures (`|…| { … }`)C-bugCategory: This is a bug.NLL-soundWorking towards the "invalid code does not compile" goalT-typesRelevant 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