Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

impl Trait lifetimes regression 1.67 #108591

Closed

Description

@aliemjay

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

Activity

  1. added
    A-impl-trait
    C-bug
    regression-from-stable-to-stable
    T-compiler
    T-types
    I-prioritize
    on Mar 1, 2023
  2. apiraino commented on Mar 1, 2023

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-high

  3. added
    P-high
    and removed
    I-prioritize
    on Mar 1, 2023
  4. added a commit that references this issue on Apr 20, 2023
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-traitC-bugP-highT-compilerT-typesregression-from-stable-to-stable

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions