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

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

Closed
compiler-errors opened this issue Mar 23, 2022 · 3 comments · Fixed by #99394
Closed

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

compiler-errors opened this issue Mar 23, 2022 · 3 comments · Fixed by #99394
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@compiler-errors
Copy link
Member

compiler-errors commented Mar 23, 2022

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.

@compiler-errors
Copy link
Member Author

compiler-errors commented Jul 1, 2022

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

@compiler-errors compiler-errors added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jul 1, 2022
@jackh726
Copy link
Member

jackh726 commented Jul 1, 2022

wait huh

really? Which PR? The one open?

@jackh726
Copy link
Member

jackh726 commented Jul 1, 2022

Oh, I guess the TypeOutlives -> WellFormed.

Neat.

JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 18, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jul 18, 2022
…rrors

Add regression test for rust-lang#95230

Closes rust-lang#95230
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <[email protected]>
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jul 18, 2022
…rrors

Add regression test for rust-lang#95230

Closes rust-lang#95230
r? ``@compiler-errors``

Signed-off-by: Yuki Okushi <[email protected]>
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 18, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#98839 (Add assertion that `transmute_copy`'s U is not larger than T)
 - rust-lang#98998 (Remove branch target prologues from `#[naked] fn`)
 - rust-lang#99198 (add missing null ptr check in alloc example)
 - rust-lang#99344 (rustdoc: avoid inlining items with duplicate `(type, name)`)
 - rust-lang#99351 (Use `typeck_results` to get accurate qpath res for arg mismatch error)
 - rust-lang#99378 (interpret/visitor: add missing early return)
 - rust-lang#99394 (Add regression test for rust-lang#95230)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 068a559 Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
2 participants