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

Rust docs broken #614

Closed
kennykerr opened this issue Mar 18, 2021 · 41 comments · Fixed by #621
Closed

Rust docs broken #614

kennykerr opened this issue Mar 18, 2021 · 41 comments · Fixed by #621

Comments

@kennykerr
Copy link
Collaborator

kennykerr commented Mar 18, 2021

Just leaving this issue here as a few people have asked. There are two separate issues.

The Windows crate docs are broken due to this rustc bug.

The generated documentation hasn't been updated because cargo hangs trying to build windows-docs-rs. I seem to have hit some kind of limit, but its not clear what's wrong. rustc allocates about 5 GB and then cargo hangs inside git_refdb_backend_fs. This happens reliably. Here's a repro if you want to play along.

Running out of memory while the CPU idles is kind of sad. 😢 Here is stable/night/nightly-2021-03-16 running in parallel:

image

In all three cases, the hang happens here:

image

@kennykerr
Copy link
Collaborator Author

FYI @jyn514 and @GuillaumeGomez if you have any insights.

@kennykerr
Copy link
Collaborator Author

I tried applying a workaround (#616) that @rylev suggested for the docs.rs build issue but it now fails for a different reason:

https://docs.rs/crate/windows/0.5.0/builds/363871

@jyn514
Copy link

jyn514 commented Mar 18, 2021

@kennykerr have you been able to bisect this to a nightly toolchain? Or was this caused by a change to windows-rs?

I still can't build windows-rs on linux, so I can't be much help unfortunately.

@GuillaumeGomez
Copy link
Contributor

Is rustc.exe supposed to be rustdoc binary?

@kennykerr
Copy link
Collaborator Author

I still can't build windows-rs on linux, so I can't be much help unfortunately.

Fine! I'm going to get this project building on Linux. 😎

@kennykerr
Copy link
Collaborator Author

have you been able to bisect this to a nightly toolchain? Or was this caused by a change to windows-rs?

I don't know - quite a lot changed on the windows-rs side since the docs last compiled that it's hard to tell where the problem originated.

@GuillaumeGomez
Copy link
Contributor

I might be able to test next week if not fixed until then.

@rylev
Copy link
Contributor

rylev commented Mar 18, 2021

The docs are still failing due to the issue posted in rust-lang/rust#82991. This affects cross compilation which is what docs-rs is doing.

I posted a workaround for this here: #522 (comment)

@kennykerr
Copy link
Collaborator Author

@jyn514 I have added basic Linux build support (#619):

https://github.com/microsoft/windows-rs/runs/2143667658

This excludes tests (for obvious reasons) but it should at least build the windows crate. Hope that helps.

@kennykerr
Copy link
Collaborator Author

I wonder if I can now remove this:

windows-rs/Cargo.toml

Lines 32 to 34 in 198621c

[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"
targets = ["x86_64-pc-windows-msvc"]

@jyn514
Copy link

jyn514 commented Mar 19, 2021

I tried applying a workaround (#616) that rylev suggested for the docs.rs build issue but it now fails for a different reason:

On linux the workaround doesn't help, it still fails while documenting (not when building - possibly this is related to rust-lang/rust#68427):

thread 'rustc' panicked at 'Failed to get crate data for crate19', compiler/rustc_metadata/src/creader.rs:136:32

Hopefully this will be fixed when rust-lang/rust#82991 is, if not we are in deep trouble 😅

@jyn514
Copy link

jyn514 commented Mar 19, 2021

Oh wait no I take it back, it happens while building too. That's a good thing, that means it doesn't need massive changes to rustdoc :)

@kennykerr
Copy link
Collaborator Author

There is now a workaround (#621) for the rustc bug (thanks @rylev!) but the cargo hang described above remains an issue and prevents the Windows docs from being generated.

@jyn514
Copy link

jyn514 commented Mar 19, 2021

the cargo hang described above remains an issue and prevents the Windows docs from being generated.

Unfortunately I can't replicate this on linux - cargo doc works fine and finishes in about 20 seconds. I guess it doesn't find any bindings to generate docs for? I think I should be documenting windows-docs-rs, not windows-rs.

@kennykerr
Copy link
Collaborator Author

Yes, windows-docs-rs is the one that's hanging cargo - building the crates/bindings project.

@kennykerr
Copy link
Collaborator Author

And that should now build on Linux.

@jyn514
Copy link

jyn514 commented Mar 19, 2021

And that should now build on Linux.

Hmm, it's giving me a syntax error:

> cargo doc --no-deps
   Compiling bindings v0.1.0 (/home/joshua/test-rustdoc/windows-docs-rs/crates/bindings)
error: expected one of: identifier, `self`, `super`, `crate`, `*`, curly braces
 --> build.rs:3:41
  |
3 |         windows::ai::machine_learning::*,
  |                                         ^

error: aborting due to previous error

@kennykerr
Copy link
Collaborator Author

Hmm, it's giving me a syntax error:

@rylev did that work for you? I don't yet have the ability to build on Linux.

@jyn514
Copy link

jyn514 commented Mar 19, 2021

@kennykerr in the mean time, do you mind collecting some info yourself? Just cargo doc -v and showing the process where it hangs would be helpful.

@kennykerr
Copy link
Collaborator Author

C:\git\windows-docs-rs\crates\bindings>cargo doc -v
    Checking unicode-xid v0.2.1
 Documenting unicode-xid v0.2.1
    Checking squote v0.1.2
 Documenting squote v0.1.2
    Checking const-sha1 v0.2.0
 Documenting const-sha1 v0.2.0
     Running `rustc --crate-name unicode_xid C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\unicode-xid-0.2.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg "feature=\"default\"" -C metadata=507ec082820f9cd6 -C extra-filename=-507ec082820f9cd6 --out-dir C:\git\windows-docs-rs\crates\bindings\target\debug\deps -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --cap-lints allow`
     Running `rustdoc --crate-type lib --crate-name unicode_xid C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\unicode-xid-0.2.1\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --cfg "feature=\"default\"" --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --crate-version 0.2.1`
     Running `rustc --crate-name squote --edition=2018 C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\squote-0.1.2\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C metadata=791090b5e7f7bfb4 -C extra-filename=-791090b5e7f7bfb4 --out-dir C:\git\windows-docs-rs\crates\bindings\target\debug\deps -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --cap-lints allow`
     Running `rustdoc --edition=2018 --crate-type lib --crate-name squote C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\squote-0.1.2\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --crate-version 0.1.2`
     Running `rustc --crate-name const_sha1 --edition=2018 C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\const-sha1-0.2.0\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C metadata=990380613f00f439 -C extra-filename=-990380613f00f439 --out-dir C:\git\windows-docs-rs\crates\bindings\target\debug\deps -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --cap-lints allow`
     Running `rustdoc --edition=2018 --crate-type lib --crate-name const_sha1 C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\const-sha1-0.2.0\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --crate-version 0.2.0`
    Checking proc-macro2 v1.0.24
     Running `rustc --crate-name proc_macro2 --edition=2018 C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\proc-macro2-1.0.24\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"proc-macro\"" -C metadata=5307a9bab1bc2cea -C extra-filename=-5307a9bab1bc2cea --out-dir C:\git\windows-docs-rs\crates\bindings\target\debug\deps -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern unicode_xid=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libunicode_xid-507ec082820f9cd6.rmeta --cap-lints allow --cfg lexerror_display --cfg hygiene --cfg use_proc_macro --cfg wrap_proc_macro --cfg proc_macro_span`
    Checking quote v1.0.9
     Running `rustc --crate-name quote --edition=2018 C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\quote-1.0.9\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"proc-macro\"" -C metadata=27894debf18298db -C extra-filename=-27894debf18298db --out-dir C:\git\windows-docs-rs\crates\bindings\target\debug\deps -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern proc_macro2=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libproc_macro2-5307a9bab1bc2cea.rmeta --cap-lints allow`
 Documenting proc-macro2 v1.0.24
     Running `rustdoc --edition=2018 --crate-type lib --crate-name proc_macro2 C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\proc-macro2-1.0.24\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --cfg "feature=\"default\"" --cfg "feature=\"proc-macro\"" --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern unicode_xid=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libunicode_xid-507ec082820f9cd6.rmeta --crate-version 1.0.24 --cfg lexerror_display --cfg hygiene --cfg use_proc_macro --cfg wrap_proc_macro --cfg proc_macro_span`
    Checking syn v1.0.64
     Running `rustc --crate-name syn --edition=2018 C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\syn-1.0.64\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg "feature=\"clone-impls\"" --cfg "feature=\"default\"" --cfg "feature=\"derive\"" --cfg "feature=\"full\"" --cfg "feature=\"parsing\"" --cfg "feature=\"printing\"" --cfg "feature=\"proc-macro\"" --cfg "feature=\"quote\"" -C metadata=df218b7e9ba5f6c9 -C extra-filename=-df218b7e9ba5f6c9 --out-dir C:\git\windows-docs-rs\crates\bindings\target\debug\deps -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern proc_macro2=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libproc_macro2-5307a9bab1bc2cea.rmeta --extern quote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libquote-27894debf18298db.rmeta --extern unicode_xid=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libunicode_xid-507ec082820f9cd6.rmeta --cap-lints allow`
 Documenting quote v1.0.9
     Running `rustdoc --edition=2018 --crate-type lib --crate-name quote C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\quote-1.0.9\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --cfg "feature=\"default\"" --cfg "feature=\"proc-macro\"" --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern proc_macro2=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libproc_macro2-5307a9bab1bc2cea.rmeta --crate-version 1.0.9`
 Documenting syn v1.0.64
     Running `rustdoc --edition=2018 --crate-type lib --crate-name syn C:\Users\kekerr\.cargo\registry\src\github.com-1ecc6299db9ec823\syn-1.0.64\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --cfg "feature=\"clone-impls\"" --cfg "feature=\"default\"" --cfg "feature=\"derive\"" --cfg "feature=\"full\"" --cfg "feature=\"parsing\"" --cfg "feature=\"printing\"" --cfg "feature=\"proc-macro\"" --cfg "feature=\"quote\"" --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern proc_macro2=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libproc_macro2-5307a9bab1bc2cea.rmeta --extern quote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libquote-27894debf18298db.rmeta --extern unicode_xid=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libunicode_xid-507ec082820f9cd6.rmeta --crate-version 1.0.64`
    Checking windows_gen v0.5.0 (https://github.com/microsoft/windows-rs#1e1e4812)
 Documenting windows_gen_macros v0.5.0 (https://github.com/microsoft/windows-rs#1e1e4812)
     Running `rustc --crate-name windows_gen --edition=2018 C:\Users\kekerr\.cargo\git\checkouts\windows-rs-4d19330348d493fa\1e1e481\crates\gen\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C metadata=ff66c90b0b4dcc8e -C extra-filename=-ff66c90b0b4dcc8e --out-dir C:\git\windows-docs-rs\crates\bindings\target\debug\deps -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern proc_macro2=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libproc_macro2-5307a9bab1bc2cea.rmeta --extern quote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libquote-27894debf18298db.rmeta --extern squote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libsquote-791090b5e7f7bfb4.rmeta --extern syn=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libsyn-df218b7e9ba5f6c9.rmeta --extern windows_gen_macros=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\windows_gen_macros-ea0ce77c5272fd48.dll --cap-lints allow`
     Running `rustdoc --edition=2018 --crate-type proc-macro --crate-name windows_gen_macros C:\Users\kekerr\.cargo\git\checkouts\windows-rs-4d19330348d493fa\1e1e481\crates\gen\macros\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern proc_macro2=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libproc_macro2-5307a9bab1bc2cea.rmeta --extern quote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libquote-27894debf18298db.rmeta --extern syn=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libsyn-df218b7e9ba5f6c9.rmeta --extern proc_macro --crate-version 0.5.0`
 Documenting windows_gen v0.5.0 (https://github.com/microsoft/windows-rs#1e1e4812)
     Running `rustdoc --edition=2018 --crate-type lib --crate-name windows_gen C:\Users\kekerr\.cargo\git\checkouts\windows-rs-4d19330348d493fa\1e1e481\crates\gen\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern proc_macro2=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libproc_macro2-5307a9bab1bc2cea.rmeta --extern quote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libquote-27894debf18298db.rmeta --extern squote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libsquote-791090b5e7f7bfb4.rmeta --extern syn=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libsyn-df218b7e9ba5f6c9.rmeta --extern windows_gen_macros=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\windows_gen_macros-ea0ce77c5272fd48.dll --crate-version 0.5.0`
 Documenting windows_macros v0.5.0 (https://github.com/microsoft/windows-rs#1e1e4812)
    Checking windows v0.5.0 (https://github.com/microsoft/windows-rs#1e1e4812)
     Running `rustdoc --edition=2018 --crate-type proc-macro --crate-name windows_macros C:\Users\kekerr\.cargo\git\checkouts\windows-rs-4d19330348d493fa\1e1e481\crates\macros\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern proc_macro2=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libproc_macro2-5307a9bab1bc2cea.rmeta --extern quote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libquote-27894debf18298db.rmeta --extern squote=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libsquote-791090b5e7f7bfb4.rmeta --extern syn=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libsyn-df218b7e9ba5f6c9.rmeta --extern gen=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libwindows_gen-ff66c90b0b4dcc8e.rmeta --extern proc_macro --crate-version 0.5.0`
     Running `rustc --crate-name windows --edition=2018 C:\Users\kekerr\.cargo\git\checkouts\windows-rs-4d19330348d493fa\1e1e481\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C metadata=00334cb2cd2fe95b -C extra-filename=-00334cb2cd2fe95b --out-dir C:\git\windows-docs-rs\crates\bindings\target\debug\deps -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern const_sha1=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libconst_sha1-990380613f00f439.rmeta --extern gen=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libwindows_gen-ff66c90b0b4dcc8e.rmeta --extern windows_macros=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\windows_macros-ca5cd3c725553d01.dll --cap-lints allow`
 Documenting windows v0.5.0 (https://github.com/microsoft/windows-rs#1e1e4812)
     Running `rustdoc --edition=2018 --crate-type lib --crate-name windows C:\Users\kekerr\.cargo\git\checkouts\windows-rs-4d19330348d493fa\1e1e481\src\lib.rs --cap-lints allow -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern const_sha1=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libconst_sha1-990380613f00f439.rmeta --extern gen=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libwindows_gen-ff66c90b0b4dcc8e.rmeta --extern windows_macros=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\windows_macros-ca5cd3c725553d01.dll --crate-version 0.5.0`
 Documenting bindings v0.1.0 (C:\git\windows-docs-rs\crates\bindings)
     Running `rustdoc --edition=2018 --crate-type lib --crate-name bindings src\lib.rs -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern windows=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libwindows-00334cb2cd2fe95b.rmeta --crate-version 0.1.0`
    Building [=========================> ] 36/37: bindings(doc)

@jyn514
Copy link

jyn514 commented Mar 19, 2021

Is there a way to get a backtrace of where rustdoc gets stuck? On linux I'd use GDB, but I don't know how things work on windows.

$ gdb $(rustup which rustdoc)
Reading symbols from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc...done.
(gdb) run --edition=2018 --crate-type lib --crate-name bindings src\lib.rs -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern windows=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libwindows-00334cb2cd2fe95b.rmeta --crate-version 0.1.0
Starting program: /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc --edition=2018 --crate-type lib --crate-name bindings src\lib.rs -o C:\git\windows-docs-rs\crates\bindings\target\doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=C:\git\windows-docs-rs\crates\bindings\target\debug\deps --extern windows=C:\git\windows-docs-rs\crates\bindings\target\debug\deps\libwindows-00334cb2cd2fe95b.rmeta --crate-version 0.1.0
^C[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGINT, Interrupt.
__GI__dl_debug_state () at dl-debug.c:74
74	dl-debug.c: No such file or directory.
(gdb) where
#0  __GI__dl_debug_state () at dl-debug.c:74
#1  0x00007ffff7fd9224 in dl_main (phdr=<optimized out>, phnum=<optimized out>, 
    user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:2297
...

@kennykerr
Copy link
Collaborator Author

0x0000000000000000
ntdll.dll!ZwWriteFile+0x14
KERNELBASE.dll!WriteFile+0x76
std-433726893ecbdc61.dll!ZN73_$LT$std..sys..windows..process..ExitCode$u20$as$u20$core..fmt..Debug$GT$3fmt17hca60c0a2810bdc5cE+0x173
std-433726893ecbdc61.dll!ZN61_$LT$$RF$std..io..stdio..Stderr$u20$as$u20$std..io..Write$GT$5write17h33fb56dd4023aabeE+0x5d
std-433726893ecbdc61.dll!ZN57_$LT$std..io..stdio..Stderr$u20$as$u20$std..io..Write$GT$5write17hbf6cc0bd45c65baeE+0x17
rustc_driver-e702a4161d969f23.dll!ZN82_$LT$rustc_errors..emitter..FileWithAnnotatedLines$u20$as$u20$core..fmt..Debug$GT$3fmt17hf1458517372b29e1E+0x100d1
rustc_driver-e702a4161d969f23.dll!ZN65_$LT$rustc_errors..snippet..Style$u20$as$u20$core..fmt..Debug$GT$3fmt17h851acdd2da3cd1f5E+0x151b
rustc_driver-e702a4161d969f23.dll!ZN15rustc_serialize4json10escape_str17h16bc3f7976fc85a2E+0x376
rustc_driver-e702a4161d969f23.dll!ZN80_$LT$rustc_feature..builtin_attrs..AttributeType$u20$as$u20$core..fmt..Debug$GT$3fmt17h2bf0835a1bedb5afE+0x213b
rustc_driver-e702a4161d969f23.dll!ZN80_$LT$rustc_feature..builtin_attrs..AttributeType$u20$as$u20$core..fmt..Debug$GT$3fmt17h2bf0835a1bedb5afE+0x2ae6
rustc_driver-e702a4161d969f23.dll!ZN80_$LT$rustc_feature..builtin_attrs..AttributeType$u20$as$u20$core..fmt..Debug$GT$3fmt17h2bf0835a1bedb5afE+0x1c8f
rustc_driver-e702a4161d969f23.dll!ZN80_$LT$rustc_feature..builtin_attrs..AttributeType$u20$as$u20$core..fmt..Debug$GT$3fmt17h2bf0835a1bedb5afE+0x2dc9
rustc_driver-e702a4161d969f23.dll!ZN80_$LT$rustc_feature..builtin_attrs..AttributeType$u20$as$u20$core..fmt..Debug$GT$3fmt17h2bf0835a1bedb5afE+0x12d3
rustc_driver-e702a4161d969f23.dll!ZN80_$LT$rustc_feature..builtin_attrs..AttributeType$u20$as$u20$core..fmt..Debug$GT$3fmt17h2bf0835a1bedb5afE+0x2f1
std-433726893ecbdc61.dll!ZN4core3fmt5write17h187a24ff0c56237dE+0x1bc
rustc_driver-e702a4161d969f23.dll!ZN82_$LT$rustc_errors..emitter..FileWithAnnotatedLines$u20$as$u20$core..fmt..Debug$GT$3fmt17hf1458517372b29e1E+0xfe98
rustc_driver-e702a4161d969f23.dll!ZN82_$LT$rustc_errors..json..JsonEmitter$u20$as$u20$rustc_errors..emitter..Emitter$GT$15emit_diagnostic17h639042b1b317e02aE+0x10c
rustc_driver-e702a4161d969f23.dll!ZN12rustc_errors12HandlerInner15emit_diagnostic17h40915085adae709eE+0x553
rustc_driver-e702a4161d969f23.dll!ZN12rustc_errors18diagnostic_builder17DiagnosticBuilder4emit17h0ac21c7974ca8f01E+0x40
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x1062a
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x4b21
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x1a33
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x700
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$9parse_mod17hd5bbb582d7447879E+0x19d
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x636d
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x1a33
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x700
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$9parse_mod17hd5bbb582d7447879E+0x19d
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x636d
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x1a33
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x700
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$9parse_mod17hd5bbb582d7447879E+0x19d
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x636d
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x1a33
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x700
rustc_driver-e702a4161d969f23.dll!ZN11rustc_parse6parser4item45_$LT$impl$u20$rustc_parse..parser..Parser$GT$10parse_item17hca70d78806ee9bd0E+0x81
rustc_driver-e702a4161d969f23.dll!ZN113_$LT$rustc_builtin_macros..source_util..expand_include..ExpandResult$u20$as$u20$rustc_expand..base..MacResult$GT$10make_items17hf0a0f216a4d6df36E+0x87
rustc_driver-e702a4161d969f23.dll!ZN12rustc_expand6expand15AstFragmentKind4name17h310f845e49c44671E+0x1ea
rustc_driver-e702a4161d969f23.dll!ZN12rustc_expand6expand13MacroExpander21fully_expand_fragment17h30a9c7402cb06b97E+0xbb7
rustc_driver-e702a4161d969f23.dll!ZN12rustc_expand6expand13MacroExpander12expand_crate17h3ce2bea162cbc5bdE+0x721
rustc_driver-e702a4161d969f23.dll!ZN186_$LT$rls_span..compiler.._..$LT$impl$u20$serde..de..Deserialize$u20$for$u20$rls_span..compiler..DiagnosticSpanMacroExpansion$GT$..deserialize..__Visitor$u20$as$u20$serde..de..Visitor$GT$9expecting17hd5b46ca79c97c9e8E
rustc_driver-e702a4161d969f23.dll!ZN15rustc_interface6passes13BoxedResolver19to_resolver_outputs17h5f8a5bedc836c902E+0x111e
rustc_driver-e702a4161d969f23.dll!ZN186_$LT$rls_span..compiler.._..$LT$impl$u20$serde..de..Deserialize$u20$for$u20$rls_span..compiler..DiagnosticSpanMacroExpansion$GT$..deserialize..__Visitor$u20$as$u20$serde..de..Visitor$GT$9expecting17hd5b46ca79c97c9e8E
rustc_driver-e702a4161d969f23.dll!ZN186_$LT$rls_span..compiler.._..$LT$impl$u20$serde..de..Deserialize$u20$for$u20$rls_span..compiler..DiagnosticSpanMacroExpansion$GT$..deserialize..__Visitor$u20$as$u20$serde..de..Visitor$GT$9expecting17hd5b46ca79c97c9e8E
rustc_driver-e702a4161d969f23.dll!ZN15rustc_interface7queries7Queries9expansion17h0af6a7fca9ccc97dE+0x253
rustdoc.exe+0x257c17
rustdoc.exe+0x1ede5c
rustdoc.exe+0x2d4efc
rustdoc.exe+0x1ef760
rustdoc.exe+0x3813
rustdoc.exe+0x29e96f
rustdoc.exe+0x2d6abd
std-433726893ecbdc61.dll!ZN3std3sys7windows6thread6Thread3new17h4d6a5ec427db4b44E+0x19a
KERNEL32.DLL!BaseThreadInitThunk+0x14
ntdll.dll!RtlUserThreadStart+0x21

@kennykerr
Copy link
Collaborator Author

Not sure if that means anything to you. It means nothing to me. 😜

@kennykerr
Copy link
Collaborator Author

I'm guessing it can't find symbols for rustdoc, which isn't very helpful.

@GuillaumeGomez
Copy link
Contributor

Looks like rustc encountered an error and that's pretty much it... Is it the full backtrace when rustdoc is stuck?

@kennykerr
Copy link
Collaborator Author

Yep, that's the whole thing.

@kennykerr
Copy link
Collaborator Author

cargo meanwhile is spinning away warming up my office.

image

@GuillaumeGomez
Copy link
Contributor

It's stuck while trying to output an error then? How weird...

@jyn514
Copy link

jyn514 commented Mar 19, 2021

@kennykerr it's hanging while parsing, before any part of rustdoc runs. Can you replicate the hang with cargo check --cfg doc?

@kennykerr
Copy link
Collaborator Author

C:\git\windows-docs-rs\crates\bindings>cargo check --cfg doc
error: Found argument '--cfg' which wasn't expected, or isn't valid in this context

@jyn514
Copy link

jyn514 commented Mar 19, 2021

Sorry, cargo rustc -- --cfg doc.

@kennykerr
Copy link
Collaborator Author

Yes, this produces the same hang. rustc stack looks much the same as the earlier rustdoc stack.

@GuillaumeGomez
Copy link
Contributor

Seems like you have some #[cfg(doc)] issues. :)

@jyn514
Copy link

jyn514 commented Mar 19, 2021

Yes, this produces the same hang. rustc stack looks much the same as the earlier rustdoc stack.

Great, that should be a lot easier to bisect. The next step is to try and figure out if this is a rustc regression or a windows-rs regression. Does this work on beta? Does it work on 0.3.1 with the latest nightly?

If it's a rustc regression, you can use https://github.com/rust-lang/cargo-bisect-rustc to find out where it broke. Otherwise I'd try git bisect to see if you can narrow it down somehow.

@kennykerr
Copy link
Collaborator Author

It's stuck while trying to output an error then? How weird...

Looks like this is the problem. For the windows-docs-rs project, the generated code that is around 180MB worth of Rust, is generated on a single line of code, because rustfmt takes too long. It looks like rust then tries to include the entire line in the error message and hangs. 😄

@jyn514
Copy link

jyn514 commented Mar 19, 2021

Great! Can you open an issue on rust-lang/rust for that? It sounds like a bug in rustc_error itself.

@kennykerr
Copy link
Collaborator Author

Will do. So I finally root caused this. Turns out a bug in the win32 metadata was causing the windows crate to generate bad Rust, which was causing cargo/rustc to hang while trying to emit a compiler error for a single line of Rust that spanned 180,124,983 characters.

Now I'm back to watching the infuriatingly single-threaded Rust builds... 🙄

image

@kennykerr
Copy link
Collaborator Author

Thanks for all the help everyone!

@jyn514
Copy link

jyn514 commented Mar 19, 2021

Now I'm back to watching the infuriatingly single-threaded Rust builds... 🙄

Have you tried building a custom rustc with parallel-compiler = true to see how much that helps?

@kennykerr kennykerr removed the blocked label Mar 19, 2021
@kennykerr
Copy link
Collaborator Author

building a custom rustc

I haven't graduated to that level of Rust ninja yet...

@kennykerr
Copy link
Collaborator Author

Time to close this issue. I have published version 0.6.0 of the windows crate including:

  • Add Linux build support (compile only).
  • Add full x64 and x86 build support.
  • Workarounds for Rust documentation issues.
  • Updated metadata providing many fixes and improvements to Win32 APIs.

This has fixed both doc publishing issues. The windows crate docs are working and the generated Windows API docs are updated as well.

@jyn514 I wasn't able to produce a minimal repro of the rustc bug where long lines causes the whole build system to hang.

Anyway, hopefully now that both windows and windows-docs build on Linux, it should be easier for folks to use both for stress testing and analysis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants