rustdoc query cycle regression
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 https://github.com/rust-lang/rust/issues/139635#issuecomment-2906771024
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?
The tests updated in that PR contain the same diagnostic text e.g. https://github.com/rust-lang/rust/commit/b1774b8d7382325d2bb5cc518e463ae9d6de5898#diff-d26852ce626e7632e48fd9e08630bf948f008ef8f7de7b00336c6b9cb0eda19f
Ah, I posted this on the wrong PR, it was probably https://github.com/rust-lang/rust/pull/140553.
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.
@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?
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
Thanks for the diagnosis. I've sent https://github.com/aya-rs/aya/pull/1271 to work around this in aya for now.
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
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