Can't build docs for std

I downloaded the rust repository:

git clone --depth 1 https://github.com/rust-lang/rust
git submodule update --init library/backtrace
git submodule update --init library/stdarch

Then I try to build the documentation:

cargo +nightly rustdoc --open -- --document-private-items --document-hidden-items --generate-link-to-definition -v

But nothing worked out. There are a lot of errors in the code itself. There are sooo many of them

Example of errors:

error[E0599]: no method named as_raw_fd found for reference &os::linux::process::FileDesc in the current scope
--> library/std/src/os/linux/process.rs:76:25
|
76 | self.as_inner().as_raw_fd()
| ^^^^^^^^^ method not found in &FileDesc
|
= help: items from traits can only be used if the trait is implemented and in scope
note: os::fd::raw::AsRawFd defines an item as_raw_fd, perhaps you need to implement it
--> library/std/src/os/fd/raw.rs:38:1
|
38 | pub trait AsRawFd {
| ^^^^^^^^^^^^^^^^^

error[E0599]: no method named into_raw_fd found for struct os::linux::process::FileDesc in the current scope
--> library/std/src/os/linux/process.rs:88:27
|
16 | struct FileDesc;
| --------------- method into_raw_fd not found for this struct
...
88 | self.into_inner().into_raw_fd()
| ^^^^^^^^^^^ method not found in FileDesc
|
= help: items from traits can only be used if the trait is implemented and in scope
note: os::fd::raw::IntoRawFd defines an item into_raw_fd, perhaps you need to implement it
--> library/std/src/os/fd/raw.rs:117:1
|
117 | pub trait IntoRawFd {
| ^^^^^^^^^^^^^^^^^^^

Final Invocation:

process didn't exit successfully: /home/nonroot/installations/installed/rust/rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustdoc --edition=2021 --crate-type dylib --crate-type rlib --crate-name std library/std/src/lib.rs -o /home/nonroot/home/rust/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=78 --document-private-items --document-hidden-items --generate-link-to-definition -v -C metadata=03f7375309efda34 -L dependency=/home/nonroot/home/rust/target/debug/deps --extern alloc=/home/nonroot/home/rust/target/debug/deps/liballoc-86e28f96814ac8b5.rmeta --extern 'priv:cfg_if=/home/nonroot/home/rust/target/debug/deps/libcfg_if-3f68241b7fd07663.rmeta' --extern 'priv:compiler_builtins=/home/nonroot/home/rust/target/debug/deps/libcompiler_builtins-802cbb8865837ef5.rmeta' --extern core=/home/nonroot/home/rust/target/debug/deps/libcore-0804b27d97c8625e.rmeta --extern 'priv:hashbrown=/home/nonroot/home/rust/target/debug/deps/libhashbrown-10c8aa5914e81f8a.rmeta' --extern libc=/home/nonroot/home/rust/target/debug/deps/liblibc-1f3ace2521b07244.rmeta --extern 'priv:panic_abort=/home/nonroot/home/rust/target/debug/deps/libpanic_abort-0a5cdcf49b3d998d.rmeta' --extern 'priv:rustc_demangle=/home/nonroot/home/rust/target/debug/deps/librustc_demangle-bff1e09b44d16c59.rmeta' --extern 'priv:std_detect=/home/nonroot/home/rust/target/debug/deps/libstd_detect-488a1ab95e2e1f52.rmeta' --extern 'priv:unwind=/home/nonroot/home/rust/target/debug/deps/libunwind-c3d92dd72835028d.rmeta' -Z unstable-options --crate-version 0.0.0 --cfg backtrace_in_libstd (exit status: 1)

The rustc-dev-guide has a chapter that describes how you can build the documentation for items (including the standard library) in the rust repository:

I.e. invoking ./x doc library should build the standard library. I've looked through the arguments (by running ./x doc --help) but couldn't find equivalents to the arguments you pass to cargo/rustdoc though.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.