Skip to content

error promoting type-tests from closures part 2 #108639

Closed
@aliemjay

Description

@aliemjay

A variant of #108635 with a different etiology:

trait Trait {
    type Item<'a>: 'a;
}

fn assert_static<T: 'static>(_: T) {}
fn relate<T>(_: T, _: T) {}

fn test_args<I: Trait>() {
    let closure = |a, b| {
        relate(&a, b);
        assert_static(a);
        //~^ ERROR the associated type may not live long enough
    };
    closure(None::<I::Item::<'_>>, &None::<I::Item::<'_>>);
}

In the same context as #108635, we fail to find an equal universal region although there is a one.

let upper_bound = self.non_local_universal_upper_bound(region_vid);

@rustbot label C-bug T-types A-NLL NLL-complete A-borrow-checker

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerC-bugCategory: This is a bug.NLL-completeWorking towards the "valid code works" 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