Skip to content

rustdoc query cycle regression #141492

@BoxyUwU

Description

@BoxyUwU
Member
          I believe this caused a regression on nightly. See https://github.com/aya-rs/aya/actions/runs/15223453504/job/42822502727.
 Documenting aya-log-ebpf v0.1.1 (/home/runner/work/aya/aya/ebpf/aya-log-ebpf)
error[E0391]: cycle detected when computing revealed normalized predicates of `aya_ebpf::EbpfContext::command::{constant#0}`
  --> /home/runner/work/aya/aya/ebpf/aya-ebpf/src/lib.rs:42:38
   |
42 |     fn command(&self) -> Result<[u8; TASK_COMM_LEN], c_long> {
   |                                      ^^^^^^^^^^^^^
   |
note: ...which requires computing normalized predicates of `aya_ebpf::EbpfContext::command::{constant#0}`...
  --> /home/runner/work/aya/aya/ebpf/aya-ebpf/src/lib.rs:42:38
   |
42 |     fn command(&self) -> Result<[u8; TASK_COMM_LEN], c_long> {
   |                                      ^^^^^^^^^^^^^
   = note: ...which again requires computing revealed normalized predicates of `aya_ebpf::EbpfContext::command::{constant#0}`, completing the cycle
   = note: cycle used when normalizing `aya_ebpf::::EbpfContext::command::{constant#0}`
   = 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

For more information about this error, try `rustc --explain E0391`.
error: could not document `aya-log-ebpf`

Oddly, this seems specific to rustdoc.

Originally posted by @tamird in #139635 (comment)

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 24, 2025
added
T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
C-bugCategory: This is a bug.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 24, 2025
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on May 24, 2025
BoxyUwU

BoxyUwU commented on May 24, 2025

@BoxyUwU
MemberAuthor

I'm not sure how #139635 would have caused this, it doesn't touch anything to do with what queries get called so shouldn't be introducing new query cycles. @tamird what makes you think that's the PR that regressed your crate?

tamird

tamird commented on May 24, 2025

@tamird
Contributor

The tests updated in that PR contain the same diagnostic text e.g. b1774b8#diff-d26852ce626e7632e48fd9e08630bf948f008ef8f7de7b00336c6b9cb0eda19f

tamird

tamird commented on May 24, 2025

@tamird
Contributor

Ah, I posted this on the wrong PR, it was probably #140553.

added
I-cycleIssue: A query cycle occurred while none was expected
on May 24, 2025
BoxyUwU

BoxyUwU commented on May 24, 2025

@BoxyUwU
MemberAuthor

Ah I see what you mean. I'll take a look and see what happened there and verify if it was that PR that caused it.

BoxyUwU

BoxyUwU commented on May 24, 2025

@BoxyUwU
MemberAuthor

@tamird I can't seem to reproduce the failure locally, though I did notice that the crate sometimes uses generic_const_exprs. Is the CI failure happening in a place where the unstable cfg is set and so generic_const_exprs is enabled?

BoxyUwU

BoxyUwU commented on May 24, 2025

@BoxyUwU
MemberAuthor

Ah running cargo xtask public-api --bless reproduces it and stops when removing the enabling of generic_const_exprs. So I think this is a gce only regression, and also seems reasonable to expect that #140553 was the cause

added
A-const-genericsArea: const generics (parameters and arguments)
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on May 24, 2025
added a commit that references this issue on May 24, 2025
tamird

tamird commented on May 24, 2025

@tamird
Contributor

Thanks for the diagnosis. I've sent aya-rs/aya#1271 to work around this in aya for now.

added a commit that references this issue on May 24, 2025
nazar-pc

nazar-pc commented on May 24, 2025

@nazar-pc

I see something that looks very similar with cargo check/clippy too:

error[E0391]: cycle detected when computing revealed normalized predicates of `ab_merkle_tree::unbalanced_hashed::UnbalancedHashedMerkleTree::compute_root_only::{constant#1}`
  --> /web/github/abundance/crates/shared/ab-merkle-tree/src/unbalanced_hashed.rs:46:25
   |
46 |         Item: Into<[u8; OUT_LEN]>,
   |                         ^^^^^^^
   |
note: ...which requires computing normalized predicates of `ab_merkle_tree::unbalanced_hashed::UnbalancedHashedMerkleTree::compute_root_only::{constant#1}`...
  --> /web/github/abundance/crates/shared/ab-merkle-tree/src/unbalanced_hashed.rs:46:25
   |
46 |         Item: Into<[u8; OUT_LEN]>,
   |                         ^^^^^^^
   = note: ...which again requires computing revealed normalized predicates of `ab_merkle_tree::unbalanced_hashed::UnbalancedHashedMerkleTree::compute_root_only::{constant#1}`, completing the cycle
note: cycle used when type-checking `block::body::compute_segments_root`
  --> crates/shared/ab-core-primitives/src/block/body.rs:28:1
   |
28 | / pub fn compute_segments_root<Item, Iter>(segment_roots: Iter) -> Blake3Hash
29 | | where
30 | |     Item: AsRef<[u8]>,
31 | |     Iter: IntoIterator<Item = Item>,
   | |____________________________________^
   = 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

error[E0275]: overflow evaluating the requirement `[(); ab_merkle_tree::::balanced_hashed::BalancedHashedMerkleTree::{constant#0}] well-formed`
   --> crates/shared/ab-core-primitives/src/block/body.rs:379:17
    |
379 |                 BalancedHashedMerkleTree::<2>::verify(
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: required by a bound in `BalancedHashedMerkleTree`
   --> /web/github/abundance/crates/shared/ab-merkle-tree/src/balanced_hashed.rs:29:5
    |
27  | pub struct BalancedHashedMerkleTree<'a, const N: usize>
    |            ------------------------ required by a bound in this struct
28  | where
29  |     [(); N - 1]:,
    |     ^^^^^^^^^^^ required by this bound in `BalancedHashedMerkleTree`

error[E0391]: cycle detected when computing revealed normalized predicates of `ab_merkle_tree::balanced_hashed::BalancedHashedMerkleTree::<'a, N>::compute_root_only::{constant#1}`
   --> /web/github/abundance/crates/shared/ab-merkle-tree/src/balanced_hashed.rs:133:45
    |
133 |     pub fn compute_root_only(leaves: &[[u8; OUT_LEN]; N]) -> [u8; OUT_LEN]
    |                                             ^^^^^^^
    |
note: ...which requires computing normalized predicates of `ab_merkle_tree::balanced_hashed::BalancedHashedMerkleTree::<'a, N>::compute_root_only::{constant#1}`...
   --> /web/github/abundance/crates/shared/ab-merkle-tree/src/balanced_hashed.rs:133:45
    |
133 |     pub fn compute_root_only(leaves: &[[u8; OUT_LEN]; N]) -> [u8; OUT_LEN]
    |                                             ^^^^^^^
    = note: ...which again requires computing revealed normalized predicates of `ab_merkle_tree::balanced_hashed::BalancedHashedMerkleTree::<'a, N>::compute_root_only::{constant#1}`, completing the cycle
note: cycle used when type-checking `block::body::<impl at crates/shared/ab-core-primitives/src/block/body.rs:303:1: 303:34>::root`
   --> crates/shared/ab-core-primitives/src/block/body.rs:458:5
    |
458 |     pub fn root(&self) -> Blake3Hash {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = 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

error[E0275]: overflow evaluating the requirement `[(); ab_merkle_tree::::balanced_hashed::BalancedHashedMerkleTree::{constant#0}] well-formed`
   --> crates/shared/ab-core-primitives/src/block/body.rs:805:13
    |
805 |             BalancedHashedMerkleTree::<2>::verify(
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: required by a bound in `BalancedHashedMerkleTree`
   --> /web/github/abundance/crates/shared/ab-merkle-tree/src/balanced_hashed.rs:29:5
    |
27  | pub struct BalancedHashedMerkleTree<'a, const N: usize>
    |            ------------------------ required by a bound in this struct
28  | where
29  |     [(); N - 1]:,
    |     ^^^^^^^^^^^ required by this bound in `BalancedHashedMerkleTree`

error[E0275]: overflow evaluating the requirement `[(); ab_merkle_tree::::balanced_hashed::BalancedHashedMerkleTree::{constant#0}] well-formed`
   --> crates/shared/ab-core-primitives/src/pieces.rs:632:9
    |
632 |         BalancedHashedMerkleTree::<{ RecordedHistorySegment::NUM_PIECES }>::verify(
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: required by a bound in `BalancedHashedMerkleTree`
   --> /web/github/abundance/crates/shared/ab-merkle-tree/src/balanced_hashed.rs:29:5
    |
27  | pub struct BalancedHashedMerkleTree<'a, const N: usize>
    |            ------------------------ required by a bound in this struct
28  | where
29  |     [(); N - 1]:,
    |     ^^^^^^^^^^^ required by this bound in `BalancedHashedMerkleTree`

error[E0275]: overflow evaluating the requirement `[(); ab_merkle_tree::::balanced_hashed::BalancedHashedMerkleTree::{constant#0}] well-formed`
   --> crates/shared/ab-core-primitives/src/solutions.rs:536:13
    |
536 |         if !BalancedHashedMerkleTree::<65536>::verify(
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: required by a bound in `BalancedHashedMerkleTree`
   --> /web/github/abundance/crates/shared/ab-merkle-tree/src/balanced_hashed.rs:29:5
    |
27  | pub struct BalancedHashedMerkleTree<'a, const N: usize>
    |            ------------------------ required by a bound in this struct
28  | where
29  |     [(); N - 1]:,
    |     ^^^^^^^^^^^ required by this bound in `BalancedHashedMerkleTree`

Some errors have detailed explanations: E0275, E0391.
For more information about an error, try `rustc --explain E0275`.
error: could not compile `ab-core-primitives` (lib) due to 6 previous errors

Reproducible by removing workaround (#![feature(generic_const_exprs)] in a crate that uses another crate with #![feature(generic_const_exprs)], but doesn't need it on its own):
https://github.com/nazar-pc/abundance/blob/d29afd13ec5ce2a6598cf9ef7a3b886f1b19454a/crates/shared/ab-core-primitives/src/lib.rs#L16-L19

added a commit that references this issue on May 24, 2025
robert3005

robert3005 commented on Jun 16, 2025

@robert3005

Is there a workaround for this issue that's different than getting rid of GCE? If you want an easy repro you can see https://docs.rs/crate/vortex/0.39.0/builds/2221527

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

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]`I-cycleIssue: A query cycle occurred while none was expectedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @robert3005@nazar-pc@tamird@fmease@BoxyUwU

        Issue actions

          rustdoc query cycle regression · Issue #141492 · rust-lang/rust