about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2020-08-03 19:37:22 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2020-08-05 10:42:42 +1000
commit530140729a458462f5c6e735e771651ce419a0a3 (patch)
treeaf75919b617161f88ca4f045a20808e36097cbbc /src/test/codegen/src-hash-algorithm
parent8244b1b11488a336a485f07fd6550b973009a931 (diff)
downloadrust-530140729a458462f5c6e735e771651ce419a0a3.tar.gz
rust-530140729a458462f5c6e735e771651ce419a0a3.zip
Avoid an unnecessary thread creation at rustdoc startup.
rustdoc's `main()` immediately spawns a thread, M, with a large stack
(16MiB or 32MiB) on which it runs `main_args()`. `main_args()` does a
small amount of options processing and then calls
`setup_callbacks_and_run_in_default_thread_pool_with_globals()`, which
spawns it own thread, and M is not used further.

So, thread M seems unnecessary. However, it does serve a purpose: if the
options processing in `main_args()` panics, that panic is caught when M
is joined. So M can't simply be removed.

However, `main_options()`, which is called by `main_args()`, has a
`catch_fatal_errors()` call within it. We can move that call to `main()`
and change it to the very similar `catch_with_exit_code()`. With that in
place, M can be removed, and panics from options processing will still
be caught appropriately.

Even better, this makes rustdoc's `main()` match rustc's `main()`, which
also uses `catch_with_exit_code()`.

(Also note that the use of a 16MiB/32MiB stack was eliminated from rustc
in #55617.)
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions