Skip to content

rustdoc query cycle regression #141492

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

Open
BoxyUwU opened this issue May 24, 2025 · 8 comments
Open

rustdoc query cycle regression #141492

BoxyUwU opened this issue May 24, 2025 · 8 comments
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` I-cycle Issue: A query cycle occurred while none was expected T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@BoxyUwU
Copy link
Member

BoxyUwU commented May 24, 2025

          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)

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 24, 2025
@BoxyUwU BoxyUwU added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 24, 2025
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 24, 2025
@BoxyUwU
Copy link
Member Author

BoxyUwU commented May 24, 2025

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
Copy link
Contributor

tamird commented May 24, 2025

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

@tamird
Copy link
Contributor

tamird commented May 24, 2025

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

@fmease fmease added the I-cycle Issue: A query cycle occurred while none was expected label May 24, 2025
@BoxyUwU
Copy link
Member Author

BoxyUwU commented May 24, 2025

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
Copy link
Member Author

BoxyUwU commented May 24, 2025

@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
Copy link
Member Author

BoxyUwU commented May 24, 2025

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

@BoxyUwU BoxyUwU added A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 24, 2025
tamird added a commit to tamird/aya that referenced this issue May 24, 2025
This has recently regressed on nightly.

See rust-lang/rust#141492.
@tamird
Copy link
Contributor

tamird commented May 24, 2025

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

tamird added a commit to tamird/aya that referenced this issue May 24, 2025
This has recently regressed on nightly.

See rust-lang/rust#141492.
@nazar-pc
Copy link

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

tamird added a commit to aya-rs/aya that referenced this issue May 24, 2025
This has recently regressed on nightly.

See rust-lang/rust#141492.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` I-cycle Issue: A query cycle occurred while none was expected T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants