Skip to content

Outlives error for where-clause with HRTB and no trait bounds #95230

@compiler-errors

Description

@compiler-errors
Member

The following code [playground]:

pub struct Bar
where
    for<'a> &'a mut Self:;

fn main() {}

Should compile, but it does not. Instead it fails with:

error[E0477]: the type `&'a mut Bar` does not fulfill the required lifetime
 --> src/main.rs:3:13
  |
3 |     for<'a> &'a mut Self:;
  |             ^^^^^^^^^^^^
  |
note: type must outlive the empty lifetime as required by this binding
 --> src/main.rs:3:13
  |
3 |     for<'a> &'a mut Self:;
  |             ^^^^^^^^^^^^

I think this is because we instantiate the predicate for<'a> &'a mut Self: ReEmpty(U0) here, which doesn't hold because of the HRTB.

Activity

compiler-errors

compiler-errors commented on Jul 1, 2022

@compiler-errors
MemberAuthor

This is fixed with @jackh726's ReEmpty PR. Marking as needs test.

added
E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
on Jul 1, 2022
jackh726

jackh726 commented on Jul 1, 2022

@jackh726
Member

wait huh

really? Which PR? The one open?

jackh726

jackh726 commented on Jul 1, 2022

@jackh726
Member

Oh, I guess the TypeOutlives -> WellFormed.

Neat.

added a commit that references this issue on Jul 18, 2022
added a commit that references this issue on Jul 18, 2022
307f864
added a commit that references this issue on Jul 18, 2022
86c049f
added a commit that references this issue on Jul 18, 2022
068a559
added a commit that references this issue on Jul 18, 2022
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

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @compiler-errors@jackh726

      Issue actions

        Outlives error for where-clause with HRTB and no trait bounds · Issue #95230 · rust-lang/rust