Skip to content

query cycle in layout_of #123

Open
Open
@lcnr

Description

@lcnr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions