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

Rustdoc with -Znormalize-docs fails to build docs for generic-array #120199

Closed
WaffleLapkin opened this issue Jan 21, 2024 · 2 comments
Closed

Rustdoc with -Znormalize-docs fails to build docs for generic-array #120199

WaffleLapkin opened this issue Jan 21, 2024 · 2 comments
Labels
-Znormalize-docs Unstable rustdoc option: Normalize/evaluate types when generating docs C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@WaffleLapkin
Copy link
Member

Building docs for generic-array with -Znormalize-docs fails since its git tag 0.0.3 with the following error (latest tag 1.0.0 also reproduces the same exact issue):

; RUSTDOCFLAGS="-Znormalize-docs" cargo +nightly doc
 Documenting typenum v1.17.0
 Documenting generic-array v0.0.3 (/home/waffle/projects/repos/generic-array)
error[E0275]: overflow evaluating the requirement `typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>: typenum::Unsigned`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`generic_array`)
  = note: required for `UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>` to implement `std::ops::Shl<typenum::B1>`
  = note: the full type name has been written to 'generic_array.long-type-10849549341428477219.txt'
  = note: 121 redundant requirements hidden
  = note: required for `typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>` to implement `std::ops::Shl<typenum::UInt<_, _>>`
  = note: required for `typenum::UTerm` to implement `typenum::uint::SetBit<typenum::UInt<_, _>, typenum::B1>`
  = note: required for `()` to implement `typenum::private::PrivateDivIf<typenum::UInt<Ul, Bl>, typenum::UInt<Ur, Br>, typenum::UTerm, _, typenum::UInt<_, _>, typenum::Equal>`

For more information about this error, try `rustc --explain E0275`.
error: could not document `generic-array`

Caused by:
  process didn't exit successfully: `/home/waffle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc --crate-type rlib --crate-type dylib --crate-name generic_array src/lib.rs -o /home/waffle/projects/repos/generic-array/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 -C metadata=db8181fe6603c7bc -L dependency=/home/waffle/projects/repos/generic-array/target/debug/deps --extern typenum=/home/waffle/projects/repos/generic-array/target/debug/deps/libtypenum-1d6ab7b7d1feadca.rmeta -Znormalize-docs --crate-version 0.0.3` (exit status: 1)
notes on 0.0.2

On 0.0.2 rustdoc also fails, but with a slightly different error:

; RUSTDOCFLAGS="-Znormalize-docs" cargo +nightly doc
    Updating crates.io index
 Documenting typenum v0.1.1
error[E0275]: overflow evaluating the requirement `uint::UInt<uint::UInt<uint::UInt<uint::UInt<uint::UInt<uint::UInt<uint::UInt<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>: uint::Unsigned`
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`typenum`)
note: required for `UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>` to implement `std::ops::Shl<uint::UTerm>`
   --> /home/waffle/.cargo/registry/src/index.crates.io-6f17d22bba15001f/typenum-0.1.1/src/uint.rs:435:27
    |
435 | impl<U: Unsigned, B: Bit> Shl<UTerm> for UInt<U, B> {
    |         --------          ^^^^^^^^^^     ^^^^^^^^^^
    |         |
    |         unsatisfied trait bound introduced here
    = note: the full type name has been written to 'typenum.long-type-9142539435321689143.txt'
    = note: 126 redundant requirements hidden
    = note: required for `uint::UInt<uint::UInt<uint::UTerm, bit::B1>, bit::B0>` to implement `std::ops::Shl<uint::UInt<_, _>>`

For more information about this error, try `rustc --explain E0275`.
error: could not document `typenum`

Caused by:
  process didn't exit successfully: `/home/waffle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc --crate-type lib --crate-name typenum /home/waffle/.cargo/registry/src/index.crates.io-6f17d22bba15001f/typenum-0.1.1/src/lib.rs --cap-lints allow -o /home/waffle/projects/repos/generic-array/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 -C metadata=1850fe6d6e4be91a -L dependency=/home/waffle/projects/repos/generic-array/target/debug/deps -Znormalize-docs --crate-version 0.1.1` (exit status: 1)

Why I consider this a rustdoc bug (as opposed to generic-array)

Mainly because the crate builds just fine with rustc, so it's only doc normalization that can't chew through it.

But also:

  1. It seems weird to me that an error during type normalization for docs results in an error. I would expect it to just not normalize if it can't
  2. It also fails if you compile a crate that depends on generic-array (potentially though a list of other deps), which is doubly annoying (I don't think there needs to be any public item of generic-array exported from a crate for the build to fail)

Discovery context

This was discovered a couple days ago when I noticed that I can't build docs for teloxide (2945f4d3) locally. As it turns out it was caused by update of sqlx (0.6 -> 0.7.3) in 4fcb906 which looks like it adds a dependency on generic-array (which is somewhat weird, considering that you can just use const generics now, I think?...).

Meta

rustdoc --version --verbose:

rustdoc 1.77.0-nightly (88189a71e 2024-01-19)
binary: rustdoc
commit-hash: 88189a71e4e4376eea82ac61db6a539612eb200a
commit-date: 2024-01-19
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6
@WaffleLapkin WaffleLapkin added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. -Znormalize-docs Unstable rustdoc option: Normalize/evaluate types when generating docs labels Jan 21, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 21, 2024
@WaffleLapkin
Copy link
Member Author

Oh. I actually already reported this issue as #93703, which seems to have been closed as a dup of #81091...

@WaffleLapkin
Copy link
Member Author

Looks like 4fcb906 just re-introduced a dependency on generic-array that was somehow removed before that. Welp.

I'm going to close this on the premise that it's indeed just #81091, although I'm not exactly sure.

@WaffleLapkin WaffleLapkin closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2024
@WaffleLapkin WaffleLapkin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Znormalize-docs Unstable rustdoc option: Normalize/evaluate types when generating docs C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. 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

2 participants