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 #108591

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

impl Trait lifetimes regression 1.67 #108591

aliemjay opened this issue Mar 1, 2023 · 1 comment · 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

Some regressions of #103491 that I previously reported in #105826 (comment), but they were missed:

struct MyTy<'a>(Vec<u8>, &'a ());

impl MyTy<'_> {
    fn one(&mut self) -> &mut impl Sized {
        &mut self.0
    }
    fn two(&mut self) -> &mut (impl Sized + 'static) {
        self.one()
        //~^ ERROR lifetime may not live long enough
    }
}
#![feature(type_alias_impl_trait)]
type Opaque<'a> = impl Sized;
fn define<'a>() -> Opaque<'a> {}

fn test<'a>() {
    None::<&'static Opaque<'a>>;
    //~^ ERROR lifetime may not live long enough
}
fn one<'a, 'b: 'b>() -> &'a impl Sized {
    &()
}
fn two<'a, 'b>() {
    one::<'a, 'b>();
    //~^ ERROR lifetime may not live long enough
}

I guess the way to fix this is to ignore non-captured lifetimes of opaque types here

cc @cjgillot

@rustbot label C-bug regression-from-stable-to-stable T-types T-compiler 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
@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