Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl Trait lifetimes regression 1.67 part 2 #108592

Closed
aliemjay opened this issue Mar 1, 2023 · 2 comments · Fixed by #110399
Closed

impl Trait lifetimes regression 1.67 part 2 #108592

aliemjay opened this issue Mar 1, 2023 · 2 comments · Fixed by #110399
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@aliemjay
Copy link
Member

aliemjay commented Mar 1, 2023

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

@rustbot rustbot added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 1, 2023
@aliemjay aliemjay changed the title impl Trait lifetimes regression 1.67 part ii impl Trait lifetimes regression 1.67 part 2 Mar 1, 2023
@aliemjay
Copy link
Member Author

aliemjay commented Mar 1, 2023

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

@apiraino
Copy link
Contributor

apiraino commented Mar 1, 2023

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 1, 2023
@bors bors closed this as completed in 7fde083 Apr 20, 2023
RalfJung pushed a commit to RalfJung/miri that referenced this issue Apr 22, 2023
Account for opaque variance in outlives

Fixes rust-lang/rust#108591
Fixes rust-lang/rust#108592
cc `@aliemjay`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants