From c27fa5c3329d4f7fce200043c3117bc1a548f025 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Mon, 29 Jul 2024 15:37:45 -0400 Subject: rewrite rustdoc-default-output to rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/issue-88756-default-output/Makefile | 4 - .../run-make/issue-88756-default-output/README.md | 1 - .../output-default.stdout | 200 --------------------- tests/run-make/issue-88756-default-output/x.rs | 1 - .../rustdoc-default-output/output-default.stdout | 200 +++++++++++++++++++++ tests/run-make/rustdoc-default-output/rmake.rs | 16 ++ 7 files changed, 216 insertions(+), 207 deletions(-) delete mode 100644 tests/run-make/issue-88756-default-output/Makefile delete mode 100644 tests/run-make/issue-88756-default-output/README.md delete mode 100644 tests/run-make/issue-88756-default-output/output-default.stdout delete mode 100644 tests/run-make/issue-88756-default-output/x.rs create mode 100644 tests/run-make/rustdoc-default-output/output-default.stdout create mode 100644 tests/run-make/rustdoc-default-output/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index dc4db13902d..d8eb5667ab8 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -19,7 +19,6 @@ run-make/issue-36710/Makefile run-make/issue-47551/Makefile run-make/issue-69368/Makefile run-make/issue-84395-lto-embed-bitcode/Makefile -run-make/issue-88756-default-output/Makefile run-make/jobserver-error/Makefile run-make/libs-through-symlinks/Makefile run-make/libtest-json/Makefile diff --git a/tests/run-make/issue-88756-default-output/Makefile b/tests/run-make/issue-88756-default-output/Makefile deleted file mode 100644 index d1c3d0fe082..00000000000 --- a/tests/run-make/issue-88756-default-output/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(BARE_RUSTDOC) 2>&1 | sed -E 's@/nightly/|/beta/|/stable/|/1\.[0-9]+\.[0-9]+/@/$$CHANNEL/@g' | diff - output-default.stdout diff --git a/tests/run-make/issue-88756-default-output/README.md b/tests/run-make/issue-88756-default-output/README.md deleted file mode 100644 index 8cbfac4f7d2..00000000000 --- a/tests/run-make/issue-88756-default-output/README.md +++ /dev/null @@ -1 +0,0 @@ -This is a test to verify that the default behavior of `rustdoc` is printing out help output instead of erroring out (#88756). diff --git a/tests/run-make/issue-88756-default-output/output-default.stdout b/tests/run-make/issue-88756-default-output/output-default.stdout deleted file mode 100644 index bc38d9e9dc6..00000000000 --- a/tests/run-make/issue-88756-default-output/output-default.stdout +++ /dev/null @@ -1,200 +0,0 @@ -rustdoc [options] - -Options: - -h, --help show this help message - -V, --version print rustdoc's version - -v, --verbose use verbose output - -w, --output-format [html] - the output type to write - --output PATH Which directory to place the output. This option is - deprecated, use --out-dir instead. - -o, --out-dir PATH which directory to place the output - --crate-name NAME - specify the name of this crate - --crate-type [bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] - Comma separated list of types of crates - for the compiler to emit - -L, --library-path DIR - directory to add to crate search path - --cfg pass a --cfg to rustc - --check-cfg pass a --check-cfg to rustc - --extern NAME[=PATH] - pass an --extern to rustc - --extern-html-root-url NAME=URL - base URL to use for dependencies; for example, - "std=/doc" links std::vec::Vec to - /doc/std/vec/struct.Vec.html - --extern-html-root-takes-precedence - give precedence to `--extern-html-root-url`, not - `html_root_url` - -C, --codegen OPT[=VALUE] - pass a codegen option to rustc - --document-private-items - document private items - --document-hidden-items - document items that have doc(hidden) - --test run code examples as tests - --test-args ARGS - arguments to pass to the test runner - --test-run-directory PATH - The working directory in which to run tests - --target TRIPLE target triple to document - --markdown-css FILES - CSS files to include via in a rendered Markdown - file - --html-in-header FILES - files to include inline in the section of a - rendered Markdown file or generated documentation - --html-before-content FILES - files to include inline between and the content - of a rendered Markdown file or generated documentation - --html-after-content FILES - files to include inline between the content and - of a rendered Markdown file or generated - documentation - --markdown-before-content FILES - files to include inline between and the content - of a rendered Markdown file or generated documentation - --markdown-after-content FILES - files to include inline between the content and - of a rendered Markdown file or generated - documentation - --markdown-playground-url URL - URL to send code snippets to - --markdown-no-toc - don't include table of contents - -e, --extend-css PATH - To add some CSS rules with a given file to generate - doc with your own theme. However, your theme might - break if the rustdoc's generated HTML changes, so be - careful! - -Z FLAG unstable / perma-unstable options (only on nightly - build) - --sysroot PATH Override the system root - --playground-url URL - URL to send code snippets to, may be reset by - --markdown-playground-url or - `#![doc(html_playground_url=...)]` - --display-doctest-warnings - show warnings that originate in doctests - --crate-version VERSION - crate version to print into documentation - --sort-modules-by-appearance - sort modules by where they appear in the program, - rather than alphabetically - --default-theme THEME - Set the default theme. THEME should be the theme name, - generally lowercase. If an unknown default theme is - specified, the builtin default is used. The set of - themes, and the rustdoc built-in default, are not - stable. - --default-setting SETTING[=VALUE] - Default value for a rustdoc setting (used when - "rustdoc-SETTING" is absent from web browser Local - Storage). If VALUE is not supplied, "true" is used. - Supported SETTINGs and VALUEs are not documented and - not stable. - --theme FILES additional themes which will be added to the generated - docs - --check-theme FILES - check if given theme is valid - --resource-suffix PATH - suffix to add to CSS and JavaScript files, e.g., - "search-index.js" will become "search-index-suffix.js" - --edition EDITION - edition to use when compiling rust code (default: - 2015) - --color auto|always|never - Configure coloring of output: - auto = colorize, if output goes to a tty (default); - always = always colorize output; - never = never colorize output - --error-format human|json|short - How errors and other messages are produced - --diagnostic-width WIDTH - Provide width of the output for truncated error - messages - --json CONFIG Configure the structure of JSON diagnostics - -A, --allow LINT Set lint allowed - -W, --warn LINT Set lint warnings - --force-warn LINT - Set lint force-warn - -D, --deny LINT Set lint denied - -F, --forbid LINT Set lint forbidden - --cap-lints LEVEL - Set the most restrictive lint level. More restrictive - lints are capped at this level. By default, it is at - `forbid` level. - --index-page PATH - Markdown file to be used as index page - --enable-index-page - To enable generation of the index page - --static-root-path PATH - Path string to force loading static files from in - output pages. If not set, uses combinations of '../' - to reach the documentation root. - --persist-doctests PATH - Directory to persist doctest executables into - --show-coverage - calculate percentage of public items with - documentation - --enable-per-target-ignores - parse ignore-foo for ignoring doctests on a per-target - basis - --runtool The tool to run tests with when building for a different target than host - - --runtool-arg One (of possibly many) arguments to pass to the runtool - - --test-builder PATH - The rustc-like binary to use as the test builder - --test-builder-wrapper PATH - Wrapper program to pass test-builder and arguments - --check Run rustdoc checks - --generate-redirect-map - Generate JSON file at the top level instead of - generating HTML redirection files - --emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific] - Comma separated list of types of output for rustdoc to - emit - --no-run Compile doctests without running them - --remap-path-prefix FROM=TO - Remap source names in compiler messages - --show-type-layout - Include the memory layout of types in the docs - --nocapture Don't capture stdout and stderr of tests - --generate-link-to-definition - Make the identifiers in the HTML source code pages - navigable - --scrape-examples-output-path collect function call information and output at the given path - - --scrape-examples-target-crate collect function call information for functions from the target crate - - --scrape-tests Include test code when scraping examples - --with-examples path to function call information (for displaying examples in the documentation) - - --disable-minification - removed - --plugin-path DIR - removed, see issue #44136 - for - more information - --passes PASSES removed, see issue #44136 - for - more information - --plugins PLUGINS - removed, see issue #44136 - for - more information - --no-defaults removed, see issue #44136 - for - more information - -r, --input-format [rust] - removed, see issue #44136 - for - more information - --html-no-source - Disable HTML source code pages generation - - @path Read newline separated options from `path` - -More information available at https://doc.rust-lang.org/$CHANNEL/rustdoc/what-is-rustdoc.html diff --git a/tests/run-make/issue-88756-default-output/x.rs b/tests/run-make/issue-88756-default-output/x.rs deleted file mode 100644 index 5df7576133a..00000000000 --- a/tests/run-make/issue-88756-default-output/x.rs +++ /dev/null @@ -1 +0,0 @@ -// nothing to see here diff --git a/tests/run-make/rustdoc-default-output/output-default.stdout b/tests/run-make/rustdoc-default-output/output-default.stdout new file mode 100644 index 00000000000..bc38d9e9dc6 --- /dev/null +++ b/tests/run-make/rustdoc-default-output/output-default.stdout @@ -0,0 +1,200 @@ +rustdoc [options] + +Options: + -h, --help show this help message + -V, --version print rustdoc's version + -v, --verbose use verbose output + -w, --output-format [html] + the output type to write + --output PATH Which directory to place the output. This option is + deprecated, use --out-dir instead. + -o, --out-dir PATH which directory to place the output + --crate-name NAME + specify the name of this crate + --crate-type [bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] + Comma separated list of types of crates + for the compiler to emit + -L, --library-path DIR + directory to add to crate search path + --cfg pass a --cfg to rustc + --check-cfg pass a --check-cfg to rustc + --extern NAME[=PATH] + pass an --extern to rustc + --extern-html-root-url NAME=URL + base URL to use for dependencies; for example, + "std=/doc" links std::vec::Vec to + /doc/std/vec/struct.Vec.html + --extern-html-root-takes-precedence + give precedence to `--extern-html-root-url`, not + `html_root_url` + -C, --codegen OPT[=VALUE] + pass a codegen option to rustc + --document-private-items + document private items + --document-hidden-items + document items that have doc(hidden) + --test run code examples as tests + --test-args ARGS + arguments to pass to the test runner + --test-run-directory PATH + The working directory in which to run tests + --target TRIPLE target triple to document + --markdown-css FILES + CSS files to include via in a rendered Markdown + file + --html-in-header FILES + files to include inline in the section of a + rendered Markdown file or generated documentation + --html-before-content FILES + files to include inline between and the content + of a rendered Markdown file or generated documentation + --html-after-content FILES + files to include inline between the content and + of a rendered Markdown file or generated + documentation + --markdown-before-content FILES + files to include inline between and the content + of a rendered Markdown file or generated documentation + --markdown-after-content FILES + files to include inline between the content and + of a rendered Markdown file or generated + documentation + --markdown-playground-url URL + URL to send code snippets to + --markdown-no-toc + don't include table of contents + -e, --extend-css PATH + To add some CSS rules with a given file to generate + doc with your own theme. However, your theme might + break if the rustdoc's generated HTML changes, so be + careful! + -Z FLAG unstable / perma-unstable options (only on nightly + build) + --sysroot PATH Override the system root + --playground-url URL + URL to send code snippets to, may be reset by + --markdown-playground-url or + `#![doc(html_playground_url=...)]` + --display-doctest-warnings + show warnings that originate in doctests + --crate-version VERSION + crate version to print into documentation + --sort-modules-by-appearance + sort modules by where they appear in the program, + rather than alphabetically + --default-theme THEME + Set the default theme. THEME should be the theme name, + generally lowercase. If an unknown default theme is + specified, the builtin default is used. The set of + themes, and the rustdoc built-in default, are not + stable. + --default-setting SETTING[=VALUE] + Default value for a rustdoc setting (used when + "rustdoc-SETTING" is absent from web browser Local + Storage). If VALUE is not supplied, "true" is used. + Supported SETTINGs and VALUEs are not documented and + not stable. + --theme FILES additional themes which will be added to the generated + docs + --check-theme FILES + check if given theme is valid + --resource-suffix PATH + suffix to add to CSS and JavaScript files, e.g., + "search-index.js" will become "search-index-suffix.js" + --edition EDITION + edition to use when compiling rust code (default: + 2015) + --color auto|always|never + Configure coloring of output: + auto = colorize, if output goes to a tty (default); + always = always colorize output; + never = never colorize output + --error-format human|json|short + How errors and other messages are produced + --diagnostic-width WIDTH + Provide width of the output for truncated error + messages + --json CONFIG Configure the structure of JSON diagnostics + -A, --allow LINT Set lint allowed + -W, --warn LINT Set lint warnings + --force-warn LINT + Set lint force-warn + -D, --deny LINT Set lint denied + -F, --forbid LINT Set lint forbidden + --cap-lints LEVEL + Set the most restrictive lint level. More restrictive + lints are capped at this level. By default, it is at + `forbid` level. + --index-page PATH + Markdown file to be used as index page + --enable-index-page + To enable generation of the index page + --static-root-path PATH + Path string to force loading static files from in + output pages. If not set, uses combinations of '../' + to reach the documentation root. + --persist-doctests PATH + Directory to persist doctest executables into + --show-coverage + calculate percentage of public items with + documentation + --enable-per-target-ignores + parse ignore-foo for ignoring doctests on a per-target + basis + --runtool The tool to run tests with when building for a different target than host + + --runtool-arg One (of possibly many) arguments to pass to the runtool + + --test-builder PATH + The rustc-like binary to use as the test builder + --test-builder-wrapper PATH + Wrapper program to pass test-builder and arguments + --check Run rustdoc checks + --generate-redirect-map + Generate JSON file at the top level instead of + generating HTML redirection files + --emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific] + Comma separated list of types of output for rustdoc to + emit + --no-run Compile doctests without running them + --remap-path-prefix FROM=TO + Remap source names in compiler messages + --show-type-layout + Include the memory layout of types in the docs + --nocapture Don't capture stdout and stderr of tests + --generate-link-to-definition + Make the identifiers in the HTML source code pages + navigable + --scrape-examples-output-path collect function call information and output at the given path + + --scrape-examples-target-crate collect function call information for functions from the target crate + + --scrape-tests Include test code when scraping examples + --with-examples path to function call information (for displaying examples in the documentation) + + --disable-minification + removed + --plugin-path DIR + removed, see issue #44136 + for + more information + --passes PASSES removed, see issue #44136 + for + more information + --plugins PLUGINS + removed, see issue #44136 + for + more information + --no-defaults removed, see issue #44136 + for + more information + -r, --input-format [rust] + removed, see issue #44136 + for + more information + --html-no-source + Disable HTML source code pages generation + + @path Read newline separated options from `path` + +More information available at https://doc.rust-lang.org/$CHANNEL/rustdoc/what-is-rustdoc.html diff --git a/tests/run-make/rustdoc-default-output/rmake.rs b/tests/run-make/rustdoc-default-output/rmake.rs new file mode 100644 index 00000000000..06720445a35 --- /dev/null +++ b/tests/run-make/rustdoc-default-output/rmake.rs @@ -0,0 +1,16 @@ +// Calling rustdoc with no arguments, which should bring up a help menu, used to +// cause an error as rustdoc expects an input file. Fixed in #98331, this test +// ensures the output of rustdoc's help menu is as expected. +// See https://github.com/rust-lang/rust/issues/88756 + +use run_make_support::{bare_rustdoc, diff}; + +fn main() { + let out = bare_rustdoc().run().stdout_utf8(); + diff() + .expected_file("output-default.stdout") + .actual_text("actual", out) + // replace the channel type in the URL with $CHANNEL + .normalize(r"nightly/|beta/|stable/|1\.[0-9]+\.[0-9]+/", "$$CHANNEL/") + .run(); +} -- cgit 1.4.1-3-g733a5