Skip to content

member constraints involving external regions are scuffed #146062

@lcnr

Description

@lcnr
struct Inv<'a>(Option<*mut &'a ()>);
fn foo() -> impl Sized {
    let _: fn() -> Inv<'static> = || {
        foo()
    };
    loop {}
}

When borrow checking the closure with signature fn() -> Inv<'external> we've got a defining use of the opaque with the hidden type Inv<'external>.

The member constraint 'external member ['static] does not choose 'static here as it fails the upper bound check. This should work, properly supporting it is hard :>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsA-type-systemArea: Type systemC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-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