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

query cycle in layout_of #123

Open
lcnr opened this issue Sep 3, 2024 · 0 comments
Open

query cycle in layout_of #123

lcnr opened this issue Sep 3, 2024 · 0 comments

Comments

@lcnr
Copy link
Contributor

lcnr commented Sep 3, 2024

likely due to lazy norm

https://rust.godbolt.org/z/Gce6rnTTc, cc rust-lang/rust#129541

trait Bound {}
trait Normalize {
    type Assoc;
}

impl<T: Bound> Normalize for T {
    type Assoc = T;
}

impl<T: Bound> Normalize for [T] {
    type Assoc = T;
}



impl Bound for Hello {}
enum Hello {
    Variant(<[Hello] as Normalize>::Assoc),
}
error[E0391]: cycle detected when computing layout of `<[Hello] as Normalize>::Assoc`
  |
  = note: ...which requires computing layout of `Hello`...
  = note: ...which again requires computing layout of `<[Hello] as Normalize>::Assoc`, completing the cycle
  = note: cycle used when computing layout of `Hello`
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant