Skip to content

impl Trait lifetimes regression 1.67 part 2 #108592

Closed
@aliemjay

Description

@aliemjay
Member

Another regresssion of #103491 with a different failure path:

fn opaque<'a: 'a>() -> impl Sized {}
fn assert_static<T: 'static>(_: T) {}

fn test() {
    let closure = |_| {
        assert_static(opaque());
        //~^ ERROR the opaque type may not live long enough
    };
    closure(&opaque());
}
#![feature(type_alias_impl_trait)]
type Opaque<'a> = impl Sized;
fn define<'a>() -> Opaque<'a> {}

fn test(_: &Opaque<'_>) {
    None::<&'static Opaque<'_>>;
    //~^ ERROR the opaque type may not live long enough
}

It should be fixed by ignoring non-captured lifetimes in:

cc @cjgillot

@rustbot label regression-from-stable-to-stable C-bug T-compiler T-types A-impl-trait

Activity

added
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-bugCategory: This is a bug.
regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.
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.
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Mar 1, 2023
changed the title [-]impl Trait lifetimes regression 1.67 part ii[/-] [+]impl Trait lifetimes regression 1.67 part 2[/+] on Mar 1, 2023
aliemjay

aliemjay commented on Mar 1, 2023

@aliemjay
MemberAuthor

Note that fixing this issue is necessary for #107516, but might not be sufficient. I'll investigate more...

apiraino

apiraino commented on Mar 1, 2023

@apiraino
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

added
P-highHigh priority
and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Mar 1, 2023
added a commit that references this issue on Apr 20, 2023

Auto merge of rust-lang#110399 - cjgillot:infer-variance, r=aliemjay

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-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.P-highHigh priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @apiraino@aliemjay@rustbot

      Issue actions

        impl Trait lifetimes regression 1.67 part 2 · Issue #108592 · rust-lang/rust