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

cycle on inherent associated types in structs #108491

Open
peku33 opened this issue Feb 26, 2023 · 3 comments
Open

cycle on inherent associated types in structs #108491

peku33 opened this issue Feb 26, 2023 · 3 comments
Assignees
Labels
C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` I-cycle Issue: A query cycle occurred while none was expected S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@peku33
Copy link

peku33 commented Feb 26, 2023

Taken out from here: #8995 (comment) as @fmease requested.

struct Foo {
    bar: Self::Bar,
}
impl Foo {
    pub type Bar = usize;
}

was compiled successfully a couple of nighly revisions before.

Now an error is returned:

error[E0391]: cycle detected when computing predicates of `Foo`
  --> src\main.rs:5:1
   |
5  | struct Foo {
   | ^^^^^^^^^^
   |
note: ...which requires computing predicates of `Foo`...
  --> src\main.rs:5:1
   |
5  | struct Foo {
   | ^^^^^^^^^^
note: ...which requires computing inferred outlives predicates of `Foo`...
  --> src\main.rs:5:1
   |
5  | struct Foo {
   | ^^^^^^^^^^
   = note: ...which requires computing the inferred outlives predicates for items in this crate...
note: ...which requires computing type of `Foo::bar`...
  --> src\main.rs:6:5
   |
6  |     bar: Self::Bar,
   |     ^^^^^^^^^^^^^^
note: ...which requires computing normalized predicates of `Foo`...
  --> src\main.rs:5:1
   |
5  | struct Foo {
   | ^^^^^^^^^^
   = note: ...which again requires computing predicates of `Foo`, completing the cycle
note: cycle used when collecting item types in top-level module

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (34e6673a0 2023-02-25)
@peku33 peku33 added the C-bug Category: This is a bug. label Feb 26, 2023
@fmease
Copy link
Member

fmease commented Feb 26, 2023

Thanks for reporting!

@rustbot label T-compiler F-inherent_associated_types
@rustbot claim

@rustbot rustbot added F-inherent_associated_types `#![feature(inherent_associated_types)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 26, 2023
@fmease fmease added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Sep 6, 2023
@fmease fmease added the I-cycle Issue: A query cycle occurred while none was expected label Jan 25, 2024
@fmease fmease changed the title cycle detected for type aliases in structs cycle on inherent associated types in structs Jan 27, 2024
@joshtriplett
Copy link
Member

What is the current state of this issue?

@fmease
Copy link
Member

fmease commented Sep 3, 2024

No active work on this at the moment. This issue is non-trivial and still blocked on architectural limitations (namely, the way we lower and represent types). However, I'm continuously furthering my understanding of this subject matter by attacking closely related issues and topics (e.g., #126651).

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. F-inherent_associated_types `#![feature(inherent_associated_types)]` I-cycle Issue: A query cycle occurred while none was expected S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants