From 837b550238aa671a591ccf282dddeab29cadb206 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:42 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/rustdoc-ui/assoc-item-not-in-scope.rs | 22 - tests/rustdoc-ui/assoc-item-not-in-scope.stderr | 14 - tests/rustdoc-ui/auxiliary/empty-fn.rs | 3 - tests/rustdoc-ui/auxiliary/extern_macros.rs | 7 - tests/rustdoc-ui/auxiliary/issue-61592.rs | 3 - tests/rustdoc-ui/auxiliary/panic-handler.rs | 9 - tests/rustdoc-ui/bare-urls.fixed | 60 -- tests/rustdoc-ui/bare-urls.rs | 60 -- tests/rustdoc-ui/bare-urls.stderr | 143 --- tests/rustdoc-ui/block-doc-comment.rs | 17 - tests/rustdoc-ui/block-doc-comment.stdout | 5 - tests/rustdoc-ui/cfg-test.rs | 31 - tests/rustdoc-ui/cfg-test.stdout | 7 - tests/rustdoc-ui/check-attr-test.rs | 31 - tests/rustdoc-ui/check-attr-test.stderr | 151 ---- tests/rustdoc-ui/check-attr.rs | 41 - tests/rustdoc-ui/check-attr.stderr | 175 ---- tests/rustdoc-ui/check-cfg-test.rs | 12 - tests/rustdoc-ui/check-cfg-test.stderr | 11 - tests/rustdoc-ui/check-cfg-test.stdout | 6 - tests/rustdoc-ui/check-cfg-unstable.rs | 2 - tests/rustdoc-ui/check-cfg-unstable.stderr | 2 - tests/rustdoc-ui/check-cfg.rs | 7 - tests/rustdoc-ui/check-cfg.stderr | 10 - tests/rustdoc-ui/check-cfg/check-cfg-test.stderr | 11 + tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs | 2 + .../rustdoc-ui/check-cfg/check-cfg-unstable.stderr | 2 + tests/rustdoc-ui/check-cfg/check-cfg.rs | 7 + tests/rustdoc-ui/check-cfg/check-cfg.stderr | 10 + tests/rustdoc-ui/check-fail.rs | 23 - tests/rustdoc-ui/check-fail.stderr | 56 -- tests/rustdoc-ui/check.rs | 15 - tests/rustdoc-ui/check.stderr | 61 -- .../deny-intra-link-resolution-failure.rs | 4 - .../deny-intra-link-resolution-failure.stderr | 15 - tests/rustdoc-ui/deny-missing-docs-crate.rs | 3 - tests/rustdoc-ui/deny-missing-docs-crate.stderr | 22 - tests/rustdoc-ui/deny-missing-docs-macro.rs | 8 - tests/rustdoc-ui/deny-missing-docs-macro.stderr | 14 - tests/rustdoc-ui/display-output.rs | 15 - tests/rustdoc-ui/display-output.stdout | 43 - tests/rustdoc-ui/doc-attr.rs | 25 - tests/rustdoc-ui/doc-attr.stderr | 71 -- tests/rustdoc-ui/doc-comment-multi-line-attr.rs | 11 - .../rustdoc-ui/doc-comment-multi-line-attr.stdout | 6 - .../rustdoc-ui/doc-comment-multi-line-cfg-attr.rs | 12 - .../doc-comment-multi-line-cfg-attr.stdout | 6 - tests/rustdoc-ui/doc-spotlight.fixed | 8 - tests/rustdoc-ui/doc-spotlight.rs | 8 - tests/rustdoc-ui/doc-spotlight.stderr | 19 - tests/rustdoc-ui/doc-test-attr-pass.rs | 8 - tests/rustdoc-ui/doc-test-attr.rs | 14 - tests/rustdoc-ui/doc-test-attr.stderr | 34 - tests/rustdoc-ui/doc-test-doctest-feature.rs | 13 - tests/rustdoc-ui/doc-test-doctest-feature.stdout | 6 - tests/rustdoc-ui/doc-test-rustdoc-feature.rs | 15 - tests/rustdoc-ui/doc-test-rustdoc-feature.stdout | 6 - tests/rustdoc-ui/doc-without-codeblock.rs | 23 - tests/rustdoc-ui/doc-without-codeblock.stderr | 38 - tests/rustdoc-ui/doc_cfg_hide.rs | 11 - tests/rustdoc-ui/doc_cfg_hide.stderr | 40 - tests/rustdoc-ui/doctest-edition.rs | 16 - tests/rustdoc-ui/doctest-edition.stderr | 22 - .../doctest-multiline-crate-attribute.rs | 10 - .../doctest-multiline-crate-attribute.stdout | 6 - tests/rustdoc-ui/doctest-output.rs | 28 - tests/rustdoc-ui/doctest-output.stdout | 8 - .../rustdoc-ui/doctest/auxiliary/extern_macros.rs | 7 + tests/rustdoc-ui/doctest/block-doc-comment.rs | 17 + tests/rustdoc-ui/doctest/block-doc-comment.stdout | 5 + tests/rustdoc-ui/doctest/cfg-test.rs | 31 + tests/rustdoc-ui/doctest/cfg-test.stdout | 7 + tests/rustdoc-ui/doctest/check-attr-test.rs | 31 + tests/rustdoc-ui/doctest/check-attr-test.stderr | 151 ++++ tests/rustdoc-ui/doctest/check-cfg-test.rs | 12 + tests/rustdoc-ui/doctest/check-cfg-test.stderr | 11 + tests/rustdoc-ui/doctest/check-cfg-test.stdout | 6 + tests/rustdoc-ui/doctest/display-output.rs | 15 + tests/rustdoc-ui/doctest/display-output.stdout | 43 + .../doctest/doc-comment-multi-line-attr.rs | 11 + .../doctest/doc-comment-multi-line-attr.stdout | 6 + .../doctest/doc-comment-multi-line-cfg-attr.rs | 12 + .../doctest/doc-comment-multi-line-cfg-attr.stdout | 6 + tests/rustdoc-ui/doctest/doc-test-attr-pass.rs | 8 + tests/rustdoc-ui/doctest/doc-test-attr.rs | 14 + tests/rustdoc-ui/doctest/doc-test-attr.stderr | 34 + .../rustdoc-ui/doctest/doc-test-doctest-feature.rs | 13 + .../doctest/doc-test-doctest-feature.stdout | 6 + .../rustdoc-ui/doctest/doc-test-rustdoc-feature.rs | 15 + .../doctest/doc-test-rustdoc-feature.stdout | 6 + tests/rustdoc-ui/doctest/doctest-edition.rs | 16 + tests/rustdoc-ui/doctest/doctest-edition.stderr | 22 + .../doctest/doctest-multiline-crate-attribute.rs | 10 + .../doctest-multiline-crate-attribute.stdout | 6 + tests/rustdoc-ui/doctest/doctest-output.rs | 28 + tests/rustdoc-ui/doctest/doctest-output.stdout | 8 + .../doctest/failed-doctest-compile-fail.rs | 12 + .../doctest/failed-doctest-compile-fail.stdout | 14 + .../failed-doctest-extra-semicolon-on-item.rs | 18 + .../failed-doctest-extra-semicolon-on-item.stdout | 24 + .../doctest/failed-doctest-missing-codes.rs | 12 + .../doctest/failed-doctest-missing-codes.stdout | 25 + .../doctest/failed-doctest-output-windows.rs | 28 + .../doctest/failed-doctest-output-windows.stdout | 39 + tests/rustdoc-ui/doctest/failed-doctest-output.rs | 28 + .../doctest/failed-doctest-output.stdout | 39 + .../doctest/failed-doctest-should-panic.rs | 12 + .../doctest/failed-doctest-should-panic.stdout | 14 + tests/rustdoc-ui/doctest/no-run-flag-error.rs | 6 + tests/rustdoc-ui/doctest/no-run-flag-error.stderr | 2 + tests/rustdoc-ui/doctest/no-run-flag.rs | 38 + tests/rustdoc-ui/doctest/no-run-flag.stdout | 12 + tests/rustdoc-ui/doctest/nocapture-fail.rs | 12 + tests/rustdoc-ui/doctest/nocapture-fail.stderr | 18 + tests/rustdoc-ui/doctest/nocapture-fail.stdout | 6 + tests/rustdoc-ui/doctest/nocapture.rs | 10 + tests/rustdoc-ui/doctest/nocapture.stderr | 1 + tests/rustdoc-ui/doctest/nocapture.stdout | 7 + tests/rustdoc-ui/doctest/private-doc-test.rs | 12 + tests/rustdoc-ui/doctest/private-item-doc-test.rs | 11 + .../doctest/private-item-doc-test.stderr | 18 + .../doctest/private-public-item-doc-test.rs | 11 + .../doctest/private-public-item-doc-test.stderr | 18 + .../doctest/public-reexported-item-doc-test.rs | 16 + .../doctest/run-directory.correct.stdout | 6 + .../doctest/run-directory.incorrect.stdout | 6 + tests/rustdoc-ui/doctest/run-directory.rs | 23 + tests/rustdoc-ui/doctest/test-compile-fail1.rs | 8 + tests/rustdoc-ui/doctest/test-compile-fail1.stderr | 14 + tests/rustdoc-ui/doctest/test-compile-fail2.rs | 3 + tests/rustdoc-ui/doctest/test-compile-fail2.stderr | 8 + tests/rustdoc-ui/doctest/test-compile-fail3.rs | 3 + tests/rustdoc-ui/doctest/test-compile-fail3.stderr | 9 + tests/rustdoc-ui/doctest/test-no_std.rs | 13 + tests/rustdoc-ui/doctest/test-no_std.stdout | 6 + tests/rustdoc-ui/doctest/test-type.rs | 26 + tests/rustdoc-ui/doctest/test-type.stdout | 10 + tests/rustdoc-ui/doctest/unparseable-doc-test.rs | 11 + .../rustdoc-ui/doctest/unparseable-doc-test.stdout | 23 + .../infinite-recursive-type-2.rs | 9 + .../infinite-recursive-type-impl-trait-return.rs | 14 + ...nfinite-recursive-type-impl-trait-return.stderr | 16 + .../error-in-impl-trait/infinite-recursive-type.rs | 9 + tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs | 157 ---- tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr | 28 - tests/rustdoc-ui/failed-doctest-compile-fail.rs | 12 - .../rustdoc-ui/failed-doctest-compile-fail.stdout | 14 - .../failed-doctest-extra-semicolon-on-item.rs | 18 - .../failed-doctest-extra-semicolon-on-item.stdout | 24 - tests/rustdoc-ui/failed-doctest-missing-codes.rs | 12 - .../rustdoc-ui/failed-doctest-missing-codes.stdout | 25 - tests/rustdoc-ui/failed-doctest-output-windows.rs | 28 - .../failed-doctest-output-windows.stdout | 39 - tests/rustdoc-ui/failed-doctest-output.rs | 28 - tests/rustdoc-ui/failed-doctest-output.stdout | 39 - tests/rustdoc-ui/failed-doctest-should-panic.rs | 12 - .../rustdoc-ui/failed-doctest-should-panic.stdout | 14 - ...ature-gate-rustdoc_missing_doc_code_examples.rs | 12 - ...e-gate-rustdoc_missing_doc_code_examples.stderr | 37 - .../generate-link-to-definition-opt-unstable.rs | 6 - ...generate-link-to-definition-opt-unstable.stderr | 2 - .../rustdoc-ui/generate-link-to-definition-opt.rs | 6 - .../generate-link-to-definition-opt.stderr | 2 - .../rustdoc-ui/generate-link-to-definition-opt2.rs | 6 - .../generate-link-to-definition-opt2.stderr | 2 - .../generate-link-to-definition-opt-unstable.rs | 6 + ...generate-link-to-definition-opt-unstable.stderr | 2 + .../generate-link-to-definition-opt.rs | 6 + .../generate-link-to-definition-opt.stderr | 2 + .../generate-link-to-definition-opt2.rs | 6 + .../generate-link-to-definition-opt2.stderr | 2 + tests/rustdoc-ui/ice-bug-report-url.rs | 14 + tests/rustdoc-ui/ice-bug-report-url.stderr | 17 + .../infinite-recursive-type-impl-trait-return.rs | 14 - ...nfinite-recursive-type-impl-trait-return.stderr | 16 - .../infinite-recursive-type-impl-trait.rs | 6 - .../infinite-recursive-type-impl-trait.stderr | 16 - .../intra-doc/assoc-item-not-in-scope.rs | 22 + .../intra-doc/assoc-item-not-in-scope.stderr | 14 + .../intra-doc/auxiliary/inner-crate-enum.rs | 3 - .../deny-intra-link-resolution-failure.rs | 4 + .../deny-intra-link-resolution-failure.stderr | 15 + tests/rustdoc-ui/intra-doc/inline-external-enum.rs | 8 - .../intra-doc/issue-110495-suffix-with-space.rs | 6 + .../issue-110495-suffix-with-space.stderr | 55 ++ .../intra-doc/issue-111189-resolution-ice.rs | 10 + .../intra-doc/issue-111189-resolution-ice.stderr | 21 + tests/rustdoc-ui/intra-doc/pub-export-lint.rs | 5 + tests/rustdoc-ui/intra-doc/pub-export-lint.stderr | 15 + .../intra-doc/reference-link-reports-error-once.rs | 20 + .../reference-link-reports-error-once.stderr | 63 ++ tests/rustdoc-ui/intra-doc/reference-links.rs | 6 + tests/rustdoc-ui/intra-doc/reference-links.stderr | 14 + tests/rustdoc-ui/intra-doc/weird-syntax.rs | 140 +++ tests/rustdoc-ui/intra-doc/weird-syntax.stderr | 272 ++++++ tests/rustdoc-ui/invalid-doc-attr.rs | 32 - tests/rustdoc-ui/invalid-doc-attr.stderr | 78 -- tests/rustdoc-ui/invalid-html-self-closing-tag.rs | 70 -- .../invalid-html-self-closing-tag.stderr | 80 -- tests/rustdoc-ui/invalid-html-tags.rs | 123 --- tests/rustdoc-ui/invalid-html-tags.stderr | 104 --- tests/rustdoc-ui/issue-101076.rs | 14 - tests/rustdoc-ui/issue-102986.rs | 4 - tests/rustdoc-ui/issue-102986.stderr | 14 - tests/rustdoc-ui/issue-103997.rs | 6 - tests/rustdoc-ui/issue-103997.stderr | 10 - tests/rustdoc-ui/issue-105334.rs | 2 - tests/rustdoc-ui/issue-105334.stderr | 9 - tests/rustdoc-ui/issue-105737.rs | 4 - tests/rustdoc-ui/issue-105737.stderr | 12 - tests/rustdoc-ui/issue-105742.rs | 50 -- tests/rustdoc-ui/issue-105742.stderr | 354 -------- tests/rustdoc-ui/issue-106213.rs | 7 - tests/rustdoc-ui/issue-106213.stderr | 9 - tests/rustdoc-ui/issue-106226.rs | 3 - tests/rustdoc-ui/issue-106226.stderr | 9 - tests/rustdoc-ui/issue-107918.rs | 12 - .../rustdoc-ui/issue-109282-import-inline-merge.rs | 14 - .../issue-110629-private-type-cycle-dyn.rs | 12 + .../issue-110629-private-type-cycle-dyn.stderr | 25 + .../rustdoc-ui/issue-110629-private-type-cycle.rs | 15 + tests/rustdoc-ui/issue-58473-2.rs | 12 - tests/rustdoc-ui/issue-58473.rs | 10 - tests/rustdoc-ui/issue-61592-2.rs | 10 - tests/rustdoc-ui/issue-61592-2.stderr | 12 - tests/rustdoc-ui/issue-61592.rs | 8 - tests/rustdoc-ui/issue-61592.stderr | 11 - tests/rustdoc-ui/issue-61732.rs | 4 - tests/rustdoc-ui/issue-61732.stderr | 11 - tests/rustdoc-ui/issue-74134.private.stderr | 11 - tests/rustdoc-ui/issue-74134.public.stderr | 11 - tests/rustdoc-ui/issue-74134.rs | 41 - tests/rustdoc-ui/issue-79465.rs | 2 - tests/rustdoc-ui/issue-79465.stderr | 9 - tests/rustdoc-ui/issue-79467.rs | 8 - tests/rustdoc-ui/issue-79467.stderr | 9 - tests/rustdoc-ui/issue-79494.rs | 5 - tests/rustdoc-ui/issue-79494.stderr | 12 - tests/rustdoc-ui/issue-80992.rs | 11 - tests/rustdoc-ui/issue-80992.stdout | 6 - tests/rustdoc-ui/issue-81662-shortness.rs | 12 - tests/rustdoc-ui/issue-81662-shortness.stdout | 16 - tests/rustdoc-ui/issue-83883-describe-lints.rs | 10 - tests/rustdoc-ui/issue-83883-describe-lints.stdout | 24 - tests/rustdoc-ui/issue-91134.rs | 14 - tests/rustdoc-ui/issue-91134.stdout | 6 - tests/rustdoc-ui/issue-91713.rs | 3 - tests/rustdoc-ui/issue-91713.stderr | 5 - tests/rustdoc-ui/issue-91713.stdout | 25 - tests/rustdoc-ui/issue-96287.rs | 16 - tests/rustdoc-ui/issue-96287.stderr | 9 - tests/rustdoc-ui/issue-98690.rs | 10 - tests/rustdoc-ui/issue-98690.stderr | 1 - tests/rustdoc-ui/issues/auxiliary/empty-fn.rs | 3 + tests/rustdoc-ui/issues/auxiliary/issue-61592.rs | 3 + tests/rustdoc-ui/issues/auxiliary/panic-handler.rs | 9 + tests/rustdoc-ui/issues/issue-101076.rs | 14 + tests/rustdoc-ui/issues/issue-102986.rs | 4 + tests/rustdoc-ui/issues/issue-102986.stderr | 14 + tests/rustdoc-ui/issues/issue-103997.rs | 6 + tests/rustdoc-ui/issues/issue-103997.stderr | 10 + tests/rustdoc-ui/issues/issue-105334.rs | 2 + tests/rustdoc-ui/issues/issue-105334.stderr | 9 + tests/rustdoc-ui/issues/issue-105737.rs | 4 + tests/rustdoc-ui/issues/issue-105737.stderr | 12 + tests/rustdoc-ui/issues/issue-105742.rs | 58 ++ tests/rustdoc-ui/issues/issue-105742.stderr | 482 ++++++++++ tests/rustdoc-ui/issues/issue-106213.rs | 7 + tests/rustdoc-ui/issues/issue-106213.stderr | 9 + tests/rustdoc-ui/issues/issue-106226.rs | 3 + tests/rustdoc-ui/issues/issue-106226.stderr | 9 + tests/rustdoc-ui/issues/issue-107918.rs | 12 + .../issues/issue-109282-import-inline-merge.rs | 14 + tests/rustdoc-ui/issues/issue-110900.rs | 28 + tests/rustdoc-ui/issues/issue-58473-2.rs | 12 + tests/rustdoc-ui/issues/issue-58473.rs | 10 + tests/rustdoc-ui/issues/issue-61592-2.rs | 10 + tests/rustdoc-ui/issues/issue-61592-2.stderr | 12 + tests/rustdoc-ui/issues/issue-61592.rs | 8 + tests/rustdoc-ui/issues/issue-61592.stderr | 11 + tests/rustdoc-ui/issues/issue-61732.rs | 4 + tests/rustdoc-ui/issues/issue-61732.stderr | 11 + tests/rustdoc-ui/issues/issue-74134.private.stderr | 11 + tests/rustdoc-ui/issues/issue-74134.public.stderr | 11 + tests/rustdoc-ui/issues/issue-74134.rs | 41 + tests/rustdoc-ui/issues/issue-79465.rs | 2 + tests/rustdoc-ui/issues/issue-79465.stderr | 9 + tests/rustdoc-ui/issues/issue-79467.rs | 8 + tests/rustdoc-ui/issues/issue-79467.stderr | 9 + tests/rustdoc-ui/issues/issue-79494.rs | 5 + tests/rustdoc-ui/issues/issue-79494.stderr | 12 + tests/rustdoc-ui/issues/issue-80992.rs | 11 + tests/rustdoc-ui/issues/issue-80992.stdout | 6 + tests/rustdoc-ui/issues/issue-81662-shortness.rs | 12 + .../rustdoc-ui/issues/issue-81662-shortness.stdout | 16 + .../issues/issue-83883-describe-lints.rs | 10 + .../issues/issue-83883-describe-lints.stdout | 24 + tests/rustdoc-ui/issues/issue-91134.rs | 14 + tests/rustdoc-ui/issues/issue-91134.stdout | 6 + tests/rustdoc-ui/issues/issue-91713.rs | 3 + tests/rustdoc-ui/issues/issue-91713.stderr | 5 + tests/rustdoc-ui/issues/issue-91713.stdout | 25 + tests/rustdoc-ui/issues/issue-96287.rs | 16 + tests/rustdoc-ui/issues/issue-96287.stderr | 9 + tests/rustdoc-ui/issues/issue-98690.rs | 10 + tests/rustdoc-ui/issues/issue-98690.stderr | 1 + tests/rustdoc-ui/lint-group.rs | 32 - tests/rustdoc-ui/lint-group.stderr | 54 -- tests/rustdoc-ui/lint-missing-doc-code-example.rs | 101 --- .../lint-missing-doc-code-example.stderr | 38 - tests/rustdoc-ui/lints/bare-urls.fixed | 60 ++ tests/rustdoc-ui/lints/bare-urls.rs | 60 ++ tests/rustdoc-ui/lints/bare-urls.stderr | 143 +++ tests/rustdoc-ui/lints/check-attr.rs | 41 + tests/rustdoc-ui/lints/check-attr.stderr | 175 ++++ tests/rustdoc-ui/lints/check-fail.rs | 23 + tests/rustdoc-ui/lints/check-fail.stderr | 56 ++ tests/rustdoc-ui/lints/check.rs | 15 + tests/rustdoc-ui/lints/check.stderr | 61 ++ tests/rustdoc-ui/lints/deny-missing-docs-crate.rs | 3 + .../lints/deny-missing-docs-crate.stderr | 22 + tests/rustdoc-ui/lints/deny-missing-docs-macro.rs | 8 + .../lints/deny-missing-docs-macro.stderr | 14 + tests/rustdoc-ui/lints/doc-attr.rs | 25 + tests/rustdoc-ui/lints/doc-attr.stderr | 71 ++ tests/rustdoc-ui/lints/doc-spotlight.fixed | 8 + tests/rustdoc-ui/lints/doc-spotlight.rs | 8 + tests/rustdoc-ui/lints/doc-spotlight.stderr | 19 + tests/rustdoc-ui/lints/doc-without-codeblock.rs | 23 + .../rustdoc-ui/lints/doc-without-codeblock.stderr | 38 + tests/rustdoc-ui/lints/doc_cfg_hide.rs | 11 + tests/rustdoc-ui/lints/doc_cfg_hide.stderr | 40 + .../rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs | 157 ++++ .../lints/expect-tool-lint-rfc-2383.stderr | 28 + ...ature-gate-rustdoc_missing_doc_code_examples.rs | 12 + ...e-gate-rustdoc_missing_doc_code_examples.stderr | 37 + tests/rustdoc-ui/lints/invalid-doc-attr.rs | 32 + tests/rustdoc-ui/lints/invalid-doc-attr.stderr | 78 ++ .../lints/invalid-html-self-closing-tag.rs | 70 ++ .../lints/invalid-html-self-closing-tag.stderr | 80 ++ tests/rustdoc-ui/lints/invalid-html-tags.rs | 123 +++ tests/rustdoc-ui/lints/invalid-html-tags.stderr | 104 +++ tests/rustdoc-ui/lints/lint-group.rs | 32 + tests/rustdoc-ui/lints/lint-group.stderr | 54 ++ .../lints/lint-missing-doc-code-example.rs | 101 +++ .../lints/lint-missing-doc-code-example.stderr | 38 + tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs | 6 + .../lints/no-crate-level-doc-lint.stderr | 12 + .../rustdoc-ui/lints/renamed-lint-still-applies.rs | 10 + .../lints/renamed-lint-still-applies.stderr | 42 + .../lints/rustdoc-all-only-stable-lints.rs | 6 + tests/rustdoc-ui/lints/unknown-renamed-lints.rs | 24 + .../rustdoc-ui/lints/unknown-renamed-lints.stderr | 62 ++ tests/rustdoc-ui/lints/unused-braces-lint.rs | 14 + tests/rustdoc-ui/lints/unused.rs | 14 + tests/rustdoc-ui/no-crate-level-doc-lint.rs | 6 - tests/rustdoc-ui/no-crate-level-doc-lint.stderr | 12 - tests/rustdoc-ui/no-run-flag-error.rs | 6 - tests/rustdoc-ui/no-run-flag-error.stderr | 2 - tests/rustdoc-ui/no-run-flag.rs | 38 - tests/rustdoc-ui/no-run-flag.stdout | 12 - tests/rustdoc-ui/nocapture-fail.rs | 12 - tests/rustdoc-ui/nocapture-fail.stderr | 18 - tests/rustdoc-ui/nocapture-fail.stdout | 6 - tests/rustdoc-ui/nocapture.rs | 10 - tests/rustdoc-ui/nocapture.stderr | 1 - tests/rustdoc-ui/nocapture.stdout | 7 - tests/rustdoc-ui/private-doc-test.rs | 12 - tests/rustdoc-ui/private-item-doc-test.rs | 11 - tests/rustdoc-ui/private-item-doc-test.stderr | 18 - tests/rustdoc-ui/private-public-item-doc-test.rs | 11 - .../rustdoc-ui/private-public-item-doc-test.stderr | 18 - tests/rustdoc-ui/pub-export-lint.rs | 5 - tests/rustdoc-ui/pub-export-lint.stderr | 15 - .../rustdoc-ui/public-reexported-item-doc-test.rs | 16 - .../reference-link-reports-error-once.rs | 20 - .../reference-link-reports-error-once.stderr | 63 -- tests/rustdoc-ui/reference-links.rs | 6 - tests/rustdoc-ui/reference-links.stderr | 14 - tests/rustdoc-ui/renamed-lint-still-applies.rs | 10 - tests/rustdoc-ui/renamed-lint-still-applies.stderr | 42 - tests/rustdoc-ui/run-directory.correct.stdout | 6 - tests/rustdoc-ui/run-directory.incorrect.stdout | 6 - tests/rustdoc-ui/run-directory.rs | 23 - tests/rustdoc-ui/rustdoc-all-only-stable-lints.rs | 6 - .../scrape-examples-fail-if-type-error.rs | 7 - .../scrape-examples-fail-if-type-error.stderr | 14 - tests/rustdoc-ui/scrape-examples-ice.rs | 4 - .../rustdoc-ui/scrape-examples-wrong-options-1.rs | 1 - .../scrape-examples-wrong-options-1.stderr | 2 - .../rustdoc-ui/scrape-examples-wrong-options-2.rs | 1 - .../scrape-examples-wrong-options-2.stderr | 2 - .../scrape-examples-fail-if-type-error.rs | 7 + .../scrape-examples-fail-if-type-error.stderr | 14 + .../scrape-examples/scrape-examples-ice.rs | 4 + .../scrape-examples-wrong-options-1.rs | 1 + .../scrape-examples-wrong-options-1.stderr | 2 + .../scrape-examples-wrong-options-2.rs | 1 + .../scrape-examples-wrong-options-2.stderr | 2 + tests/rustdoc-ui/test-compile-fail1.rs | 8 - tests/rustdoc-ui/test-compile-fail1.stderr | 14 - tests/rustdoc-ui/test-compile-fail2.rs | 3 - tests/rustdoc-ui/test-compile-fail2.stderr | 8 - tests/rustdoc-ui/test-compile-fail3.rs | 3 - tests/rustdoc-ui/test-compile-fail3.stderr | 9 - tests/rustdoc-ui/test-no_std.rs | 13 - tests/rustdoc-ui/test-no_std.stdout | 6 - tests/rustdoc-ui/test-type.rs | 26 - tests/rustdoc-ui/test-type.stdout | 10 - tests/rustdoc-ui/unescaped_backticks.rs | 354 ++++++++ tests/rustdoc-ui/unescaped_backticks.stderr | 971 +++++++++++++++++++++ tests/rustdoc-ui/unknown-renamed-lints.rs | 24 - tests/rustdoc-ui/unknown-renamed-lints.stderr | 62 -- tests/rustdoc-ui/unparseable-doc-test.rs | 11 - tests/rustdoc-ui/unparseable-doc-test.stdout | 23 - tests/rustdoc-ui/unused-braces-lint.rs | 14 - tests/rustdoc-ui/unused.rs | 14 - 417 files changed, 6540 insertions(+), 4468 deletions(-) delete mode 100644 tests/rustdoc-ui/assoc-item-not-in-scope.rs delete mode 100644 tests/rustdoc-ui/assoc-item-not-in-scope.stderr delete mode 100644 tests/rustdoc-ui/auxiliary/empty-fn.rs delete mode 100644 tests/rustdoc-ui/auxiliary/extern_macros.rs delete mode 100644 tests/rustdoc-ui/auxiliary/issue-61592.rs delete mode 100644 tests/rustdoc-ui/auxiliary/panic-handler.rs delete mode 100644 tests/rustdoc-ui/bare-urls.fixed delete mode 100644 tests/rustdoc-ui/bare-urls.rs delete mode 100644 tests/rustdoc-ui/bare-urls.stderr delete mode 100644 tests/rustdoc-ui/block-doc-comment.rs delete mode 100644 tests/rustdoc-ui/block-doc-comment.stdout delete mode 100644 tests/rustdoc-ui/cfg-test.rs delete mode 100644 tests/rustdoc-ui/cfg-test.stdout delete mode 100644 tests/rustdoc-ui/check-attr-test.rs delete mode 100644 tests/rustdoc-ui/check-attr-test.stderr delete mode 100644 tests/rustdoc-ui/check-attr.rs delete mode 100644 tests/rustdoc-ui/check-attr.stderr delete mode 100644 tests/rustdoc-ui/check-cfg-test.rs delete mode 100644 tests/rustdoc-ui/check-cfg-test.stderr delete mode 100644 tests/rustdoc-ui/check-cfg-test.stdout delete mode 100644 tests/rustdoc-ui/check-cfg-unstable.rs delete mode 100644 tests/rustdoc-ui/check-cfg-unstable.stderr delete mode 100644 tests/rustdoc-ui/check-cfg.rs delete mode 100644 tests/rustdoc-ui/check-cfg.stderr create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg-test.stderr create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg.rs create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg.stderr delete mode 100644 tests/rustdoc-ui/check-fail.rs delete mode 100644 tests/rustdoc-ui/check-fail.stderr delete mode 100644 tests/rustdoc-ui/check.rs delete mode 100644 tests/rustdoc-ui/check.stderr delete mode 100644 tests/rustdoc-ui/deny-intra-link-resolution-failure.rs delete mode 100644 tests/rustdoc-ui/deny-intra-link-resolution-failure.stderr delete mode 100644 tests/rustdoc-ui/deny-missing-docs-crate.rs delete mode 100644 tests/rustdoc-ui/deny-missing-docs-crate.stderr delete mode 100644 tests/rustdoc-ui/deny-missing-docs-macro.rs delete mode 100644 tests/rustdoc-ui/deny-missing-docs-macro.stderr delete mode 100644 tests/rustdoc-ui/display-output.rs delete mode 100644 tests/rustdoc-ui/display-output.stdout delete mode 100644 tests/rustdoc-ui/doc-attr.rs delete mode 100644 tests/rustdoc-ui/doc-attr.stderr delete mode 100644 tests/rustdoc-ui/doc-comment-multi-line-attr.rs delete mode 100644 tests/rustdoc-ui/doc-comment-multi-line-attr.stdout delete mode 100644 tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs delete mode 100644 tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.stdout delete mode 100644 tests/rustdoc-ui/doc-spotlight.fixed delete mode 100644 tests/rustdoc-ui/doc-spotlight.rs delete mode 100644 tests/rustdoc-ui/doc-spotlight.stderr delete mode 100644 tests/rustdoc-ui/doc-test-attr-pass.rs delete mode 100644 tests/rustdoc-ui/doc-test-attr.rs delete mode 100644 tests/rustdoc-ui/doc-test-attr.stderr delete mode 100644 tests/rustdoc-ui/doc-test-doctest-feature.rs delete mode 100644 tests/rustdoc-ui/doc-test-doctest-feature.stdout delete mode 100644 tests/rustdoc-ui/doc-test-rustdoc-feature.rs delete mode 100644 tests/rustdoc-ui/doc-test-rustdoc-feature.stdout delete mode 100644 tests/rustdoc-ui/doc-without-codeblock.rs delete mode 100644 tests/rustdoc-ui/doc-without-codeblock.stderr delete mode 100644 tests/rustdoc-ui/doc_cfg_hide.rs delete mode 100644 tests/rustdoc-ui/doc_cfg_hide.stderr delete mode 100644 tests/rustdoc-ui/doctest-edition.rs delete mode 100644 tests/rustdoc-ui/doctest-edition.stderr delete mode 100644 tests/rustdoc-ui/doctest-multiline-crate-attribute.rs delete mode 100644 tests/rustdoc-ui/doctest-multiline-crate-attribute.stdout delete mode 100644 tests/rustdoc-ui/doctest-output.rs delete mode 100644 tests/rustdoc-ui/doctest-output.stdout create mode 100644 tests/rustdoc-ui/doctest/auxiliary/extern_macros.rs create mode 100644 tests/rustdoc-ui/doctest/block-doc-comment.rs create mode 100644 tests/rustdoc-ui/doctest/block-doc-comment.stdout create mode 100644 tests/rustdoc-ui/doctest/cfg-test.rs create mode 100644 tests/rustdoc-ui/doctest/cfg-test.stdout create mode 100644 tests/rustdoc-ui/doctest/check-attr-test.rs create mode 100644 tests/rustdoc-ui/doctest/check-attr-test.stderr create mode 100644 tests/rustdoc-ui/doctest/check-cfg-test.rs create mode 100644 tests/rustdoc-ui/doctest/check-cfg-test.stderr create mode 100644 tests/rustdoc-ui/doctest/check-cfg-test.stdout create mode 100644 tests/rustdoc-ui/doctest/display-output.rs create mode 100644 tests/rustdoc-ui/doctest/display-output.stdout create mode 100644 tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs create mode 100644 tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.stdout create mode 100644 tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs create mode 100644 tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.stdout create mode 100644 tests/rustdoc-ui/doctest/doc-test-attr-pass.rs create mode 100644 tests/rustdoc-ui/doctest/doc-test-attr.rs create mode 100644 tests/rustdoc-ui/doctest/doc-test-attr.stderr create mode 100644 tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs create mode 100644 tests/rustdoc-ui/doctest/doc-test-doctest-feature.stdout create mode 100644 tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs create mode 100644 tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.stdout create mode 100644 tests/rustdoc-ui/doctest/doctest-edition.rs create mode 100644 tests/rustdoc-ui/doctest/doctest-edition.stderr create mode 100644 tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs create mode 100644 tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.stdout create mode 100644 tests/rustdoc-ui/doctest/doctest-output.rs create mode 100644 tests/rustdoc-ui/doctest/doctest-output.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-compile-fail.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-missing-codes.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-output.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-output.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout create mode 100644 tests/rustdoc-ui/doctest/no-run-flag-error.rs create mode 100644 tests/rustdoc-ui/doctest/no-run-flag-error.stderr create mode 100644 tests/rustdoc-ui/doctest/no-run-flag.rs create mode 100644 tests/rustdoc-ui/doctest/no-run-flag.stdout create mode 100644 tests/rustdoc-ui/doctest/nocapture-fail.rs create mode 100644 tests/rustdoc-ui/doctest/nocapture-fail.stderr create mode 100644 tests/rustdoc-ui/doctest/nocapture-fail.stdout create mode 100644 tests/rustdoc-ui/doctest/nocapture.rs create mode 100644 tests/rustdoc-ui/doctest/nocapture.stderr create mode 100644 tests/rustdoc-ui/doctest/nocapture.stdout create mode 100644 tests/rustdoc-ui/doctest/private-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/private-item-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/private-item-doc-test.stderr create mode 100644 tests/rustdoc-ui/doctest/private-public-item-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr create mode 100644 tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/run-directory.correct.stdout create mode 100644 tests/rustdoc-ui/doctest/run-directory.incorrect.stdout create mode 100644 tests/rustdoc-ui/doctest/run-directory.rs create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail1.rs create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail1.stderr create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail2.rs create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail2.stderr create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail3.rs create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail3.stderr create mode 100644 tests/rustdoc-ui/doctest/test-no_std.rs create mode 100644 tests/rustdoc-ui/doctest/test-no_std.stdout create mode 100644 tests/rustdoc-ui/doctest/test-type.rs create mode 100644 tests/rustdoc-ui/doctest/test-type.stdout create mode 100644 tests/rustdoc-ui/doctest/unparseable-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/unparseable-doc-test.stdout create mode 100644 tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs create mode 100644 tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs create mode 100644 tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.stderr create mode 100644 tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs delete mode 100644 tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs delete mode 100644 tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr delete mode 100644 tests/rustdoc-ui/failed-doctest-compile-fail.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-compile-fail.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-missing-codes.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-missing-codes.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-output-windows.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-output-windows.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-output.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-output.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-should-panic.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-should-panic.stdout delete mode 100644 tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.rs delete mode 100644 tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.stderr delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt-unstable.rs delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt-unstable.stderr delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt.rs delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt.stderr delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt2.rs delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt2.stderr create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.stderr create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr create mode 100644 tests/rustdoc-ui/ice-bug-report-url.rs create mode 100644 tests/rustdoc-ui/ice-bug-report-url.stderr delete mode 100644 tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.rs delete mode 100644 tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.stderr delete mode 100644 tests/rustdoc-ui/infinite-recursive-type-impl-trait.rs delete mode 100644 tests/rustdoc-ui/infinite-recursive-type-impl-trait.stderr create mode 100644 tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.rs create mode 100644 tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.stderr delete mode 100644 tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs create mode 100644 tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.rs create mode 100644 tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.stderr delete mode 100644 tests/rustdoc-ui/intra-doc/inline-external-enum.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.stderr create mode 100644 tests/rustdoc-ui/intra-doc/pub-export-lint.rs create mode 100644 tests/rustdoc-ui/intra-doc/pub-export-lint.stderr create mode 100644 tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.rs create mode 100644 tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.stderr create mode 100644 tests/rustdoc-ui/intra-doc/reference-links.rs create mode 100644 tests/rustdoc-ui/intra-doc/reference-links.stderr create mode 100644 tests/rustdoc-ui/intra-doc/weird-syntax.rs create mode 100644 tests/rustdoc-ui/intra-doc/weird-syntax.stderr delete mode 100644 tests/rustdoc-ui/invalid-doc-attr.rs delete mode 100644 tests/rustdoc-ui/invalid-doc-attr.stderr delete mode 100644 tests/rustdoc-ui/invalid-html-self-closing-tag.rs delete mode 100644 tests/rustdoc-ui/invalid-html-self-closing-tag.stderr delete mode 100644 tests/rustdoc-ui/invalid-html-tags.rs delete mode 100644 tests/rustdoc-ui/invalid-html-tags.stderr delete mode 100644 tests/rustdoc-ui/issue-101076.rs delete mode 100644 tests/rustdoc-ui/issue-102986.rs delete mode 100644 tests/rustdoc-ui/issue-102986.stderr delete mode 100644 tests/rustdoc-ui/issue-103997.rs delete mode 100644 tests/rustdoc-ui/issue-103997.stderr delete mode 100644 tests/rustdoc-ui/issue-105334.rs delete mode 100644 tests/rustdoc-ui/issue-105334.stderr delete mode 100644 tests/rustdoc-ui/issue-105737.rs delete mode 100644 tests/rustdoc-ui/issue-105737.stderr delete mode 100644 tests/rustdoc-ui/issue-105742.rs delete mode 100644 tests/rustdoc-ui/issue-105742.stderr delete mode 100644 tests/rustdoc-ui/issue-106213.rs delete mode 100644 tests/rustdoc-ui/issue-106213.stderr delete mode 100644 tests/rustdoc-ui/issue-106226.rs delete mode 100644 tests/rustdoc-ui/issue-106226.stderr delete mode 100644 tests/rustdoc-ui/issue-107918.rs delete mode 100644 tests/rustdoc-ui/issue-109282-import-inline-merge.rs create mode 100644 tests/rustdoc-ui/issue-110629-private-type-cycle-dyn.rs create mode 100644 tests/rustdoc-ui/issue-110629-private-type-cycle-dyn.stderr create mode 100644 tests/rustdoc-ui/issue-110629-private-type-cycle.rs delete mode 100644 tests/rustdoc-ui/issue-58473-2.rs delete mode 100644 tests/rustdoc-ui/issue-58473.rs delete mode 100644 tests/rustdoc-ui/issue-61592-2.rs delete mode 100644 tests/rustdoc-ui/issue-61592-2.stderr delete mode 100644 tests/rustdoc-ui/issue-61592.rs delete mode 100644 tests/rustdoc-ui/issue-61592.stderr delete mode 100644 tests/rustdoc-ui/issue-61732.rs delete mode 100644 tests/rustdoc-ui/issue-61732.stderr delete mode 100644 tests/rustdoc-ui/issue-74134.private.stderr delete mode 100644 tests/rustdoc-ui/issue-74134.public.stderr delete mode 100644 tests/rustdoc-ui/issue-74134.rs delete mode 100644 tests/rustdoc-ui/issue-79465.rs delete mode 100644 tests/rustdoc-ui/issue-79465.stderr delete mode 100644 tests/rustdoc-ui/issue-79467.rs delete mode 100644 tests/rustdoc-ui/issue-79467.stderr delete mode 100644 tests/rustdoc-ui/issue-79494.rs delete mode 100644 tests/rustdoc-ui/issue-79494.stderr delete mode 100644 tests/rustdoc-ui/issue-80992.rs delete mode 100644 tests/rustdoc-ui/issue-80992.stdout delete mode 100644 tests/rustdoc-ui/issue-81662-shortness.rs delete mode 100644 tests/rustdoc-ui/issue-81662-shortness.stdout delete mode 100644 tests/rustdoc-ui/issue-83883-describe-lints.rs delete mode 100644 tests/rustdoc-ui/issue-83883-describe-lints.stdout delete mode 100644 tests/rustdoc-ui/issue-91134.rs delete mode 100644 tests/rustdoc-ui/issue-91134.stdout delete mode 100644 tests/rustdoc-ui/issue-91713.rs delete mode 100644 tests/rustdoc-ui/issue-91713.stderr delete mode 100644 tests/rustdoc-ui/issue-91713.stdout delete mode 100644 tests/rustdoc-ui/issue-96287.rs delete mode 100644 tests/rustdoc-ui/issue-96287.stderr delete mode 100644 tests/rustdoc-ui/issue-98690.rs delete mode 100644 tests/rustdoc-ui/issue-98690.stderr create mode 100644 tests/rustdoc-ui/issues/auxiliary/empty-fn.rs create mode 100644 tests/rustdoc-ui/issues/auxiliary/issue-61592.rs create mode 100644 tests/rustdoc-ui/issues/auxiliary/panic-handler.rs create mode 100644 tests/rustdoc-ui/issues/issue-101076.rs create mode 100644 tests/rustdoc-ui/issues/issue-102986.rs create mode 100644 tests/rustdoc-ui/issues/issue-102986.stderr create mode 100644 tests/rustdoc-ui/issues/issue-103997.rs create mode 100644 tests/rustdoc-ui/issues/issue-103997.stderr create mode 100644 tests/rustdoc-ui/issues/issue-105334.rs create mode 100644 tests/rustdoc-ui/issues/issue-105334.stderr create mode 100644 tests/rustdoc-ui/issues/issue-105737.rs create mode 100644 tests/rustdoc-ui/issues/issue-105737.stderr create mode 100644 tests/rustdoc-ui/issues/issue-105742.rs create mode 100644 tests/rustdoc-ui/issues/issue-105742.stderr create mode 100644 tests/rustdoc-ui/issues/issue-106213.rs create mode 100644 tests/rustdoc-ui/issues/issue-106213.stderr create mode 100644 tests/rustdoc-ui/issues/issue-106226.rs create mode 100644 tests/rustdoc-ui/issues/issue-106226.stderr create mode 100644 tests/rustdoc-ui/issues/issue-107918.rs create mode 100644 tests/rustdoc-ui/issues/issue-109282-import-inline-merge.rs create mode 100644 tests/rustdoc-ui/issues/issue-110900.rs create mode 100644 tests/rustdoc-ui/issues/issue-58473-2.rs create mode 100644 tests/rustdoc-ui/issues/issue-58473.rs create mode 100644 tests/rustdoc-ui/issues/issue-61592-2.rs create mode 100644 tests/rustdoc-ui/issues/issue-61592-2.stderr create mode 100644 tests/rustdoc-ui/issues/issue-61592.rs create mode 100644 tests/rustdoc-ui/issues/issue-61592.stderr create mode 100644 tests/rustdoc-ui/issues/issue-61732.rs create mode 100644 tests/rustdoc-ui/issues/issue-61732.stderr create mode 100644 tests/rustdoc-ui/issues/issue-74134.private.stderr create mode 100644 tests/rustdoc-ui/issues/issue-74134.public.stderr create mode 100644 tests/rustdoc-ui/issues/issue-74134.rs create mode 100644 tests/rustdoc-ui/issues/issue-79465.rs create mode 100644 tests/rustdoc-ui/issues/issue-79465.stderr create mode 100644 tests/rustdoc-ui/issues/issue-79467.rs create mode 100644 tests/rustdoc-ui/issues/issue-79467.stderr create mode 100644 tests/rustdoc-ui/issues/issue-79494.rs create mode 100644 tests/rustdoc-ui/issues/issue-79494.stderr create mode 100644 tests/rustdoc-ui/issues/issue-80992.rs create mode 100644 tests/rustdoc-ui/issues/issue-80992.stdout create mode 100644 tests/rustdoc-ui/issues/issue-81662-shortness.rs create mode 100644 tests/rustdoc-ui/issues/issue-81662-shortness.stdout create mode 100644 tests/rustdoc-ui/issues/issue-83883-describe-lints.rs create mode 100644 tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout create mode 100644 tests/rustdoc-ui/issues/issue-91134.rs create mode 100644 tests/rustdoc-ui/issues/issue-91134.stdout create mode 100644 tests/rustdoc-ui/issues/issue-91713.rs create mode 100644 tests/rustdoc-ui/issues/issue-91713.stderr create mode 100644 tests/rustdoc-ui/issues/issue-91713.stdout create mode 100644 tests/rustdoc-ui/issues/issue-96287.rs create mode 100644 tests/rustdoc-ui/issues/issue-96287.stderr create mode 100644 tests/rustdoc-ui/issues/issue-98690.rs create mode 100644 tests/rustdoc-ui/issues/issue-98690.stderr delete mode 100644 tests/rustdoc-ui/lint-group.rs delete mode 100644 tests/rustdoc-ui/lint-group.stderr delete mode 100644 tests/rustdoc-ui/lint-missing-doc-code-example.rs delete mode 100644 tests/rustdoc-ui/lint-missing-doc-code-example.stderr create mode 100644 tests/rustdoc-ui/lints/bare-urls.fixed create mode 100644 tests/rustdoc-ui/lints/bare-urls.rs create mode 100644 tests/rustdoc-ui/lints/bare-urls.stderr create mode 100644 tests/rustdoc-ui/lints/check-attr.rs create mode 100644 tests/rustdoc-ui/lints/check-attr.stderr create mode 100644 tests/rustdoc-ui/lints/check-fail.rs create mode 100644 tests/rustdoc-ui/lints/check-fail.stderr create mode 100644 tests/rustdoc-ui/lints/check.rs create mode 100644 tests/rustdoc-ui/lints/check.stderr create mode 100644 tests/rustdoc-ui/lints/deny-missing-docs-crate.rs create mode 100644 tests/rustdoc-ui/lints/deny-missing-docs-crate.stderr create mode 100644 tests/rustdoc-ui/lints/deny-missing-docs-macro.rs create mode 100644 tests/rustdoc-ui/lints/deny-missing-docs-macro.stderr create mode 100644 tests/rustdoc-ui/lints/doc-attr.rs create mode 100644 tests/rustdoc-ui/lints/doc-attr.stderr create mode 100644 tests/rustdoc-ui/lints/doc-spotlight.fixed create mode 100644 tests/rustdoc-ui/lints/doc-spotlight.rs create mode 100644 tests/rustdoc-ui/lints/doc-spotlight.stderr create mode 100644 tests/rustdoc-ui/lints/doc-without-codeblock.rs create mode 100644 tests/rustdoc-ui/lints/doc-without-codeblock.stderr create mode 100644 tests/rustdoc-ui/lints/doc_cfg_hide.rs create mode 100644 tests/rustdoc-ui/lints/doc_cfg_hide.stderr create mode 100644 tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs create mode 100644 tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.stderr create mode 100644 tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs create mode 100644 tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr create mode 100644 tests/rustdoc-ui/lints/invalid-doc-attr.rs create mode 100644 tests/rustdoc-ui/lints/invalid-doc-attr.stderr create mode 100644 tests/rustdoc-ui/lints/invalid-html-self-closing-tag.rs create mode 100644 tests/rustdoc-ui/lints/invalid-html-self-closing-tag.stderr create mode 100644 tests/rustdoc-ui/lints/invalid-html-tags.rs create mode 100644 tests/rustdoc-ui/lints/invalid-html-tags.stderr create mode 100644 tests/rustdoc-ui/lints/lint-group.rs create mode 100644 tests/rustdoc-ui/lints/lint-group.stderr create mode 100644 tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs create mode 100644 tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr create mode 100644 tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs create mode 100644 tests/rustdoc-ui/lints/no-crate-level-doc-lint.stderr create mode 100644 tests/rustdoc-ui/lints/renamed-lint-still-applies.rs create mode 100644 tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr create mode 100644 tests/rustdoc-ui/lints/rustdoc-all-only-stable-lints.rs create mode 100644 tests/rustdoc-ui/lints/unknown-renamed-lints.rs create mode 100644 tests/rustdoc-ui/lints/unknown-renamed-lints.stderr create mode 100644 tests/rustdoc-ui/lints/unused-braces-lint.rs create mode 100644 tests/rustdoc-ui/lints/unused.rs delete mode 100644 tests/rustdoc-ui/no-crate-level-doc-lint.rs delete mode 100644 tests/rustdoc-ui/no-crate-level-doc-lint.stderr delete mode 100644 tests/rustdoc-ui/no-run-flag-error.rs delete mode 100644 tests/rustdoc-ui/no-run-flag-error.stderr delete mode 100644 tests/rustdoc-ui/no-run-flag.rs delete mode 100644 tests/rustdoc-ui/no-run-flag.stdout delete mode 100644 tests/rustdoc-ui/nocapture-fail.rs delete mode 100644 tests/rustdoc-ui/nocapture-fail.stderr delete mode 100644 tests/rustdoc-ui/nocapture-fail.stdout delete mode 100644 tests/rustdoc-ui/nocapture.rs delete mode 100644 tests/rustdoc-ui/nocapture.stderr delete mode 100644 tests/rustdoc-ui/nocapture.stdout delete mode 100644 tests/rustdoc-ui/private-doc-test.rs delete mode 100644 tests/rustdoc-ui/private-item-doc-test.rs delete mode 100644 tests/rustdoc-ui/private-item-doc-test.stderr delete mode 100644 tests/rustdoc-ui/private-public-item-doc-test.rs delete mode 100644 tests/rustdoc-ui/private-public-item-doc-test.stderr delete mode 100644 tests/rustdoc-ui/pub-export-lint.rs delete mode 100644 tests/rustdoc-ui/pub-export-lint.stderr delete mode 100644 tests/rustdoc-ui/public-reexported-item-doc-test.rs delete mode 100644 tests/rustdoc-ui/reference-link-reports-error-once.rs delete mode 100644 tests/rustdoc-ui/reference-link-reports-error-once.stderr delete mode 100644 tests/rustdoc-ui/reference-links.rs delete mode 100644 tests/rustdoc-ui/reference-links.stderr delete mode 100644 tests/rustdoc-ui/renamed-lint-still-applies.rs delete mode 100644 tests/rustdoc-ui/renamed-lint-still-applies.stderr delete mode 100644 tests/rustdoc-ui/run-directory.correct.stdout delete mode 100644 tests/rustdoc-ui/run-directory.incorrect.stdout delete mode 100644 tests/rustdoc-ui/run-directory.rs delete mode 100644 tests/rustdoc-ui/rustdoc-all-only-stable-lints.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-fail-if-type-error.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-fail-if-type-error.stderr delete mode 100644 tests/rustdoc-ui/scrape-examples-ice.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-wrong-options-1.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-wrong-options-1.stderr delete mode 100644 tests/rustdoc-ui/scrape-examples-wrong-options-2.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-wrong-options-2.stderr create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.stderr create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.stderr create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.stderr delete mode 100644 tests/rustdoc-ui/test-compile-fail1.rs delete mode 100644 tests/rustdoc-ui/test-compile-fail1.stderr delete mode 100644 tests/rustdoc-ui/test-compile-fail2.rs delete mode 100644 tests/rustdoc-ui/test-compile-fail2.stderr delete mode 100644 tests/rustdoc-ui/test-compile-fail3.rs delete mode 100644 tests/rustdoc-ui/test-compile-fail3.stderr delete mode 100644 tests/rustdoc-ui/test-no_std.rs delete mode 100644 tests/rustdoc-ui/test-no_std.stdout delete mode 100644 tests/rustdoc-ui/test-type.rs delete mode 100644 tests/rustdoc-ui/test-type.stdout create mode 100644 tests/rustdoc-ui/unescaped_backticks.rs create mode 100644 tests/rustdoc-ui/unescaped_backticks.stderr delete mode 100644 tests/rustdoc-ui/unknown-renamed-lints.rs delete mode 100644 tests/rustdoc-ui/unknown-renamed-lints.stderr delete mode 100644 tests/rustdoc-ui/unparseable-doc-test.rs delete mode 100644 tests/rustdoc-ui/unparseable-doc-test.stdout delete mode 100644 tests/rustdoc-ui/unused-braces-lint.rs delete mode 100644 tests/rustdoc-ui/unused.rs (limited to 'tests/rustdoc-ui') diff --git a/tests/rustdoc-ui/assoc-item-not-in-scope.rs b/tests/rustdoc-ui/assoc-item-not-in-scope.rs deleted file mode 100644 index 0976515f4..000000000 --- a/tests/rustdoc-ui/assoc-item-not-in-scope.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![deny(rustdoc::broken_intra_doc_links)] - -#[derive(Debug)] -/// Link to [`S::fmt`] -//~^ ERROR unresolved link -pub struct S; - -pub mod inner { - use std::fmt::Debug; - use super::S; - - /// Link to [`S::fmt`] - pub fn f() {} -} - -pub mod ambiguous { - use std::fmt::{Display, Debug}; - use super::S; - - /// Link to [`S::fmt`] - pub fn f() {} -} diff --git a/tests/rustdoc-ui/assoc-item-not-in-scope.stderr b/tests/rustdoc-ui/assoc-item-not-in-scope.stderr deleted file mode 100644 index 04594ad41..000000000 --- a/tests/rustdoc-ui/assoc-item-not-in-scope.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: unresolved link to `S::fmt` - --> $DIR/assoc-item-not-in-scope.rs:4:15 - | -LL | /// Link to [`S::fmt`] - | ^^^^^^ the struct `S` has no field or associated item named `fmt` - | -note: the lint level is defined here - --> $DIR/assoc-item-not-in-scope.rs:1:9 - | -LL | #![deny(rustdoc::broken_intra_doc_links)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/rustdoc-ui/auxiliary/empty-fn.rs b/tests/rustdoc-ui/auxiliary/empty-fn.rs deleted file mode 100644 index 877810f15..000000000 --- a/tests/rustdoc-ui/auxiliary/empty-fn.rs +++ /dev/null @@ -1,3 +0,0 @@ -// no-prefer-dynamic -#![crate_type = "lib"] -pub fn empty() {} diff --git a/tests/rustdoc-ui/auxiliary/extern_macros.rs b/tests/rustdoc-ui/auxiliary/extern_macros.rs deleted file mode 100644 index ee1fec4c5..000000000 --- a/tests/rustdoc-ui/auxiliary/extern_macros.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[macro_export] -macro_rules! attrs_on_struct { - ( $( #[$attr:meta] )* ) => { - $( #[$attr] )* - pub struct ExpandedStruct; - } -} diff --git a/tests/rustdoc-ui/auxiliary/issue-61592.rs b/tests/rustdoc-ui/auxiliary/issue-61592.rs deleted file mode 100644 index 57a365b3f..000000000 --- a/tests/rustdoc-ui/auxiliary/issue-61592.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "foo"] - -pub trait Foo {} diff --git a/tests/rustdoc-ui/auxiliary/panic-handler.rs b/tests/rustdoc-ui/auxiliary/panic-handler.rs deleted file mode 100644 index 0aaaeee10..000000000 --- a/tests/rustdoc-ui/auxiliary/panic-handler.rs +++ /dev/null @@ -1,9 +0,0 @@ -// compile-flags: -C panic=abort - -#![no_std] -#![no_main] - -#[panic_handler] -fn panic(_: &core::panic::PanicInfo) -> ! { - loop {} -} diff --git a/tests/rustdoc-ui/bare-urls.fixed b/tests/rustdoc-ui/bare-urls.fixed deleted file mode 100644 index 23aa5c44c..000000000 --- a/tests/rustdoc-ui/bare-urls.fixed +++ /dev/null @@ -1,60 +0,0 @@ -// run-rustfix - -#![deny(rustdoc::bare_urls)] - -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// -//~^ ERROR this URL is not a hyperlink -/// hey! -//~^ ERROR this URL is not a hyperlink -pub fn c() {} - -/// -/// [a](http://a.com) -/// [b] -/// -/// [b]: http://b.com -/// -/// ``` -/// This link should not be linted: http://example.com -/// -/// Nor this one: or this one: [x](http://example.com) -/// ``` -/// -/// [should_not.lint](should_not.lint) -pub fn everything_is_fine_here() {} - -#[allow(rustdoc::bare_urls)] -pub mod foo { - /// https://somewhere.com/a?hello=12&bye=11#xyz - pub fn bar() {} -} diff --git a/tests/rustdoc-ui/bare-urls.rs b/tests/rustdoc-ui/bare-urls.rs deleted file mode 100644 index 592f57343..000000000 --- a/tests/rustdoc-ui/bare-urls.rs +++ /dev/null @@ -1,60 +0,0 @@ -// run-rustfix - -#![deny(rustdoc::bare_urls)] - -/// https://somewhere.com -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com/a -//~^ ERROR this URL is not a hyperlink -/// https://www.somewhere.com -//~^ ERROR this URL is not a hyperlink -/// https://www.somewhere.com/a -//~^ ERROR this URL is not a hyperlink -/// https://subdomain.example.com -//~^ ERROR not a hyperlink -/// https://somewhere.com? -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com/a? -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com?hello=12 -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com/a?hello=12 -//~^ ERROR this URL is not a hyperlink -/// https://example.com?hello=12#xyz -//~^ ERROR this URL is not a hyperlink -/// https://example.com/a?hello=12#xyz -//~^ ERROR this URL is not a hyperlink -/// https://example.com#xyz -//~^ ERROR this URL is not a hyperlink -/// https://example.com/a#xyz -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com?hello=12&bye=11 -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com/a?hello=12&bye=11 -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com?hello=12&bye=11#xyz -//~^ ERROR this URL is not a hyperlink -/// hey! https://somewhere.com/a?hello=12&bye=11#xyz -//~^ ERROR this URL is not a hyperlink -pub fn c() {} - -/// -/// [a](http://a.com) -/// [b] -/// -/// [b]: http://b.com -/// -/// ``` -/// This link should not be linted: http://example.com -/// -/// Nor this one: or this one: [x](http://example.com) -/// ``` -/// -/// [should_not.lint](should_not.lint) -pub fn everything_is_fine_here() {} - -#[allow(rustdoc::bare_urls)] -pub mod foo { - /// https://somewhere.com/a?hello=12&bye=11#xyz - pub fn bar() {} -} diff --git a/tests/rustdoc-ui/bare-urls.stderr b/tests/rustdoc-ui/bare-urls.stderr deleted file mode 100644 index ccf52cd0b..000000000 --- a/tests/rustdoc-ui/bare-urls.stderr +++ /dev/null @@ -1,143 +0,0 @@ -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:5:5 - | -LL | /// https://somewhere.com - | ^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links -note: the lint level is defined here - --> $DIR/bare-urls.rs:3:9 - | -LL | #![deny(rustdoc::bare_urls)] - | ^^^^^^^^^^^^^^^^^^ - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:7:5 - | -LL | /// https://somewhere.com/a - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:9:5 - | -LL | /// https://www.somewhere.com - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:11:5 - | -LL | /// https://www.somewhere.com/a - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:13:5 - | -LL | /// https://subdomain.example.com - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:15:5 - | -LL | /// https://somewhere.com? - | ^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:17:5 - | -LL | /// https://somewhere.com/a? - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:19:5 - | -LL | /// https://somewhere.com?hello=12 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:21:5 - | -LL | /// https://somewhere.com/a?hello=12 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:23:5 - | -LL | /// https://example.com?hello=12#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:25:5 - | -LL | /// https://example.com/a?hello=12#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:27:5 - | -LL | /// https://example.com#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:29:5 - | -LL | /// https://example.com/a#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:31:5 - | -LL | /// https://somewhere.com?hello=12&bye=11 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:33:5 - | -LL | /// https://somewhere.com/a?hello=12&bye=11 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:35:5 - | -LL | /// https://somewhere.com?hello=12&bye=11#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:37:10 - | -LL | /// hey! https://somewhere.com/a?hello=12&bye=11#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | - = note: bare URLs are not automatically turned into clickable links - -error: aborting due to 17 previous errors - diff --git a/tests/rustdoc-ui/block-doc-comment.rs b/tests/rustdoc-ui/block-doc-comment.rs deleted file mode 100644 index ce529916e..000000000 --- a/tests/rustdoc-ui/block-doc-comment.rs +++ /dev/null @@ -1,17 +0,0 @@ -// check-pass -// compile-flags:--test -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" - -// This test ensures that no code block is detected in the doc comments. - -pub mod Wormhole { - /** # Returns - * - */ - pub fn foofoo() {} - /** - * # Returns - * - */ - pub fn barbar() {} -} diff --git a/tests/rustdoc-ui/block-doc-comment.stdout b/tests/rustdoc-ui/block-doc-comment.stdout deleted file mode 100644 index 7326c0a25..000000000 --- a/tests/rustdoc-ui/block-doc-comment.stdout +++ /dev/null @@ -1,5 +0,0 @@ - -running 0 tests - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/cfg-test.rs b/tests/rustdoc-ui/cfg-test.rs deleted file mode 100644 index d40b92837..000000000 --- a/tests/rustdoc-ui/cfg-test.rs +++ /dev/null @@ -1,31 +0,0 @@ -// check-pass -// compile-flags:--test --test-args --test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" - -// Crates like core have doctests gated on `cfg(not(test))` so we need to make -// sure `cfg(test)` is not active when running `rustdoc --test`. - -/// this doctest will be ignored: -/// -/// ``` -/// assert!(false); -/// ``` -#[cfg(test)] -pub struct Foo; - -/// this doctest will be tested: -/// -/// ``` -/// assert!(true); -/// ``` -#[cfg(not(test))] -pub struct Foo; - -/// this doctest will be tested, but will not appear in documentation: -/// -/// ``` -/// assert!(true) -/// ``` -#[cfg(doctest)] -pub struct Bar; diff --git a/tests/rustdoc-ui/cfg-test.stdout b/tests/rustdoc-ui/cfg-test.stdout deleted file mode 100644 index 2960ff8d3..000000000 --- a/tests/rustdoc-ui/cfg-test.stdout +++ /dev/null @@ -1,7 +0,0 @@ - -running 2 tests -test $DIR/cfg-test.rs - Bar (line 27) ... ok -test $DIR/cfg-test.rs - Foo (line 19) ... ok - -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/check-attr-test.rs b/tests/rustdoc-ui/check-attr-test.rs deleted file mode 100644 index e95547014..000000000 --- a/tests/rustdoc-ui/check-attr-test.rs +++ /dev/null @@ -1,31 +0,0 @@ -// compile-flags:--test - -#![deny(rustdoc::invalid_codeblock_attributes)] - -/// foo -/// -/// ```compile-fail,compilefail,comPile_fail -/// boo -/// ``` -pub fn foo() {} - -/// bar -/// -/// ```should-panic,shouldpanic,shOuld_panic -/// boo -/// ``` -pub fn bar() {} - -/// foobar -/// -/// ```no-run,norun,nO_run -/// boo -/// ``` -pub fn foobar() {} - -/// b -/// -/// ```test-harness,testharness,tesT_harness -/// boo -/// ``` -pub fn b() {} diff --git a/tests/rustdoc-ui/check-attr-test.stderr b/tests/rustdoc-ui/check-attr-test.stderr deleted file mode 100644 index 01beba1ff..000000000 --- a/tests/rustdoc-ui/check-attr-test.stderr +++ /dev/null @@ -1,151 +0,0 @@ -error: unknown attribute `compile-fail`. Did you mean `compile_fail`? - --> $DIR/check-attr-test.rs:5:1 - | -5 | / /// foo -6 | | /// -7 | | /// ```compile-fail,compilefail,comPile_fail -8 | | /// boo -9 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully -note: the lint level is defined here - --> $DIR/check-attr-test.rs:3:9 - | -3 | #![deny(rustdoc::invalid_codeblock_attributes)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: unknown attribute `compilefail`. Did you mean `compile_fail`? - --> $DIR/check-attr-test.rs:5:1 - | -5 | / /// foo -6 | | /// -7 | | /// ```compile-fail,compilefail,comPile_fail -8 | | /// boo -9 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully - -error: unknown attribute `comPile_fail`. Did you mean `compile_fail`? - --> $DIR/check-attr-test.rs:5:1 - | -5 | / /// foo -6 | | /// -7 | | /// ```compile-fail,compilefail,comPile_fail -8 | | /// boo -9 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully - -error: unknown attribute `should-panic`. Did you mean `should_panic`? - --> $DIR/check-attr-test.rs:12:1 - | -12 | / /// bar -13 | | /// -14 | | /// ```should-panic,shouldpanic,shOuld_panic -15 | | /// boo -16 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running - -error: unknown attribute `shouldpanic`. Did you mean `should_panic`? - --> $DIR/check-attr-test.rs:12:1 - | -12 | / /// bar -13 | | /// -14 | | /// ```should-panic,shouldpanic,shOuld_panic -15 | | /// boo -16 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running - -error: unknown attribute `shOuld_panic`. Did you mean `should_panic`? - --> $DIR/check-attr-test.rs:12:1 - | -12 | / /// bar -13 | | /// -14 | | /// ```should-panic,shouldpanic,shOuld_panic -15 | | /// boo -16 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running - -error: unknown attribute `no-run`. Did you mean `no_run`? - --> $DIR/check-attr-test.rs:19:1 - | -19 | / /// foobar -20 | | /// -21 | | /// ```no-run,norun,nO_run -22 | | /// boo -23 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `norun`. Did you mean `no_run`? - --> $DIR/check-attr-test.rs:19:1 - | -19 | / /// foobar -20 | | /// -21 | | /// ```no-run,norun,nO_run -22 | | /// boo -23 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `nO_run`. Did you mean `no_run`? - --> $DIR/check-attr-test.rs:19:1 - | -19 | / /// foobar -20 | | /// -21 | | /// ```no-run,norun,nO_run -22 | | /// boo -23 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `test-harness`. Did you mean `test_harness`? - --> $DIR/check-attr-test.rs:26:1 - | -26 | / /// b -27 | | /// -28 | | /// ```test-harness,testharness,tesT_harness -29 | | /// boo -30 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: unknown attribute `testharness`. Did you mean `test_harness`? - --> $DIR/check-attr-test.rs:26:1 - | -26 | / /// b -27 | | /// -28 | | /// ```test-harness,testharness,tesT_harness -29 | | /// boo -30 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: unknown attribute `tesT_harness`. Did you mean `test_harness`? - --> $DIR/check-attr-test.rs:26:1 - | -26 | / /// b -27 | | /// -28 | | /// ```test-harness,testharness,tesT_harness -29 | | /// boo -30 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: aborting due to 12 previous errors - diff --git a/tests/rustdoc-ui/check-attr.rs b/tests/rustdoc-ui/check-attr.rs deleted file mode 100644 index 0b3f7bedd..000000000 --- a/tests/rustdoc-ui/check-attr.rs +++ /dev/null @@ -1,41 +0,0 @@ -#![deny(rustdoc::invalid_codeblock_attributes)] - -/// foo -//~^ ERROR -//~^^ ERROR -//~^^^ ERROR -/// -/// ```compile-fail,compilefail,comPile_fail -/// boo -/// ``` -pub fn foo() {} - -/// bar -//~^ ERROR -//~^^ ERROR -//~^^^ ERROR -/// -/// ```should-panic,shouldpanic,sHould_panic -/// boo -/// ``` -pub fn bar() {} - -/// foobar -//~^ ERROR -//~^^ ERROR -//~^^^ ERROR -/// -/// ```no-run,norun,no_Run -/// boo -/// ``` -pub fn foobar() {} - -/// b -//~^ ERROR -//~^^ ERROR -//~^^^ ERROR -/// -/// ```test-harness,testharness,teSt_harness -/// boo -/// ``` -pub fn b() {} diff --git a/tests/rustdoc-ui/check-attr.stderr b/tests/rustdoc-ui/check-attr.stderr deleted file mode 100644 index f66e63ab7..000000000 --- a/tests/rustdoc-ui/check-attr.stderr +++ /dev/null @@ -1,175 +0,0 @@ -error: unknown attribute `compile-fail`. Did you mean `compile_fail`? - --> $DIR/check-attr.rs:3:1 - | -LL | / /// foo -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully -note: the lint level is defined here - --> $DIR/check-attr.rs:1:9 - | -LL | #![deny(rustdoc::invalid_codeblock_attributes)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: unknown attribute `compilefail`. Did you mean `compile_fail`? - --> $DIR/check-attr.rs:3:1 - | -LL | / /// foo -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully - -error: unknown attribute `comPile_fail`. Did you mean `compile_fail`? - --> $DIR/check-attr.rs:3:1 - | -LL | / /// foo -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully - -error: unknown attribute `should-panic`. Did you mean `should_panic`? - --> $DIR/check-attr.rs:13:1 - | -LL | / /// bar -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running - -error: unknown attribute `shouldpanic`. Did you mean `should_panic`? - --> $DIR/check-attr.rs:13:1 - | -LL | / /// bar -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running - -error: unknown attribute `sHould_panic`. Did you mean `should_panic`? - --> $DIR/check-attr.rs:13:1 - | -LL | / /// bar -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running - -error: unknown attribute `no-run`. Did you mean `no_run`? - --> $DIR/check-attr.rs:23:1 - | -LL | / /// foobar -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `norun`. Did you mean `no_run`? - --> $DIR/check-attr.rs:23:1 - | -LL | / /// foobar -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `no_Run`. Did you mean `no_run`? - --> $DIR/check-attr.rs:23:1 - | -LL | / /// foobar -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `test-harness`. Did you mean `test_harness`? - --> $DIR/check-attr.rs:33:1 - | -LL | / /// b -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: unknown attribute `testharness`. Did you mean `test_harness`? - --> $DIR/check-attr.rs:33:1 - | -LL | / /// b -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: unknown attribute `teSt_harness`. Did you mean `test_harness`? - --> $DIR/check-attr.rs:33:1 - | -LL | / /// b -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: aborting due to 12 previous errors - diff --git a/tests/rustdoc-ui/check-cfg-test.rs b/tests/rustdoc-ui/check-cfg-test.rs deleted file mode 100644 index 920432276..000000000 --- a/tests/rustdoc-ui/check-cfg-test.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -// compile-flags: --test --nocapture --check-cfg=values(feature,"test") -Z unstable-options -// normalize-stderr-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" - -/// The doctest will produce a warning because feature invalid is unexpected -/// ``` -/// #[cfg(feature = "invalid")] -/// assert!(false); -/// ``` -pub struct Foo; diff --git a/tests/rustdoc-ui/check-cfg-test.stderr b/tests/rustdoc-ui/check-cfg-test.stderr deleted file mode 100644 index 9770be2f1..000000000 --- a/tests/rustdoc-ui/check-cfg-test.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: unexpected `cfg` condition value - --> $DIR/check-cfg-test.rs:9:7 - | -LL | #[cfg(feature = "invalid")] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: expected values for `feature` are: test - = note: `#[warn(unexpected_cfgs)]` on by default - -warning: 1 warning emitted - diff --git a/tests/rustdoc-ui/check-cfg-test.stdout b/tests/rustdoc-ui/check-cfg-test.stdout deleted file mode 100644 index b7db49bcf..000000000 --- a/tests/rustdoc-ui/check-cfg-test.stdout +++ /dev/null @@ -1,6 +0,0 @@ - -running 1 test -test $DIR/check-cfg-test.rs - Foo (line 8) ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/check-cfg-unstable.rs b/tests/rustdoc-ui/check-cfg-unstable.rs deleted file mode 100644 index 5c500ce6c..000000000 --- a/tests/rustdoc-ui/check-cfg-unstable.rs +++ /dev/null @@ -1,2 +0,0 @@ -// check-fail -// compile-flags: --check-cfg=names() diff --git a/tests/rustdoc-ui/check-cfg-unstable.stderr b/tests/rustdoc-ui/check-cfg-unstable.stderr deleted file mode 100644 index 9b27c2bc0..000000000 --- a/tests/rustdoc-ui/check-cfg-unstable.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: the `-Z unstable-options` flag must also be passed to enable the flag `check-cfg` - diff --git a/tests/rustdoc-ui/check-cfg.rs b/tests/rustdoc-ui/check-cfg.rs deleted file mode 100644 index fa8789ad3..000000000 --- a/tests/rustdoc-ui/check-cfg.rs +++ /dev/null @@ -1,7 +0,0 @@ -// check-pass -// compile-flags: --check-cfg=names() -Z unstable-options - -/// uniz is nor a builtin nor pass as arguments so is unexpected -#[cfg(uniz)] -//~^ WARNING unexpected `cfg` condition name -pub struct Bar; diff --git a/tests/rustdoc-ui/check-cfg.stderr b/tests/rustdoc-ui/check-cfg.stderr deleted file mode 100644 index 1db8e1d91..000000000 --- a/tests/rustdoc-ui/check-cfg.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: unexpected `cfg` condition name - --> $DIR/check-cfg.rs:5:7 - | -LL | #[cfg(uniz)] - | ^^^^ help: did you mean: `unix` - | - = note: `#[warn(unexpected_cfgs)]` on by default - -warning: 1 warning emitted - diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-test.stderr b/tests/rustdoc-ui/check-cfg/check-cfg-test.stderr new file mode 100644 index 000000000..9770be2f1 --- /dev/null +++ b/tests/rustdoc-ui/check-cfg/check-cfg-test.stderr @@ -0,0 +1,11 @@ +warning: unexpected `cfg` condition value + --> $DIR/check-cfg-test.rs:9:7 + | +LL | #[cfg(feature = "invalid")] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: expected values for `feature` are: test + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs new file mode 100644 index 000000000..5c500ce6c --- /dev/null +++ b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs @@ -0,0 +1,2 @@ +// check-fail +// compile-flags: --check-cfg=names() diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr new file mode 100644 index 000000000..9b27c2bc0 --- /dev/null +++ b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr @@ -0,0 +1,2 @@ +error: the `-Z unstable-options` flag must also be passed to enable the flag `check-cfg` + diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.rs b/tests/rustdoc-ui/check-cfg/check-cfg.rs new file mode 100644 index 000000000..fa8789ad3 --- /dev/null +++ b/tests/rustdoc-ui/check-cfg/check-cfg.rs @@ -0,0 +1,7 @@ +// check-pass +// compile-flags: --check-cfg=names() -Z unstable-options + +/// uniz is nor a builtin nor pass as arguments so is unexpected +#[cfg(uniz)] +//~^ WARNING unexpected `cfg` condition name +pub struct Bar; diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.stderr b/tests/rustdoc-ui/check-cfg/check-cfg.stderr new file mode 100644 index 000000000..03fb6f96f --- /dev/null +++ b/tests/rustdoc-ui/check-cfg/check-cfg.stderr @@ -0,0 +1,10 @@ +warning: unexpected `cfg` condition name + --> $DIR/check-cfg.rs:5:7 + | +LL | #[cfg(uniz)] + | ^^^^ help: there is a config with a similar name: `unix` + | + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/rustdoc-ui/check-fail.rs b/tests/rustdoc-ui/check-fail.rs deleted file mode 100644 index 02632b4ce..000000000 --- a/tests/rustdoc-ui/check-fail.rs +++ /dev/null @@ -1,23 +0,0 @@ -// compile-flags: -Z unstable-options --check - -#![feature(rustdoc_missing_doc_code_examples)] -#![deny(missing_docs)] -#![deny(rustdoc::missing_doc_code_examples)] -#![deny(rustdoc::all)] - -//! ```rust,testharness -//~^ ERROR -//! let x = 12; -//! ``` - -pub fn foo() {} -//~^ ERROR -//~^^ ERROR - -/// hello -//~^ ERROR -/// -/// ```rust,testharness -/// let x = 12; -/// ``` -pub fn bar() {} diff --git a/tests/rustdoc-ui/check-fail.stderr b/tests/rustdoc-ui/check-fail.stderr deleted file mode 100644 index f05e457af..000000000 --- a/tests/rustdoc-ui/check-fail.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error: missing documentation for a function - --> $DIR/check-fail.rs:13:1 - | -LL | pub fn foo() {} - | ^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/check-fail.rs:4:9 - | -LL | #![deny(missing_docs)] - | ^^^^^^^^^^^^ - -error: missing code example in this documentation - --> $DIR/check-fail.rs:13:1 - | -LL | pub fn foo() {} - | ^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/check-fail.rs:5:9 - | -LL | #![deny(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: unknown attribute `testharness`. Did you mean `test_harness`? - --> $DIR/check-fail.rs:8:1 - | -LL | / //! ```rust,testharness -LL | | -LL | | //! let x = 12; -LL | | //! ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function -note: the lint level is defined here - --> $DIR/check-fail.rs:6:9 - | -LL | #![deny(rustdoc::all)] - | ^^^^^^^^^^^^ - = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc::all)]` - -error: unknown attribute `testharness`. Did you mean `test_harness`? - --> $DIR/check-fail.rs:17:1 - | -LL | / /// hello -LL | | -LL | | /// -LL | | /// ```rust,testharness -LL | | /// let x = 12; -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: aborting due to 4 previous errors - diff --git a/tests/rustdoc-ui/check.rs b/tests/rustdoc-ui/check.rs deleted file mode 100644 index e389a81bb..000000000 --- a/tests/rustdoc-ui/check.rs +++ /dev/null @@ -1,15 +0,0 @@ -// check-pass -// compile-flags: -Z unstable-options --check -// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" - -#![feature(rustdoc_missing_doc_code_examples)] -//~^ WARN -//~^^ WARN - -#![warn(missing_docs)] -#![warn(rustdoc::missing_doc_code_examples)] -#![warn(rustdoc::all)] - -pub fn foo() {} -//~^ WARN -//~^^ WARN diff --git a/tests/rustdoc-ui/check.stderr b/tests/rustdoc-ui/check.stderr deleted file mode 100644 index c5ed5d0c3..000000000 --- a/tests/rustdoc-ui/check.stderr +++ /dev/null @@ -1,61 +0,0 @@ -warning: missing documentation for the crate - --> $DIR/check.rs:5:1 - | -LL | / #![feature(rustdoc_missing_doc_code_examples)] -LL | | -LL | | -LL | | -... | -LL | | -LL | | pub fn foo() {} - | |_______________^ - | -note: the lint level is defined here - --> $DIR/check.rs:9:9 - | -LL | #![warn(missing_docs)] - | ^^^^^^^^^^^^ - -warning: missing documentation for a function - --> $DIR/check.rs:13:1 - | -LL | pub fn foo() {} - | ^^^^^^^^^^^^ - -warning: no documentation found for this crate's top-level module - | - = help: The following guide may be of use: - https://doc.rust-lang.org/$CHANNEL/rustdoc/how-to-write-documentation.html -note: the lint level is defined here - --> $DIR/check.rs:11:9 - | -LL | #![warn(rustdoc::all)] - | ^^^^^^^^^^^^ - = note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc::all)]` - -warning: missing code example in this documentation - --> $DIR/check.rs:5:1 - | -LL | / #![feature(rustdoc_missing_doc_code_examples)] -LL | | -LL | | -LL | | -... | -LL | | -LL | | pub fn foo() {} - | |_______________^ - | -note: the lint level is defined here - --> $DIR/check.rs:10:9 - | -LL | #![warn(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: missing code example in this documentation - --> $DIR/check.rs:13:1 - | -LL | pub fn foo() {} - | ^^^^^^^^^^^^^^^ - -warning: 5 warnings emitted - diff --git a/tests/rustdoc-ui/deny-intra-link-resolution-failure.rs b/tests/rustdoc-ui/deny-intra-link-resolution-failure.rs deleted file mode 100644 index 09da124b1..000000000 --- a/tests/rustdoc-ui/deny-intra-link-resolution-failure.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![deny(rustdoc::broken_intra_doc_links)] - -/// [v2] //~ ERROR -pub fn foo() {} diff --git a/tests/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/tests/rustdoc-ui/deny-intra-link-resolution-failure.stderr deleted file mode 100644 index 3e08354a6..000000000 --- a/tests/rustdoc-ui/deny-intra-link-resolution-failure.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: unresolved link to `v2` - --> $DIR/deny-intra-link-resolution-failure.rs:3:6 - | -LL | /// [v2] - | ^^ no item named `v2` in scope - | - = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` -note: the lint level is defined here - --> $DIR/deny-intra-link-resolution-failure.rs:1:9 - | -LL | #![deny(rustdoc::broken_intra_doc_links)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/rustdoc-ui/deny-missing-docs-crate.rs b/tests/rustdoc-ui/deny-missing-docs-crate.rs deleted file mode 100644 index b74eba3f6..000000000 --- a/tests/rustdoc-ui/deny-missing-docs-crate.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![deny(missing_docs)] //~ ERROR - -pub struct Foo; //~ ERROR diff --git a/tests/rustdoc-ui/deny-missing-docs-crate.stderr b/tests/rustdoc-ui/deny-missing-docs-crate.stderr deleted file mode 100644 index 5025b0b0c..000000000 --- a/tests/rustdoc-ui/deny-missing-docs-crate.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: missing documentation for the crate - --> $DIR/deny-missing-docs-crate.rs:1:1 - | -LL | / #![deny(missing_docs)] -LL | | -LL | | pub struct Foo; - | |_______________^ - | -note: the lint level is defined here - --> $DIR/deny-missing-docs-crate.rs:1:9 - | -LL | #![deny(missing_docs)] - | ^^^^^^^^^^^^ - -error: missing documentation for a struct - --> $DIR/deny-missing-docs-crate.rs:3:1 - | -LL | pub struct Foo; - | ^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/rustdoc-ui/deny-missing-docs-macro.rs b/tests/rustdoc-ui/deny-missing-docs-macro.rs deleted file mode 100644 index b1c125317..000000000 --- a/tests/rustdoc-ui/deny-missing-docs-macro.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! foo - -#![deny(missing_docs)] - -#[macro_export] -macro_rules! foo { //~ ERROR - () => {} -} diff --git a/tests/rustdoc-ui/deny-missing-docs-macro.stderr b/tests/rustdoc-ui/deny-missing-docs-macro.stderr deleted file mode 100644 index 0867b0818..000000000 --- a/tests/rustdoc-ui/deny-missing-docs-macro.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: missing documentation for a macro - --> $DIR/deny-missing-docs-macro.rs:6:1 - | -LL | macro_rules! foo { - | ^^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/deny-missing-docs-macro.rs:3:9 - | -LL | #![deny(missing_docs)] - | ^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/rustdoc-ui/display-output.rs b/tests/rustdoc-ui/display-output.rs deleted file mode 100644 index 23bc54e3c..000000000 --- a/tests/rustdoc-ui/display-output.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Test that `--show-output` has an effect and `allow(unused)` can be overridden. - -// check-pass -// edition:2018 -// compile-flags:--test --test-args=--show-output -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" - -/// ``` -/// #![warn(unused)] -/// let x = 12; -/// -/// fn foo(x: &dyn std::fmt::Display) {} -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc-ui/display-output.stdout b/tests/rustdoc-ui/display-output.stdout deleted file mode 100644 index ad25d1ce5..000000000 --- a/tests/rustdoc-ui/display-output.stdout +++ /dev/null @@ -1,43 +0,0 @@ - -running 1 test -test $DIR/display-output.rs - foo (line 9) ... ok - -successes: - ----- $DIR/display-output.rs - foo (line 9) stdout ---- -warning: unused variable: `x` - --> $DIR/display-output.rs:11:5 - | -LL | let x = 12; - | ^ help: if this is intentional, prefix it with an underscore: `_x` - | -note: the lint level is defined here - --> $DIR/display-output.rs:9:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` - -warning: unused variable: `x` - --> $DIR/display-output.rs:13:8 - | -LL | fn foo(x: &dyn std::fmt::Display) {} - | ^ help: if this is intentional, prefix it with an underscore: `_x` - -warning: function `foo` is never used - --> $DIR/display-output.rs:13:4 - | -LL | fn foo(x: &dyn std::fmt::Display) {} - | ^^^ - | - = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` - -warning: 3 warnings emitted - - - -successes: - $DIR/display-output.rs - foo (line 9) - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/doc-attr.rs b/tests/rustdoc-ui/doc-attr.rs deleted file mode 100644 index 980d1c0e2..000000000 --- a/tests/rustdoc-ui/doc-attr.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![crate_type = "lib"] -#![deny(warnings)] -#![doc(as_ptr)] -//~^ ERROR unknown `doc` attribute -//~^^ WARN - -#[doc(as_ptr)] -//~^ ERROR unknown `doc` attribute -//~^^ WARN -pub fn foo() {} - -#[doc(123)] -//~^ ERROR invalid `doc` attribute -//~| WARN -#[doc("hello", "bar")] -//~^ ERROR invalid `doc` attribute -//~| WARN -//~| ERROR invalid `doc` attribute -//~| WARN -#[doc(foo::bar, crate::bar::baz = "bye")] -//~^ ERROR unknown `doc` attribute -//~| WARN -//~| ERROR unknown `doc` attribute -//~| WARN -fn bar() {} diff --git a/tests/rustdoc-ui/doc-attr.stderr b/tests/rustdoc-ui/doc-attr.stderr deleted file mode 100644 index 68df2771f..000000000 --- a/tests/rustdoc-ui/doc-attr.stderr +++ /dev/null @@ -1,71 +0,0 @@ -error: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:7:7 - | -LL | #[doc(as_ptr)] - | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 -note: the lint level is defined here - --> $DIR/doc-attr.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` - -error: invalid `doc` attribute - --> $DIR/doc-attr.rs:12:7 - | -LL | #[doc(123)] - | ^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: invalid `doc` attribute - --> $DIR/doc-attr.rs:15:7 - | -LL | #[doc("hello", "bar")] - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: invalid `doc` attribute - --> $DIR/doc-attr.rs:15:16 - | -LL | #[doc("hello", "bar")] - | ^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: unknown `doc` attribute `foo::bar` - --> $DIR/doc-attr.rs:20:7 - | -LL | #[doc(foo::bar, crate::bar::baz = "bye")] - | ^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: unknown `doc` attribute `crate::bar::baz` - --> $DIR/doc-attr.rs:20:17 - | -LL | #[doc(foo::bar, crate::bar::baz = "bye")] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:3:8 - | -LL | #![doc(as_ptr)] - | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: aborting due to 7 previous errors - diff --git a/tests/rustdoc-ui/doc-comment-multi-line-attr.rs b/tests/rustdoc-ui/doc-comment-multi-line-attr.rs deleted file mode 100644 index db674e229..000000000 --- a/tests/rustdoc-ui/doc-comment-multi-line-attr.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Regression test for #97440: Multiline inner attribute triggers ICE during doctest -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass - -//! ```rust -//! #![deny( -//! unused_parens, -//! )] -//! ``` diff --git a/tests/rustdoc-ui/doc-comment-multi-line-attr.stdout b/tests/rustdoc-ui/doc-comment-multi-line-attr.stdout deleted file mode 100644 index e47edbd2a..000000000 --- a/tests/rustdoc-ui/doc-comment-multi-line-attr.stdout +++ /dev/null @@ -1,6 +0,0 @@ - -running 1 test -test $DIR/doc-comment-multi-line-attr.rs - (line 7) ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs b/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs deleted file mode 100644 index 6ce3cb9fc..000000000 --- a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs +++ /dev/null @@ -1,12 +0,0 @@ -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass - -/// ``` -/// # #![cfg_attr(not(dox), deny(missing_abi, -/// # non_ascii_idents))] -/// -/// pub struct Bar; -/// ``` -pub struct Bar; diff --git a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.stdout b/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.stdout deleted file mode 100644 index bf3521e4f..000000000 --- a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.stdout +++ /dev/null @@ -1,6 +0,0 @@ - -running 1 test -test $DIR/doc-comment-multi-line-cfg-attr.rs - Bar (line 6) ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/doc-spotlight.fixed b/tests/rustdoc-ui/doc-spotlight.fixed deleted file mode 100644 index 4b58778ea..000000000 --- a/tests/rustdoc-ui/doc-spotlight.fixed +++ /dev/null @@ -1,8 +0,0 @@ -// run-rustfix -#![deny(warnings)] -#![feature(doc_notable_trait)] - -#[doc(notable_trait)] -//~^ ERROR unknown `doc` attribute `spotlight` -//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -trait MyTrait {} diff --git a/tests/rustdoc-ui/doc-spotlight.rs b/tests/rustdoc-ui/doc-spotlight.rs deleted file mode 100644 index 16e387245..000000000 --- a/tests/rustdoc-ui/doc-spotlight.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-rustfix -#![deny(warnings)] -#![feature(doc_notable_trait)] - -#[doc(spotlight)] -//~^ ERROR unknown `doc` attribute `spotlight` -//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -trait MyTrait {} diff --git a/tests/rustdoc-ui/doc-spotlight.stderr b/tests/rustdoc-ui/doc-spotlight.stderr deleted file mode 100644 index 58612327f..000000000 --- a/tests/rustdoc-ui/doc-spotlight.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: unknown `doc` attribute `spotlight` - --> $DIR/doc-spotlight.rs:5:7 - | -LL | #[doc(spotlight)] - | ^^^^^^^^^ help: use `notable_trait` instead - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - = note: `doc(spotlight)` was renamed to `doc(notable_trait)` - = note: `doc(spotlight)` is now a no-op -note: the lint level is defined here - --> $DIR/doc-spotlight.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` - -error: aborting due to previous error - diff --git a/tests/rustdoc-ui/doc-test-attr-pass.rs b/tests/rustdoc-ui/doc-test-attr-pass.rs deleted file mode 100644 index 12608f244..000000000 --- a/tests/rustdoc-ui/doc-test-attr-pass.rs +++ /dev/null @@ -1,8 +0,0 @@ -// check-pass - -#![crate_type = "lib"] -#![deny(invalid_doc_attributes)] -#![doc(test(no_crate_inject))] -#![doc(test(attr(deny(warnings))))] - -pub fn foo() {} diff --git a/tests/rustdoc-ui/doc-test-attr.rs b/tests/rustdoc-ui/doc-test-attr.rs deleted file mode 100644 index 46178ad86..000000000 --- a/tests/rustdoc-ui/doc-test-attr.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "lib"] -#![deny(invalid_doc_attributes)] - -#![doc(test)] -//~^ ERROR `#[doc(test(...)]` takes a list of attributes -//~^^ WARN this was previously accepted by the compiler -#![doc(test = "hello")] -//~^ ERROR `#[doc(test(...)]` takes a list of attributes -//~^^ WARN this was previously accepted by the compiler -#![doc(test(a))] -//~^ ERROR unknown `doc(test)` attribute `a` -//~^^ WARN this was previously accepted by the compiler - -pub fn foo() {} diff --git a/tests/rustdoc-ui/doc-test-attr.stderr b/tests/rustdoc-ui/doc-test-attr.stderr deleted file mode 100644 index 5e6014954..000000000 --- a/tests/rustdoc-ui/doc-test-attr.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error: `#[doc(test(...)]` takes a list of attributes - --> $DIR/doc-test-attr.rs:4:8 - | -LL | #![doc(test)] - | ^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 -note: the lint level is defined here - --> $DIR/doc-test-attr.rs:2:9 - | -LL | #![deny(invalid_doc_attributes)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: `#[doc(test(...)]` takes a list of attributes - --> $DIR/doc-test-attr.rs:7:8 - | -LL | #![doc(test = "hello")] - | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: unknown `doc(test)` attribute `a` - --> $DIR/doc-test-attr.rs:10:13 - | -LL | #![doc(test(a))] - | ^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: aborting due to 3 previous errors - diff --git a/tests/rustdoc-ui/doc-test-doctest-feature.rs b/tests/rustdoc-ui/doc-test-doctest-feature.rs deleted file mode 100644 index 88cf44e64..000000000 --- a/tests/rustdoc-ui/doc-test-doctest-feature.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" - -// Make sure `cfg(doctest)` is set when finding doctests but not inside -// the doctests. - -/// ``` -/// assert!(!cfg!(doctest)); -/// ``` -#[cfg(doctest)] -pub struct Foo; diff --git a/tests/rustdoc-ui/doc-test-doctest-feature.stdout b/tests/rustdoc-ui/doc-test-doctest-feature.stdout deleted file mode 100644 index d7de1f105..000000000 --- a/tests/rustdoc-ui/doc-test-doctest-feature.stdout +++ /dev/null @@ -1,6 +0,0 @@ - -running 1 test -test $DIR/doc-test-doctest-feature.rs - Foo (line 9) ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/doc-test-rustdoc-feature.rs b/tests/rustdoc-ui/doc-test-rustdoc-feature.rs deleted file mode 100644 index dc72a4857..000000000 --- a/tests/rustdoc-ui/doc-test-rustdoc-feature.rs +++ /dev/null @@ -1,15 +0,0 @@ -// check-pass -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" - -#![feature(doc_cfg)] - -// Make sure `cfg(doc)` is set when finding doctests but not inside the doctests. - -/// ``` -/// #![feature(doc_cfg)] -/// assert!(!cfg!(doc)); -/// ``` -#[cfg(doc)] -pub struct Foo; diff --git a/tests/rustdoc-ui/doc-test-rustdoc-feature.stdout b/tests/rustdoc-ui/doc-test-rustdoc-feature.stdout deleted file mode 100644 index 5b07fc4c8..000000000 --- a/tests/rustdoc-ui/doc-test-rustdoc-feature.stdout +++ /dev/null @@ -1,6 +0,0 @@ - -running 1 test -test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/doc-without-codeblock.rs b/tests/rustdoc-ui/doc-without-codeblock.rs deleted file mode 100644 index 86d7c83d3..000000000 --- a/tests/rustdoc-ui/doc-without-codeblock.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![feature(rustdoc_missing_doc_code_examples)] //~ ERROR missing code example in this documentation -#![deny(rustdoc::missing_doc_code_examples)] - -/// Some docs. -//~^ ERROR missing code example in this documentation -pub struct Foo; - -/// And then, the princess died. -//~^ ERROR missing code example in this documentation -pub mod foo { - /// Or maybe not because she saved herself! - //~^ ERROR missing code example in this documentation - pub fn bar() {} -} - -// This impl is here to ensure the lint isn't emitted for foreign traits implementations. -impl std::ops::Neg for Foo { - type Output = Self; - - fn neg(self) -> Self::Output { - Self - } -} diff --git a/tests/rustdoc-ui/doc-without-codeblock.stderr b/tests/rustdoc-ui/doc-without-codeblock.stderr deleted file mode 100644 index ebf2a2d54..000000000 --- a/tests/rustdoc-ui/doc-without-codeblock.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:1:1 - | -LL | / #![feature(rustdoc_missing_doc_code_examples)] -LL | | #![deny(rustdoc::missing_doc_code_examples)] -LL | | -LL | | /// Some docs. -... | -LL | | } -LL | | } - | |_^ - | -note: the lint level is defined here - --> $DIR/doc-without-codeblock.rs:2:9 - | -LL | #![deny(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:8:1 - | -LL | /// And then, the princess died. - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:11:5 - | -LL | /// Or maybe not because she saved herself! - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:4:1 - | -LL | /// Some docs. - | ^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors - diff --git a/tests/rustdoc-ui/doc_cfg_hide.rs b/tests/rustdoc-ui/doc_cfg_hide.rs deleted file mode 100644 index 5d8791748..000000000 --- a/tests/rustdoc-ui/doc_cfg_hide.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(doc_cfg_hide)] -#![deny(warnings)] - -#![doc(cfg_hide = "test")] //~ ERROR -//~^ WARN -#![doc(cfg_hide)] //~ ERROR -//~^ WARN - -#[doc(cfg_hide(doc))] //~ ERROR -//~^ WARN -pub fn foo() {} diff --git a/tests/rustdoc-ui/doc_cfg_hide.stderr b/tests/rustdoc-ui/doc_cfg_hide.stderr deleted file mode 100644 index 03623368c..000000000 --- a/tests/rustdoc-ui/doc_cfg_hide.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error: this attribute can only be applied at the crate level - --> $DIR/doc_cfg_hide.rs:9:7 - | -LL | #[doc(cfg_hide(doc))] - | ^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - = note: read for more information -note: the lint level is defined here - --> $DIR/doc_cfg_hide.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` -help: to apply to the crate, use an inner attribute - | -LL | #![doc(cfg_hide(doc))] - | ~~~~~~~~~~~~~~~~~~~~~~ - -error: `#[doc(cfg_hide(...)]` takes a list of attributes - --> $DIR/doc_cfg_hide.rs:4:8 - | -LL | #![doc(cfg_hide = "test")] - | ^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: `#[doc(cfg_hide(...)]` takes a list of attributes - --> $DIR/doc_cfg_hide.rs:6:8 - | -LL | #![doc(cfg_hide)] - | ^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - -error: aborting due to 3 previous errors - diff --git a/tests/rustdoc-ui/doctest-edition.rs b/tests/rustdoc-ui/doctest-edition.rs deleted file mode 100644 index b0787be97..000000000 --- a/tests/rustdoc-ui/doctest-edition.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2021 - -#![deny(rustdoc::invalid_rust_codeblocks)] -//~^ NOTE lint level is defined here - -// By default, rustdoc should use the edition of the crate. -//! ``` -//! foo'b' -//! ``` -//~^^^ ERROR could not parse -//~| NOTE prefix `foo` is unknown - -// Rustdoc should respect `edition2018` when highlighting syntax. -//! ```edition2018 -//! foo'b' -//! ``` diff --git a/tests/rustdoc-ui/doctest-edition.stderr b/tests/rustdoc-ui/doctest-edition.stderr deleted file mode 100644 index 8a3329aa3..000000000 --- a/tests/rustdoc-ui/doctest-edition.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: could not parse code block as Rust code - --> $DIR/doctest-edition.rs:7:5 - | -LL | //! ``` - | _____^ -LL | | //! foo'b' -LL | | //! ``` - | |_______^ - | - = note: error from rustc: prefix `foo` is unknown -note: the lint level is defined here - --> $DIR/doctest-edition.rs:3:9 - | -LL | #![deny(rustdoc::invalid_rust_codeblocks)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: mark blocks that do not contain Rust code as text - | -LL | //! ```text - | ++++ - -error: aborting due to previous error - diff --git a/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs b/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs deleted file mode 100644 index 260f5a7a6..000000000 --- a/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags:--test --test-args=--test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass - -/// ``` -/// #![deprecated(since = "5.2", note = "foo was rarely used. \ -/// Users should instead use bar")] -/// ``` -pub fn f() {} diff --git a/tests/rustdoc-ui/doctest-multiline-crate-attribute.stdout b/tests/rustdoc-ui/doctest-multiline-crate-attribute.stdout deleted file mode 100644 index 07a4f657d..000000000 --- a/tests/rustdoc-ui/doctest-multiline-crate-attribute.stdout +++ /dev/null @@ -1,6 +0,0 @@ - -running 1 test -test $DIR/doctest-multiline-crate-attribute.rs - f (line 6) ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/doctest-output.rs b/tests/rustdoc-ui/doctest-output.rs deleted file mode 100644 index 303f76896..000000000 --- a/tests/rustdoc-ui/doctest-output.rs +++ /dev/null @@ -1,28 +0,0 @@ -// edition:2018 -// aux-build:extern_macros.rs -// compile-flags:--test --test-args=--test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass - -//! ``` -//! assert_eq!(1 + 1, 2); -//! ``` - -extern crate extern_macros as macros; - -use macros::attrs_on_struct; - -pub mod foo { - - /// ``` - /// assert_eq!(1 + 1, 2); - /// ``` - pub fn bar() {} -} - -attrs_on_struct! { - /// ``` - /// assert!(true); - /// ``` -} diff --git a/tests/rustdoc-ui/doctest-output.stdout b/tests/rustdoc-ui/doctest-output.stdout deleted file mode 100644 index 35b0e366f..000000000 --- a/tests/rustdoc-ui/doctest-output.stdout +++ /dev/null @@ -1,8 +0,0 @@ - -running 3 tests -test $DIR/doctest-output.rs - (line 8) ... ok -test $DIR/doctest-output.rs - ExpandedStruct (line 24) ... ok -test $DIR/doctest-output.rs - foo::bar (line 18) ... ok - -test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/doctest/auxiliary/extern_macros.rs b/tests/rustdoc-ui/doctest/auxiliary/extern_macros.rs new file mode 100644 index 000000000..ee1fec4c5 --- /dev/null +++ b/tests/rustdoc-ui/doctest/auxiliary/extern_macros.rs @@ -0,0 +1,7 @@ +#[macro_export] +macro_rules! attrs_on_struct { + ( $( #[$attr:meta] )* ) => { + $( #[$attr] )* + pub struct ExpandedStruct; + } +} diff --git a/tests/rustdoc-ui/doctest/block-doc-comment.rs b/tests/rustdoc-ui/doctest/block-doc-comment.rs new file mode 100644 index 000000000..ce529916e --- /dev/null +++ b/tests/rustdoc-ui/doctest/block-doc-comment.rs @@ -0,0 +1,17 @@ +// check-pass +// compile-flags:--test +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +// This test ensures that no code block is detected in the doc comments. + +pub mod Wormhole { + /** # Returns + * + */ + pub fn foofoo() {} + /** + * # Returns + * + */ + pub fn barbar() {} +} diff --git a/tests/rustdoc-ui/doctest/block-doc-comment.stdout b/tests/rustdoc-ui/doctest/block-doc-comment.stdout new file mode 100644 index 000000000..7326c0a25 --- /dev/null +++ b/tests/rustdoc-ui/doctest/block-doc-comment.stdout @@ -0,0 +1,5 @@ + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/cfg-test.rs b/tests/rustdoc-ui/doctest/cfg-test.rs new file mode 100644 index 000000000..a263baa97 --- /dev/null +++ b/tests/rustdoc-ui/doctest/cfg-test.rs @@ -0,0 +1,31 @@ +// check-pass +// compile-flags:--test --test-args --test-threads=1 +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +// Crates like core have doctests gated on `cfg(not(test))` so we need to make +// sure `cfg(test)` is not active when running `rustdoc --test`. + +/// this doctest will be ignored: +/// +/// ``` +/// assert!(false); +/// ``` +#[cfg(test)] +pub struct Foo; + +/// this doctest will be tested: +/// +/// ``` +/// assert!(true); +/// ``` +#[cfg(not(test))] +pub struct Foo; + +/// this doctest will be tested, but will not appear in documentation: +/// +/// ``` +/// assert!(true) +/// ``` +#[cfg(doctest)] +pub struct Bar; diff --git a/tests/rustdoc-ui/doctest/cfg-test.stdout b/tests/rustdoc-ui/doctest/cfg-test.stdout new file mode 100644 index 000000000..2960ff8d3 --- /dev/null +++ b/tests/rustdoc-ui/doctest/cfg-test.stdout @@ -0,0 +1,7 @@ + +running 2 tests +test $DIR/cfg-test.rs - Bar (line 27) ... ok +test $DIR/cfg-test.rs - Foo (line 19) ... ok + +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/check-attr-test.rs b/tests/rustdoc-ui/doctest/check-attr-test.rs new file mode 100644 index 000000000..e95547014 --- /dev/null +++ b/tests/rustdoc-ui/doctest/check-attr-test.rs @@ -0,0 +1,31 @@ +// compile-flags:--test + +#![deny(rustdoc::invalid_codeblock_attributes)] + +/// foo +/// +/// ```compile-fail,compilefail,comPile_fail +/// boo +/// ``` +pub fn foo() {} + +/// bar +/// +/// ```should-panic,shouldpanic,shOuld_panic +/// boo +/// ``` +pub fn bar() {} + +/// foobar +/// +/// ```no-run,norun,nO_run +/// boo +/// ``` +pub fn foobar() {} + +/// b +/// +/// ```test-harness,testharness,tesT_harness +/// boo +/// ``` +pub fn b() {} diff --git a/tests/rustdoc-ui/doctest/check-attr-test.stderr b/tests/rustdoc-ui/doctest/check-attr-test.stderr new file mode 100644 index 000000000..01beba1ff --- /dev/null +++ b/tests/rustdoc-ui/doctest/check-attr-test.stderr @@ -0,0 +1,151 @@ +error: unknown attribute `compile-fail`. Did you mean `compile_fail`? + --> $DIR/check-attr-test.rs:5:1 + | +5 | / /// foo +6 | | /// +7 | | /// ```compile-fail,compilefail,comPile_fail +8 | | /// boo +9 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully +note: the lint level is defined here + --> $DIR/check-attr-test.rs:3:9 + | +3 | #![deny(rustdoc::invalid_codeblock_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unknown attribute `compilefail`. Did you mean `compile_fail`? + --> $DIR/check-attr-test.rs:5:1 + | +5 | / /// foo +6 | | /// +7 | | /// ```compile-fail,compilefail,comPile_fail +8 | | /// boo +9 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully + +error: unknown attribute `comPile_fail`. Did you mean `compile_fail`? + --> $DIR/check-attr-test.rs:5:1 + | +5 | / /// foo +6 | | /// +7 | | /// ```compile-fail,compilefail,comPile_fail +8 | | /// boo +9 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully + +error: unknown attribute `should-panic`. Did you mean `should_panic`? + --> $DIR/check-attr-test.rs:12:1 + | +12 | / /// bar +13 | | /// +14 | | /// ```should-panic,shouldpanic,shOuld_panic +15 | | /// boo +16 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running + +error: unknown attribute `shouldpanic`. Did you mean `should_panic`? + --> $DIR/check-attr-test.rs:12:1 + | +12 | / /// bar +13 | | /// +14 | | /// ```should-panic,shouldpanic,shOuld_panic +15 | | /// boo +16 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running + +error: unknown attribute `shOuld_panic`. Did you mean `should_panic`? + --> $DIR/check-attr-test.rs:12:1 + | +12 | / /// bar +13 | | /// +14 | | /// ```should-panic,shouldpanic,shOuld_panic +15 | | /// boo +16 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running + +error: unknown attribute `no-run`. Did you mean `no_run`? + --> $DIR/check-attr-test.rs:19:1 + | +19 | / /// foobar +20 | | /// +21 | | /// ```no-run,norun,nO_run +22 | | /// boo +23 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) + +error: unknown attribute `norun`. Did you mean `no_run`? + --> $DIR/check-attr-test.rs:19:1 + | +19 | / /// foobar +20 | | /// +21 | | /// ```no-run,norun,nO_run +22 | | /// boo +23 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) + +error: unknown attribute `nO_run`. Did you mean `no_run`? + --> $DIR/check-attr-test.rs:19:1 + | +19 | / /// foobar +20 | | /// +21 | | /// ```no-run,norun,nO_run +22 | | /// boo +23 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) + +error: unknown attribute `test-harness`. Did you mean `test_harness`? + --> $DIR/check-attr-test.rs:26:1 + | +26 | / /// b +27 | | /// +28 | | /// ```test-harness,testharness,tesT_harness +29 | | /// boo +30 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function + +error: unknown attribute `testharness`. Did you mean `test_harness`? + --> $DIR/check-attr-test.rs:26:1 + | +26 | / /// b +27 | | /// +28 | | /// ```test-harness,testharness,tesT_harness +29 | | /// boo +30 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function + +error: unknown attribute `tesT_harness`. Did you mean `test_harness`? + --> $DIR/check-attr-test.rs:26:1 + | +26 | / /// b +27 | | /// +28 | | /// ```test-harness,testharness,tesT_harness +29 | | /// boo +30 | | /// ``` + | |_______^ + | + = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function + +error: aborting due to 12 previous errors + diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.rs b/tests/rustdoc-ui/doctest/check-cfg-test.rs new file mode 100644 index 000000000..49a801c3f --- /dev/null +++ b/tests/rustdoc-ui/doctest/check-cfg-test.rs @@ -0,0 +1,12 @@ +// check-pass +// compile-flags: --test --nocapture --check-cfg=values(feature,"test") -Z unstable-options +// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +/// The doctest will produce a warning because feature invalid is unexpected +/// ``` +/// #[cfg(feature = "invalid")] +/// assert!(false); +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.stderr b/tests/rustdoc-ui/doctest/check-cfg-test.stderr new file mode 100644 index 000000000..f84543c20 --- /dev/null +++ b/tests/rustdoc-ui/doctest/check-cfg-test.stderr @@ -0,0 +1,11 @@ +warning: unexpected `cfg` condition value + --> $DIR/check-cfg-test.rs:9:7 + | +LL | #[cfg(feature = "invalid")] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: expected values for `feature` are: `test` + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.stdout b/tests/rustdoc-ui/doctest/check-cfg-test.stdout new file mode 100644 index 000000000..b7db49bcf --- /dev/null +++ b/tests/rustdoc-ui/doctest/check-cfg-test.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/check-cfg-test.rs - Foo (line 8) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/display-output.rs b/tests/rustdoc-ui/doctest/display-output.rs new file mode 100644 index 000000000..7a26dbff9 --- /dev/null +++ b/tests/rustdoc-ui/doctest/display-output.rs @@ -0,0 +1,15 @@ +// Test that `--show-output` has an effect and `allow(unused)` can be overridden. + +// check-pass +// edition:2018 +// compile-flags:--test --test-args=--show-output +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +/// ``` +/// #![warn(unused)] +/// let x = 12; +/// +/// fn foo(x: &dyn std::fmt::Display) {} +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc-ui/doctest/display-output.stdout b/tests/rustdoc-ui/doctest/display-output.stdout new file mode 100644 index 000000000..ad25d1ce5 --- /dev/null +++ b/tests/rustdoc-ui/doctest/display-output.stdout @@ -0,0 +1,43 @@ + +running 1 test +test $DIR/display-output.rs - foo (line 9) ... ok + +successes: + +---- $DIR/display-output.rs - foo (line 9) stdout ---- +warning: unused variable: `x` + --> $DIR/display-output.rs:11:5 + | +LL | let x = 12; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | +note: the lint level is defined here + --> $DIR/display-output.rs:9:9 + | +LL | #![warn(unused)] + | ^^^^^^ + = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` + +warning: unused variable: `x` + --> $DIR/display-output.rs:13:8 + | +LL | fn foo(x: &dyn std::fmt::Display) {} + | ^ help: if this is intentional, prefix it with an underscore: `_x` + +warning: function `foo` is never used + --> $DIR/display-output.rs:13:4 + | +LL | fn foo(x: &dyn std::fmt::Display) {} + | ^^^ + | + = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` + +warning: 3 warnings emitted + + + +successes: + $DIR/display-output.rs - foo (line 9) + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs new file mode 100644 index 000000000..75508f435 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs @@ -0,0 +1,11 @@ +// Regression test for #97440: Multiline inner attribute triggers ICE during doctest +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// check-pass + +//! ```rust +//! #![deny( +//! unused_parens, +//! )] +//! ``` diff --git a/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.stdout b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.stdout new file mode 100644 index 000000000..e47edbd2a --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/doc-comment-multi-line-attr.rs - (line 7) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs new file mode 100644 index 000000000..3b0b27edb --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs @@ -0,0 +1,12 @@ +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// check-pass + +/// ``` +/// # #![cfg_attr(not(dox), deny(missing_abi, +/// # non_ascii_idents))] +/// +/// pub struct Bar; +/// ``` +pub struct Bar; diff --git a/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.stdout b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.stdout new file mode 100644 index 000000000..bf3521e4f --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/doc-comment-multi-line-cfg-attr.rs - Bar (line 6) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doc-test-attr-pass.rs b/tests/rustdoc-ui/doctest/doc-test-attr-pass.rs new file mode 100644 index 000000000..12608f244 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-test-attr-pass.rs @@ -0,0 +1,8 @@ +// check-pass + +#![crate_type = "lib"] +#![deny(invalid_doc_attributes)] +#![doc(test(no_crate_inject))] +#![doc(test(attr(deny(warnings))))] + +pub fn foo() {} diff --git a/tests/rustdoc-ui/doctest/doc-test-attr.rs b/tests/rustdoc-ui/doctest/doc-test-attr.rs new file mode 100644 index 000000000..46178ad86 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-test-attr.rs @@ -0,0 +1,14 @@ +#![crate_type = "lib"] +#![deny(invalid_doc_attributes)] + +#![doc(test)] +//~^ ERROR `#[doc(test(...)]` takes a list of attributes +//~^^ WARN this was previously accepted by the compiler +#![doc(test = "hello")] +//~^ ERROR `#[doc(test(...)]` takes a list of attributes +//~^^ WARN this was previously accepted by the compiler +#![doc(test(a))] +//~^ ERROR unknown `doc(test)` attribute `a` +//~^^ WARN this was previously accepted by the compiler + +pub fn foo() {} diff --git a/tests/rustdoc-ui/doctest/doc-test-attr.stderr b/tests/rustdoc-ui/doctest/doc-test-attr.stderr new file mode 100644 index 000000000..5e6014954 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-test-attr.stderr @@ -0,0 +1,34 @@ +error: `#[doc(test(...)]` takes a list of attributes + --> $DIR/doc-test-attr.rs:4:8 + | +LL | #![doc(test)] + | ^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 +note: the lint level is defined here + --> $DIR/doc-test-attr.rs:2:9 + | +LL | #![deny(invalid_doc_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: `#[doc(test(...)]` takes a list of attributes + --> $DIR/doc-test-attr.rs:7:8 + | +LL | #![doc(test = "hello")] + | ^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 + +error: unknown `doc(test)` attribute `a` + --> $DIR/doc-test-attr.rs:10:13 + | +LL | #![doc(test(a))] + | ^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 + +error: aborting due to 3 previous errors + diff --git a/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs new file mode 100644 index 000000000..9c1f4936e --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs @@ -0,0 +1,13 @@ +// check-pass +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +// Make sure `cfg(doctest)` is set when finding doctests but not inside +// the doctests. + +/// ``` +/// assert!(!cfg!(doctest)); +/// ``` +#[cfg(doctest)] +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/doc-test-doctest-feature.stdout b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.stdout new file mode 100644 index 000000000..d7de1f105 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/doc-test-doctest-feature.rs - Foo (line 9) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs new file mode 100644 index 000000000..1f90d13af --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs @@ -0,0 +1,15 @@ +// check-pass +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +#![feature(doc_cfg)] + +// Make sure `cfg(doc)` is set when finding doctests but not inside the doctests. + +/// ``` +/// #![feature(doc_cfg)] +/// assert!(!cfg!(doc)); +/// ``` +#[cfg(doc)] +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.stdout b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.stdout new file mode 100644 index 000000000..5b07fc4c8 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doctest-edition.rs b/tests/rustdoc-ui/doctest/doctest-edition.rs new file mode 100644 index 000000000..b0787be97 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doctest-edition.rs @@ -0,0 +1,16 @@ +// edition:2021 + +#![deny(rustdoc::invalid_rust_codeblocks)] +//~^ NOTE lint level is defined here + +// By default, rustdoc should use the edition of the crate. +//! ``` +//! foo'b' +//! ``` +//~^^^ ERROR could not parse +//~| NOTE prefix `foo` is unknown + +// Rustdoc should respect `edition2018` when highlighting syntax. +//! ```edition2018 +//! foo'b' +//! ``` diff --git a/tests/rustdoc-ui/doctest/doctest-edition.stderr b/tests/rustdoc-ui/doctest/doctest-edition.stderr new file mode 100644 index 000000000..8a3329aa3 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doctest-edition.stderr @@ -0,0 +1,22 @@ +error: could not parse code block as Rust code + --> $DIR/doctest-edition.rs:7:5 + | +LL | //! ``` + | _____^ +LL | | //! foo'b' +LL | | //! ``` + | |_______^ + | + = note: error from rustc: prefix `foo` is unknown +note: the lint level is defined here + --> $DIR/doctest-edition.rs:3:9 + | +LL | #![deny(rustdoc::invalid_rust_codeblocks)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: mark blocks that do not contain Rust code as text + | +LL | //! ```text + | ++++ + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs new file mode 100644 index 000000000..a3bde6cb9 --- /dev/null +++ b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs @@ -0,0 +1,10 @@ +// compile-flags:--test --test-args=--test-threads=1 +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// check-pass + +/// ``` +/// #![deprecated(since = "5.2", note = "foo was rarely used. \ +/// Users should instead use bar")] +/// ``` +pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.stdout b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.stdout new file mode 100644 index 000000000..07a4f657d --- /dev/null +++ b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/doctest-multiline-crate-attribute.rs - f (line 6) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doctest-output.rs b/tests/rustdoc-ui/doctest/doctest-output.rs new file mode 100644 index 000000000..26754b73f --- /dev/null +++ b/tests/rustdoc-ui/doctest/doctest-output.rs @@ -0,0 +1,28 @@ +// edition:2018 +// aux-build:extern_macros.rs +// compile-flags:--test --test-args=--test-threads=1 +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// check-pass + +//! ``` +//! assert_eq!(1 + 1, 2); +//! ``` + +extern crate extern_macros as macros; + +use macros::attrs_on_struct; + +pub mod foo { + + /// ``` + /// assert_eq!(1 + 1, 2); + /// ``` + pub fn bar() {} +} + +attrs_on_struct! { + /// ``` + /// assert!(true); + /// ``` +} diff --git a/tests/rustdoc-ui/doctest/doctest-output.stdout b/tests/rustdoc-ui/doctest/doctest-output.stdout new file mode 100644 index 000000000..35b0e366f --- /dev/null +++ b/tests/rustdoc-ui/doctest/doctest-output.stdout @@ -0,0 +1,8 @@ + +running 3 tests +test $DIR/doctest-output.rs - (line 8) ... ok +test $DIR/doctest-output.rs - ExpandedStruct (line 24) ... ok +test $DIR/doctest-output.rs - foo::bar (line 18) ... ok + +test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs new file mode 100644 index 000000000..53b3857df --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs @@ -0,0 +1,12 @@ +// FIXME: if/when the output of the test harness can be tested on its own, this test should be +// adapted to use that, and that normalize line can go away + +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// failure-status: 101 + +/// ```compile_fail +/// println!("Hello"); +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.stdout b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.stdout new file mode 100644 index 000000000..af3a90a74 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.stdout @@ -0,0 +1,14 @@ + +running 1 test +test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) - compile fail ... FAILED + +failures: + +---- $DIR/failed-doctest-compile-fail.rs - Foo (line 9) stdout ---- +Test compiled successfully, but it's marked `compile_fail`. + +failures: + $DIR/failed-doctest-compile-fail.rs - Foo (line 9) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs new file mode 100644 index 000000000..84e4d6160 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs @@ -0,0 +1,18 @@ +// FIXME: if/when the output of the test harness can be tested on its own, this test should be +// adapted to use that, and that normalize line can go away + +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// failure-status: 101 + +/// +/// +/// ```rust +/// struct S {}; // unexpected semicolon after struct def +/// +/// fn main() { +/// assert_eq!(0, 1); +/// } +/// ``` +mod m {} diff --git a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout new file mode 100644 index 000000000..61468b6c7 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout @@ -0,0 +1,24 @@ + +running 1 test +test $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) ... FAILED + +failures: + +---- $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) stdout ---- +error: expected item, found `;` + --> $DIR/failed-doctest-extra-semicolon-on-item.rs:12:12 + | +LL | struct S {}; // unexpected semicolon after struct def + | ^ help: remove this semicolon + | + = help: braced struct declarations are not followed by a semicolon + +error: aborting due to previous error + +Couldn't compile the test. + +failures: + $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs new file mode 100644 index 000000000..4e3b848fc --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs @@ -0,0 +1,12 @@ +// FIXME: if/when the output of the test harness can be tested on its own, this test should be +// adapted to use that, and that normalize line can go away + +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// failure-status: 101 + +/// ```compile_fail,E0004 +/// let x: () = 5i32; +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.stdout b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.stdout new file mode 100644 index 000000000..bacbb47b5 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.stdout @@ -0,0 +1,25 @@ + +running 1 test +test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) - compile fail ... FAILED + +failures: + +---- $DIR/failed-doctest-missing-codes.rs - Foo (line 9) stdout ---- +error[E0308]: mismatched types + --> $DIR/failed-doctest-missing-codes.rs:10:13 + | +LL | let x: () = 5i32; + | -- ^^^^ expected `()`, found `i32` + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. +Some expected error codes were not found: ["E0004"] + +failures: + $DIR/failed-doctest-missing-codes.rs - Foo (line 9) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs new file mode 100644 index 000000000..6bc6c33c7 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs @@ -0,0 +1,28 @@ +// only-windows +// There's a parallel generic version of this test for non-windows platforms. + +// Issue #51162: A failed doctest was not printing its stdout/stderr +// FIXME: if/when the output of the test harness can be tested on its own, this test should be +// adapted to use that, and that normalize line can go away + +// compile-flags:--test --test-args --test-threads=1 +// rustc-env:RUST_BACKTRACE=0 +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// failure-status: 101 + +// doctest fails at runtime +/// ``` +/// println!("stdout 1"); +/// eprintln!("stderr 1"); +/// println!("stdout 2"); +/// eprintln!("stderr 2"); +/// panic!("oh no"); +/// ``` +pub struct SomeStruct; + +// doctest fails at compile time +/// ``` +/// no +/// ``` +pub struct OtherStruct; diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout new file mode 100644 index 000000000..6c147054d --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout @@ -0,0 +1,39 @@ + +running 2 tests +test $DIR/failed-doctest-output-windows.rs - OtherStruct (line 25) ... FAILED +test $DIR/failed-doctest-output-windows.rs - SomeStruct (line 15) ... FAILED + +failures: + +---- $DIR/failed-doctest-output-windows.rs - OtherStruct (line 25) stdout ---- +error[E0425]: cannot find value `no` in this scope + --> $DIR/failed-doctest-output-windows.rs:26:1 + | +LL | no + | ^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. +Couldn't compile the test. +---- $DIR/failed-doctest-output-windows.rs - SomeStruct (line 15) stdout ---- +Test executable failed (exit code: 101). + +stdout: +stdout 1 +stdout 2 + +stderr: +stderr 1 +stderr 2 +thread 'main' panicked at 'oh no', $DIR/failed-doctest-output-windows.rs:7:1 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + + + +failures: + $DIR/failed-doctest-output-windows.rs - OtherStruct (line 25) + $DIR/failed-doctest-output-windows.rs - SomeStruct (line 15) + +test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output.rs b/tests/rustdoc-ui/doctest/failed-doctest-output.rs new file mode 100644 index 000000000..3e1312382 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-output.rs @@ -0,0 +1,28 @@ +// ignore-windows +// There's a parallel version of this test for Windows. + +// Issue #51162: A failed doctest was not printing its stdout/stderr +// FIXME: if/when the output of the test harness can be tested on its own, this test should be +// adapted to use that, and that normalize line can go away + +// compile-flags:--test --test-args --test-threads=1 +// rustc-env:RUST_BACKTRACE=0 +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// failure-status: 101 + +// doctest fails at runtime +/// ``` +/// println!("stdout 1"); +/// eprintln!("stderr 1"); +/// println!("stdout 2"); +/// eprintln!("stderr 2"); +/// panic!("oh no"); +/// ``` +pub struct SomeStruct; + +// doctest fails at compile time +/// ``` +/// no +/// ``` +pub struct OtherStruct; diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output.stdout b/tests/rustdoc-ui/doctest/failed-doctest-output.stdout new file mode 100644 index 000000000..630198a56 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-output.stdout @@ -0,0 +1,39 @@ + +running 2 tests +test $DIR/failed-doctest-output.rs - OtherStruct (line 25) ... FAILED +test $DIR/failed-doctest-output.rs - SomeStruct (line 15) ... FAILED + +failures: + +---- $DIR/failed-doctest-output.rs - OtherStruct (line 25) stdout ---- +error[E0425]: cannot find value `no` in this scope + --> $DIR/failed-doctest-output.rs:26:1 + | +LL | no + | ^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. +Couldn't compile the test. +---- $DIR/failed-doctest-output.rs - SomeStruct (line 15) stdout ---- +Test executable failed (exit status: 101). + +stdout: +stdout 1 +stdout 2 + +stderr: +stderr 1 +stderr 2 +thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:7:1 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + + + +failures: + $DIR/failed-doctest-output.rs - OtherStruct (line 25) + $DIR/failed-doctest-output.rs - SomeStruct (line 15) + +test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs new file mode 100644 index 000000000..36284e814 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs @@ -0,0 +1,12 @@ +// FIXME: if/when the output of the test harness can be tested on its own, this test should be +// adapted to use that, and that normalize line can go away + +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// failure-status: 101 + +/// ```should_panic +/// println!("Hello, world!"); +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout new file mode 100644 index 000000000..57a20092a --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout @@ -0,0 +1,14 @@ + +running 1 test +test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED + +failures: + +---- $DIR/failed-doctest-should-panic.rs - Foo (line 9) stdout ---- +Test executable succeeded, but it's marked `should_panic`. + +failures: + $DIR/failed-doctest-should-panic.rs - Foo (line 9) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/no-run-flag-error.rs b/tests/rustdoc-ui/doctest/no-run-flag-error.rs new file mode 100644 index 000000000..4ead62148 --- /dev/null +++ b/tests/rustdoc-ui/doctest/no-run-flag-error.rs @@ -0,0 +1,6 @@ +// test the behavior of the --no-run flag without the --test flag + +// compile-flags:-Z unstable-options --no-run --test-args=--test-threads=1 +// error-pattern: the `--test` flag must be passed + +pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/no-run-flag-error.stderr b/tests/rustdoc-ui/doctest/no-run-flag-error.stderr new file mode 100644 index 000000000..d032646c3 --- /dev/null +++ b/tests/rustdoc-ui/doctest/no-run-flag-error.stderr @@ -0,0 +1,2 @@ +error: the `--test` flag must be passed to enable `--no-run` + diff --git a/tests/rustdoc-ui/doctest/no-run-flag.rs b/tests/rustdoc-ui/doctest/no-run-flag.rs new file mode 100644 index 000000000..1cf3b7c4b --- /dev/null +++ b/tests/rustdoc-ui/doctest/no-run-flag.rs @@ -0,0 +1,38 @@ +// test the behavior of the --no-run flag + +// check-pass +// compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1 +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +/// ``` +/// let a = true; +/// ``` +/// ```should_panic +/// panic!() +/// ``` +/// ```ignore (incomplete-code) +/// fn foo() { +/// ``` +/// ```no_run +/// loop { +/// println!("Hello, world"); +/// } +/// ``` +/// fails to compile +/// ```compile_fail +/// let x = 5; +/// x += 2; // shouldn't compile! +/// ``` +/// Ok the test does not run +/// ``` +/// panic!() +/// ``` +/// Ok the test does not run +/// ```should_panic +/// loop { +/// println!("Hello, world"); +/// panic!() +/// } +/// ``` +pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/no-run-flag.stdout b/tests/rustdoc-ui/doctest/no-run-flag.stdout new file mode 100644 index 000000000..02f28aaf6 --- /dev/null +++ b/tests/rustdoc-ui/doctest/no-run-flag.stdout @@ -0,0 +1,12 @@ + +running 7 tests +test $DIR/no-run-flag.rs - f (line 11) - compile ... ok +test $DIR/no-run-flag.rs - f (line 14) ... ignored +test $DIR/no-run-flag.rs - f (line 17) - compile ... ok +test $DIR/no-run-flag.rs - f (line 23) - compile fail ... ok +test $DIR/no-run-flag.rs - f (line 28) - compile ... ok +test $DIR/no-run-flag.rs - f (line 32) - compile ... ok +test $DIR/no-run-flag.rs - f (line 8) - compile ... ok + +test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/nocapture-fail.rs b/tests/rustdoc-ui/doctest/nocapture-fail.rs new file mode 100644 index 000000000..ce487a43d --- /dev/null +++ b/tests/rustdoc-ui/doctest/nocapture-fail.rs @@ -0,0 +1,12 @@ +// check-pass +// compile-flags:--test -Zunstable-options --nocapture +// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +/// ```compile_fail +/// fn foo() { +/// Input: 123 +/// } +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/nocapture-fail.stderr b/tests/rustdoc-ui/doctest/nocapture-fail.stderr new file mode 100644 index 000000000..b65b622c1 --- /dev/null +++ b/tests/rustdoc-ui/doctest/nocapture-fail.stderr @@ -0,0 +1,18 @@ +error: struct literal body without path + --> $DIR/nocapture-fail.rs:8:10 + | +LL | fn foo() { + | __________^ +LL | | Input: 123 +LL | | } + | |_^ + | +help: you might have forgotten to add the struct literal inside the block + | +LL ~ fn foo() { SomeStruct { +LL | Input: 123 +LL ~ } } + | + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/doctest/nocapture-fail.stdout b/tests/rustdoc-ui/doctest/nocapture-fail.stdout new file mode 100644 index 000000000..754f77db5 --- /dev/null +++ b/tests/rustdoc-ui/doctest/nocapture-fail.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/nocapture-fail.rs - Foo (line 7) - compile fail ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/nocapture.rs b/tests/rustdoc-ui/doctest/nocapture.rs new file mode 100644 index 000000000..25fbcf857 --- /dev/null +++ b/tests/rustdoc-ui/doctest/nocapture.rs @@ -0,0 +1,10 @@ +// check-pass +// compile-flags:--test -Zunstable-options --nocapture +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +/// ``` +/// println!("hello!"); +/// eprintln!("stderr"); +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/nocapture.stderr b/tests/rustdoc-ui/doctest/nocapture.stderr new file mode 100644 index 000000000..af6415db3 --- /dev/null +++ b/tests/rustdoc-ui/doctest/nocapture.stderr @@ -0,0 +1 @@ +stderr diff --git a/tests/rustdoc-ui/doctest/nocapture.stdout b/tests/rustdoc-ui/doctest/nocapture.stdout new file mode 100644 index 000000000..4880e75da --- /dev/null +++ b/tests/rustdoc-ui/doctest/nocapture.stdout @@ -0,0 +1,7 @@ + +running 1 test +hello! +test $DIR/nocapture.rs - Foo (line 6) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/private-doc-test.rs b/tests/rustdoc-ui/doctest/private-doc-test.rs new file mode 100644 index 000000000..a1f9f8dca --- /dev/null +++ b/tests/rustdoc-ui/doctest/private-doc-test.rs @@ -0,0 +1,12 @@ +// check-pass + +#![deny(rustdoc::private_doc_tests)] + +mod foo { + /// private doc test + /// + /// ```ignore (used for testing ignored doc tests) + /// assert!(false); + /// ``` + fn bar() {} +} diff --git a/tests/rustdoc-ui/doctest/private-item-doc-test.rs b/tests/rustdoc-ui/doctest/private-item-doc-test.rs new file mode 100644 index 000000000..1a3d6cc63 --- /dev/null +++ b/tests/rustdoc-ui/doctest/private-item-doc-test.rs @@ -0,0 +1,11 @@ +#![deny(rustdoc::private_doc_tests)] + +mod foo { + /// private doc test + /// + /// ``` + /// assert!(false); + /// ``` + //~^^^^^ ERROR documentation test in private item + fn bar() {} +} diff --git a/tests/rustdoc-ui/doctest/private-item-doc-test.stderr b/tests/rustdoc-ui/doctest/private-item-doc-test.stderr new file mode 100644 index 000000000..5df613298 --- /dev/null +++ b/tests/rustdoc-ui/doctest/private-item-doc-test.stderr @@ -0,0 +1,18 @@ +error: documentation test in private item + --> $DIR/private-item-doc-test.rs:4:5 + | +LL | / /// private doc test +LL | | /// +LL | | /// ``` +LL | | /// assert!(false); +LL | | /// ``` + | |___________^ + | +note: the lint level is defined here + --> $DIR/private-item-doc-test.rs:1:9 + | +LL | #![deny(rustdoc::private_doc_tests)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/doctest/private-public-item-doc-test.rs b/tests/rustdoc-ui/doctest/private-public-item-doc-test.rs new file mode 100644 index 000000000..7cc62b38c --- /dev/null +++ b/tests/rustdoc-ui/doctest/private-public-item-doc-test.rs @@ -0,0 +1,11 @@ +#![deny(rustdoc::private_doc_tests)] + +mod foo { + /// private doc test + /// + /// ``` + /// assert!(false); + /// ``` + //~^^^^^ ERROR documentation test in private item + pub fn bar() {} +} diff --git a/tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr b/tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr new file mode 100644 index 000000000..f50dbd184 --- /dev/null +++ b/tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr @@ -0,0 +1,18 @@ +error: documentation test in private item + --> $DIR/private-public-item-doc-test.rs:4:5 + | +LL | / /// private doc test +LL | | /// +LL | | /// ``` +LL | | /// assert!(false); +LL | | /// ``` + | |___________^ + | +note: the lint level is defined here + --> $DIR/private-public-item-doc-test.rs:1:9 + | +LL | #![deny(rustdoc::private_doc_tests)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs b/tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs new file mode 100644 index 000000000..b86a53305 --- /dev/null +++ b/tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs @@ -0,0 +1,16 @@ +// check-pass + +#![deny(rustdoc::private_doc_tests)] + +pub fn foo() {} + +mod private { + /// re-exported doc test + /// + /// ``` + /// assert!(true); + /// ``` + pub fn bar() {} +} + +pub use private::bar; diff --git a/tests/rustdoc-ui/doctest/run-directory.correct.stdout b/tests/rustdoc-ui/doctest/run-directory.correct.stdout new file mode 100644 index 000000000..e9b275479 --- /dev/null +++ b/tests/rustdoc-ui/doctest/run-directory.correct.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/run-directory.rs - foo (line 10) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/run-directory.incorrect.stdout b/tests/rustdoc-ui/doctest/run-directory.incorrect.stdout new file mode 100644 index 000000000..97a5dbc5c --- /dev/null +++ b/tests/rustdoc-ui/doctest/run-directory.incorrect.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/run-directory.rs - foo (line 19) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/run-directory.rs b/tests/rustdoc-ui/doctest/run-directory.rs new file mode 100644 index 000000000..1ff0af2d1 --- /dev/null +++ b/tests/rustdoc-ui/doctest/run-directory.rs @@ -0,0 +1,23 @@ +// this test asserts that the cwd of doctest invocations is set correctly. + +// revisions: correct incorrect +// check-pass +// [correct]compile-flags:--test --test-run-directory={{src-base}} +// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +/// ``` +/// assert_eq!( +/// std::fs::read_to_string("doctest/run-directory.rs").unwrap(), +/// include_str!("run-directory.rs"), +/// ); +/// ``` +#[cfg(correct)] +pub fn foo() {} + +/// ``` +/// assert!(std::fs::read_to_string("doctest/run-directory.rs").is_err()); +/// ``` +#[cfg(incorrect)] +pub fn foo() {} diff --git a/tests/rustdoc-ui/doctest/test-compile-fail1.rs b/tests/rustdoc-ui/doctest/test-compile-fail1.rs new file mode 100644 index 000000000..a05390238 --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-compile-fail1.rs @@ -0,0 +1,8 @@ +// compile-flags:--test + +/// ``` +/// assert!(true) +/// ``` +pub fn f() {} + +pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/test-compile-fail1.stderr b/tests/rustdoc-ui/doctest/test-compile-fail1.stderr new file mode 100644 index 000000000..72915e46b --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-compile-fail1.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `f` is defined multiple times + --> $DIR/test-compile-fail1.rs:8:1 + | +6 | pub fn f() {} + | ---------- previous definition of the value `f` here +7 | +8 | pub fn f() {} + | ^^^^^^^^^^ `f` redefined here + | + = note: `f` must be defined only once in the value namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/rustdoc-ui/doctest/test-compile-fail2.rs b/tests/rustdoc-ui/doctest/test-compile-fail2.rs new file mode 100644 index 000000000..651ded0a0 --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-compile-fail2.rs @@ -0,0 +1,3 @@ +// compile-flags:--test + +fail diff --git a/tests/rustdoc-ui/doctest/test-compile-fail2.stderr b/tests/rustdoc-ui/doctest/test-compile-fail2.stderr new file mode 100644 index 000000000..cee5b63cf --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-compile-fail2.stderr @@ -0,0 +1,8 @@ +error: expected one of `!` or `::`, found `` + --> $DIR/test-compile-fail2.rs:3:1 + | +3 | fail + | ^^^^ expected one of `!` or `::` + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/doctest/test-compile-fail3.rs b/tests/rustdoc-ui/doctest/test-compile-fail3.rs new file mode 100644 index 000000000..faa30ad83 --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-compile-fail3.rs @@ -0,0 +1,3 @@ +// compile-flags:--test + +"fail diff --git a/tests/rustdoc-ui/doctest/test-compile-fail3.stderr b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr new file mode 100644 index 000000000..fab801b3b --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr @@ -0,0 +1,9 @@ +error[E0765]: unterminated double quote string + --> $DIR/test-compile-fail3.rs:3:1 + | +3 | "fail + | ^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0765`. diff --git a/tests/rustdoc-ui/doctest/test-no_std.rs b/tests/rustdoc-ui/doctest/test-no_std.rs new file mode 100644 index 000000000..fd651d1a3 --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-no_std.rs @@ -0,0 +1,13 @@ +// compile-flags:--test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// check-pass + +#![no_std] + +extern crate alloc; + +/// ``` +/// assert!(true) +/// ``` +pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/test-no_std.stdout b/tests/rustdoc-ui/doctest/test-no_std.stdout new file mode 100644 index 000000000..8d5a30804 --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-no_std.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/test-no_std.rs - f (line 10) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/test-type.rs b/tests/rustdoc-ui/doctest/test-type.rs new file mode 100644 index 000000000..036d37f9d --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-type.rs @@ -0,0 +1,26 @@ +// compile-flags: --test --test-args=--test-threads=1 +// check-pass +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +/// ``` +/// let a = true; +/// ``` +/// ```should_panic +/// panic!() +/// ``` +/// ```ignore (incomplete-code) +/// fn foo() { +/// ``` +/// ```no_run +/// loop { +/// println!("Hello, world"); +/// } +/// ``` +/// fails to compile +/// ```compile_fail +/// let x = 5; +/// x += 2; // shouldn't compile! +/// ``` + +pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/test-type.stdout b/tests/rustdoc-ui/doctest/test-type.stdout new file mode 100644 index 000000000..a66fd240d --- /dev/null +++ b/tests/rustdoc-ui/doctest/test-type.stdout @@ -0,0 +1,10 @@ + +running 5 tests +test $DIR/test-type.rs - f (line 12) ... ignored +test $DIR/test-type.rs - f (line 15) - compile ... ok +test $DIR/test-type.rs - f (line 21) - compile fail ... ok +test $DIR/test-type.rs - f (line 6) ... ok +test $DIR/test-type.rs - f (line 9) ... ok + +test result: ok. 4 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/unparseable-doc-test.rs b/tests/rustdoc-ui/doctest/unparseable-doc-test.rs new file mode 100644 index 000000000..fd8b2094d --- /dev/null +++ b/tests/rustdoc-ui/doctest/unparseable-doc-test.rs @@ -0,0 +1,11 @@ +// compile-flags: --test +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +// failure-status: 101 +// rustc-env: RUST_BACKTRACE=0 + +/// ```rust +/// let x = 7; +/// "unterminated +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc-ui/doctest/unparseable-doc-test.stdout b/tests/rustdoc-ui/doctest/unparseable-doc-test.stdout new file mode 100644 index 000000000..2641c66f2 --- /dev/null +++ b/tests/rustdoc-ui/doctest/unparseable-doc-test.stdout @@ -0,0 +1,23 @@ + +running 1 test +test $DIR/unparseable-doc-test.rs - foo (line 7) ... FAILED + +failures: + +---- $DIR/unparseable-doc-test.rs - foo (line 7) stdout ---- +error[E0765]: unterminated double quote string + --> $DIR/unparseable-doc-test.rs:9:1 + | +LL | "unterminated + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0765`. +Couldn't compile the test. + +failures: + $DIR/unparseable-doc-test.rs - foo (line 7) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs new file mode 100644 index 000000000..e49fe0798 --- /dev/null +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs @@ -0,0 +1,9 @@ +// check-pass + +pub fn f() -> impl Sized { + pub enum E { + V(E), + } + + unimplemented!() +} diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs new file mode 100644 index 000000000..939da186f --- /dev/null +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs @@ -0,0 +1,14 @@ +// normalize-stderr-test: "`.*`" -> "`DEF_ID`" +// normalize-stdout-test: "`.*`" -> "`DEF_ID`" +// edition:2018 + +pub async fn f() -> impl std::fmt::Debug { + #[derive(Debug)] + enum E { //~ ERROR + This(E), + Unit, + } + E::Unit +} + +fn main() {} diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.stderr b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.stderr new file mode 100644 index 000000000..aff7402bc --- /dev/null +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.stderr @@ -0,0 +1,16 @@ +error[E0072]: recursive type `DEF_ID` has infinite size + --> $DIR/infinite-recursive-type-impl-trait-return.rs:7:5 + | +LL | enum E { + | ^^^^^^ +LL | This(E), + | - recursive without indirection + | +help: insert some indirection (e.g., a `DEF_ID`) to break the cycle + | +LL | This(Box), + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `DEF_ID`. diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs new file mode 100644 index 000000000..096130d77 --- /dev/null +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs @@ -0,0 +1,9 @@ +// check-pass + +fn f() -> impl Sized { + enum E { + V(E), + } + + unimplemented!() +} diff --git a/tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs b/tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs deleted file mode 100644 index 0901ac364..000000000 --- a/tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs +++ /dev/null @@ -1,157 +0,0 @@ -// check-pass -#![feature(lint_reasons)] - -//! This file tests the `#[expect]` attribute implementation for tool lints. The same -//! file is used to test clippy and rustdoc. Any changes to this file should be synced -//! to the other test files as well. -//! -//! Expectations: -//! * rustc: only rustc lint expectations are emitted -//! * clippy: rustc and Clippy's expectations are emitted -//! * rustdoc: only rustdoc lint expectations are emitted -//! -//! This test can't cover every lint from Clippy, rustdoc and potentially other -//! tools that will be developed. This therefore only tests a small subset of lints - -#![expect(rustdoc::missing_crate_level_docs)] -//~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations] -//~| NOTE `#[warn(unfulfilled_lint_expectations)]` on by default - -mod rustc_ok { - //! See - - #[expect(dead_code)] - pub fn rustc_lints() { - let x = 42.0; - - #[expect(illegal_floating_point_literal_pattern)] - match x { - 5.0 => {} - 6.0 => {} - _ => {} - } - } -} - -mod rustc_warn { - //! See - - #[expect(dead_code)] - pub fn rustc_lints() { - let x = 42; - - #[expect(illegal_floating_point_literal_pattern)] - match x { - 5 => {} - 6 => {} - _ => {} - } - } -} - -pub mod rustdoc_ok { - //! See - - #[expect(rustdoc::broken_intra_doc_links)] - /// I want to link to [`Nonexistent`] but it doesn't exist! - pub fn foo() {} - - #[expect(rustdoc::invalid_html_tags)] - ///

- pub fn bar() {} - - #[expect(rustdoc::bare_urls)] - /// http://example.org - pub fn baz() {} -} - -pub mod rustdoc_warn { - //! See - - #[expect(rustdoc::broken_intra_doc_links)] - //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations] - /// I want to link to [`bar`] but it doesn't exist! - pub fn foo() {} - - #[expect(rustdoc::invalid_html_tags)] - //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations] - ///

- pub fn bar() {} - - #[expect(rustdoc::bare_urls)] - //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations] - /// - pub fn baz() {} -} - -mod clippy_ok { - //! See - - #[expect(clippy::almost_swapped)] - fn foo() { - let mut a = 0; - let mut b = 9; - a = b; - b = a; - } - - #[expect(clippy::bytes_nth)] - fn bar() { - let _ = "Hello".bytes().nth(3); - } - - #[expect(clippy::if_same_then_else)] - fn baz() { - let _ = if true { - 42 - } else { - 42 - }; - } - - #[expect(clippy::logic_bug)] - fn burger() { - let a = false; - let b = true; - - if a && b || a {} - } -} - -mod clippy_warn { - //! See - - #[expect(clippy::almost_swapped)] - fn foo() { - let mut a = 0; - let mut b = 9; - a = b; - } - - #[expect(clippy::bytes_nth)] - fn bar() { - let _ = "Hello".as_bytes().get(3); - } - - #[expect(clippy::if_same_then_else)] - fn baz() { - let _ = if true { - 33 - } else { - 42 - }; - } - - #[expect(clippy::logic_bug)] - fn burger() { - let a = false; - let b = true; - let c = false; - - if a && b || c {} - } -} - -fn main() { - rustc_warn::rustc_lints(); -} diff --git a/tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr b/tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr deleted file mode 100644 index efc5f349f..000000000 --- a/tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr +++ /dev/null @@ -1,28 +0,0 @@ -warning: this lint expectation is unfulfilled - --> $DIR/expect-tool-lint-rfc-2383.rs:16:11 - | -LL | #![expect(rustdoc::missing_crate_level_docs)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unfulfilled_lint_expectations)]` on by default - -warning: this lint expectation is unfulfilled - --> $DIR/expect-tool-lint-rfc-2383.rs:71:14 - | -LL | #[expect(rustdoc::broken_intra_doc_links)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: this lint expectation is unfulfilled - --> $DIR/expect-tool-lint-rfc-2383.rs:76:14 - | -LL | #[expect(rustdoc::invalid_html_tags)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: this lint expectation is unfulfilled - --> $DIR/expect-tool-lint-rfc-2383.rs:81:14 - | -LL | #[expect(rustdoc::bare_urls)] - | ^^^^^^^^^^^^^^^^^^ - -warning: 4 warnings emitted - diff --git a/tests/rustdoc-ui/failed-doctest-compile-fail.rs b/tests/rustdoc-ui/failed-doctest-compile-fail.rs deleted file mode 100644 index 4dfca600f..000000000 --- a/tests/rustdoc-ui/failed-doctest-compile-fail.rs +++ /dev/null @@ -1,12 +0,0 @@ -// FIXME: if/when the output of the test harness can be tested on its own, this test should be -// adapted to use that, and that normalize line can go away - -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 - -/// ```compile_fail -/// println!("Hello"); -/// ``` -pub struct Foo; diff --git a/tests/rustdoc-ui/failed-doctest-compile-fail.stdout b/tests/rustdoc-ui/failed-doctest-compile-fail.stdout deleted file mode 100644 index af3a90a74..000000000 --- a/tests/rustdoc-ui/failed-doctest-compile-fail.stdout +++ /dev/null @@ -1,14 +0,0 @@ - -running 1 test -test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) - compile fail ... FAILED - -failures: - ----- $DIR/failed-doctest-compile-fail.rs - Foo (line 9) stdout ---- -Test compiled successfully, but it's marked `compile_fail`. - -failures: - $DIR/failed-doctest-compile-fail.rs - Foo (line 9) - -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs b/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs deleted file mode 100644 index 03a5b9d5d..000000000 --- a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs +++ /dev/null @@ -1,18 +0,0 @@ -// FIXME: if/when the output of the test harness can be tested on its own, this test should be -// adapted to use that, and that normalize line can go away - -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 - -/// -/// -/// ```rust -/// struct S {}; // unexpected semicolon after struct def -/// -/// fn main() { -/// assert_eq!(0, 1); -/// } -/// ``` -mod m {} diff --git a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.stdout b/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.stdout deleted file mode 100644 index 61468b6c7..000000000 --- a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.stdout +++ /dev/null @@ -1,24 +0,0 @@ - -running 1 test -test $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) ... FAILED - -failures: - ----- $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) stdout ---- -error: expected item, found `;` - --> $DIR/failed-doctest-extra-semicolon-on-item.rs:12:12 - | -LL | struct S {}; // unexpected semicolon after struct def - | ^ help: remove this semicolon - | - = help: braced struct declarations are not followed by a semicolon - -error: aborting due to previous error - -Couldn't compile the test. - -failures: - $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) - -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/failed-doctest-missing-codes.rs b/tests/rustdoc-ui/failed-doctest-missing-codes.rs deleted file mode 100644 index 66a229a0c..000000000 --- a/tests/rustdoc-ui/failed-doctest-missing-codes.rs +++ /dev/null @@ -1,12 +0,0 @@ -// FIXME: if/when the output of the test harness can be tested on its own, this test should be -// adapted to use that, and that normalize line can go away - -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 - -/// ```compile_fail,E0004 -/// let x: () = 5i32; -/// ``` -pub struct Foo; diff --git a/tests/rustdoc-ui/failed-doctest-missing-codes.stdout b/tests/rustdoc-ui/failed-doctest-missing-codes.stdout deleted file mode 100644 index bacbb47b5..000000000 --- a/tests/rustdoc-ui/failed-doctest-missing-codes.stdout +++ /dev/null @@ -1,25 +0,0 @@ - -running 1 test -test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) - compile fail ... FAILED - -failures: - ----- $DIR/failed-doctest-missing-codes.rs - Foo (line 9) stdout ---- -error[E0308]: mismatched types - --> $DIR/failed-doctest-missing-codes.rs:10:13 - | -LL | let x: () = 5i32; - | -- ^^^^ expected `()`, found `i32` - | | - | expected due to this - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. -Some expected error codes were not found: ["E0004"] - -failures: - $DIR/failed-doctest-missing-codes.rs - Foo (line 9) - -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/failed-doctest-output-windows.rs b/tests/rustdoc-ui/failed-doctest-output-windows.rs deleted file mode 100644 index 456a9e68f..000000000 --- a/tests/rustdoc-ui/failed-doctest-output-windows.rs +++ /dev/null @@ -1,28 +0,0 @@ -// only-windows -// There's a parallel generic version of this test for non-windows platforms. - -// Issue #51162: A failed doctest was not printing its stdout/stderr -// FIXME: if/when the output of the test harness can be tested on its own, this test should be -// adapted to use that, and that normalize line can go away - -// compile-flags:--test --test-args --test-threads=1 -// rustc-env:RUST_BACKTRACE=0 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 - -// doctest fails at runtime -/// ``` -/// println!("stdout 1"); -/// eprintln!("stderr 1"); -/// println!("stdout 2"); -/// eprintln!("stderr 2"); -/// panic!("oh no"); -/// ``` -pub struct SomeStruct; - -// doctest fails at compile time -/// ``` -/// no -/// ``` -pub struct OtherStruct; diff --git a/tests/rustdoc-ui/failed-doctest-output-windows.stdout b/tests/rustdoc-ui/failed-doctest-output-windows.stdout deleted file mode 100644 index 6c147054d..000000000 --- a/tests/rustdoc-ui/failed-doctest-output-windows.stdout +++ /dev/null @@ -1,39 +0,0 @@ - -running 2 tests -test $DIR/failed-doctest-output-windows.rs - OtherStruct (line 25) ... FAILED -test $DIR/failed-doctest-output-windows.rs - SomeStruct (line 15) ... FAILED - -failures: - ----- $DIR/failed-doctest-output-windows.rs - OtherStruct (line 25) stdout ---- -error[E0425]: cannot find value `no` in this scope - --> $DIR/failed-doctest-output-windows.rs:26:1 - | -LL | no - | ^^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0425`. -Couldn't compile the test. ----- $DIR/failed-doctest-output-windows.rs - SomeStruct (line 15) stdout ---- -Test executable failed (exit code: 101). - -stdout: -stdout 1 -stdout 2 - -stderr: -stderr 1 -stderr 2 -thread 'main' panicked at 'oh no', $DIR/failed-doctest-output-windows.rs:7:1 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - - - -failures: - $DIR/failed-doctest-output-windows.rs - OtherStruct (line 25) - $DIR/failed-doctest-output-windows.rs - SomeStruct (line 15) - -test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/failed-doctest-output.rs b/tests/rustdoc-ui/failed-doctest-output.rs deleted file mode 100644 index 77647f8ec..000000000 --- a/tests/rustdoc-ui/failed-doctest-output.rs +++ /dev/null @@ -1,28 +0,0 @@ -// ignore-windows -// There's a parallel version of this test for Windows. - -// Issue #51162: A failed doctest was not printing its stdout/stderr -// FIXME: if/when the output of the test harness can be tested on its own, this test should be -// adapted to use that, and that normalize line can go away - -// compile-flags:--test --test-args --test-threads=1 -// rustc-env:RUST_BACKTRACE=0 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 - -// doctest fails at runtime -/// ``` -/// println!("stdout 1"); -/// eprintln!("stderr 1"); -/// println!("stdout 2"); -/// eprintln!("stderr 2"); -/// panic!("oh no"); -/// ``` -pub struct SomeStruct; - -// doctest fails at compile time -/// ``` -/// no -/// ``` -pub struct OtherStruct; diff --git a/tests/rustdoc-ui/failed-doctest-output.stdout b/tests/rustdoc-ui/failed-doctest-output.stdout deleted file mode 100644 index 630198a56..000000000 --- a/tests/rustdoc-ui/failed-doctest-output.stdout +++ /dev/null @@ -1,39 +0,0 @@ - -running 2 tests -test $DIR/failed-doctest-output.rs - OtherStruct (line 25) ... FAILED -test $DIR/failed-doctest-output.rs - SomeStruct (line 15) ... FAILED - -failures: - ----- $DIR/failed-doctest-output.rs - OtherStruct (line 25) stdout ---- -error[E0425]: cannot find value `no` in this scope - --> $DIR/failed-doctest-output.rs:26:1 - | -LL | no - | ^^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0425`. -Couldn't compile the test. ----- $DIR/failed-doctest-output.rs - SomeStruct (line 15) stdout ---- -Test executable failed (exit status: 101). - -stdout: -stdout 1 -stdout 2 - -stderr: -stderr 1 -stderr 2 -thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:7:1 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - - - -failures: - $DIR/failed-doctest-output.rs - OtherStruct (line 25) - $DIR/failed-doctest-output.rs - SomeStruct (line 15) - -test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/failed-doctest-should-panic.rs b/tests/rustdoc-ui/failed-doctest-should-panic.rs deleted file mode 100644 index c134f8006..000000000 --- a/tests/rustdoc-ui/failed-doctest-should-panic.rs +++ /dev/null @@ -1,12 +0,0 @@ -// FIXME: if/when the output of the test harness can be tested on its own, this test should be -// adapted to use that, and that normalize line can go away - -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 - -/// ```should_panic -/// println!("Hello, world!"); -/// ``` -pub struct Foo; diff --git a/tests/rustdoc-ui/failed-doctest-should-panic.stdout b/tests/rustdoc-ui/failed-doctest-should-panic.stdout deleted file mode 100644 index 57a20092a..000000000 --- a/tests/rustdoc-ui/failed-doctest-should-panic.stdout +++ /dev/null @@ -1,14 +0,0 @@ - -running 1 test -test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED - -failures: - ----- $DIR/failed-doctest-should-panic.rs - Foo (line 9) stdout ---- -Test executable succeeded, but it's marked `should_panic`. - -failures: - $DIR/failed-doctest-should-panic.rs - Foo (line 9) - -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.rs b/tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.rs deleted file mode 100644 index c34ea0567..000000000 --- a/tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![deny(unknown_lints)] -//~^ NOTE defined here -#![allow(rustdoc::missing_doc_code_examples)] -//~^ ERROR unknown lint -//~| ERROR unknown lint -//~| ERROR unknown lint -//~| NOTE lint is unstable -//~| NOTE lint is unstable -//~| NOTE lint is unstable -//~| NOTE see issue -//~| NOTE see issue -//~| NOTE see issue diff --git a/tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.stderr b/tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.stderr deleted file mode 100644 index 326dcfe3b..000000000 --- a/tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error: unknown lint: `rustdoc::missing_doc_code_examples` - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1 - | -LL | #![allow(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: the `rustdoc::missing_doc_code_examples` lint is unstable - = note: see issue #101730 for more information - = help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable -note: the lint level is defined here - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:1:9 - | -LL | #![deny(unknown_lints)] - | ^^^^^^^^^^^^^ - -error: unknown lint: `rustdoc::missing_doc_code_examples` - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1 - | -LL | #![allow(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: the `rustdoc::missing_doc_code_examples` lint is unstable - = note: see issue #101730 for more information - = help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable - -error: unknown lint: `rustdoc::missing_doc_code_examples` - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1 - | -LL | #![allow(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: the `rustdoc::missing_doc_code_examples` lint is unstable - = note: see issue #101730 for more information - = help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable - -error: aborting due to 3 previous errors - diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt-unstable.rs b/tests/rustdoc-ui/generate-link-to-definition-opt-unstable.rs deleted file mode 100644 index 87620d74e..000000000 --- a/tests/rustdoc-ui/generate-link-to-definition-opt-unstable.rs +++ /dev/null @@ -1,6 +0,0 @@ -// This test purpose is to check that the "--generate-link-to-definition" -// option can only be used on nightly. - -// compile-flags: --generate-link-to-definition - -pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt-unstable.stderr b/tests/rustdoc-ui/generate-link-to-definition-opt-unstable.stderr deleted file mode 100644 index a8ddf91bc..000000000 --- a/tests/rustdoc-ui/generate-link-to-definition-opt-unstable.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: the `-Z unstable-options` flag must also be passed to enable the flag `generate-link-to-definition` - diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt.rs b/tests/rustdoc-ui/generate-link-to-definition-opt.rs deleted file mode 100644 index 8f4f561b4..000000000 --- a/tests/rustdoc-ui/generate-link-to-definition-opt.rs +++ /dev/null @@ -1,6 +0,0 @@ -// This test purpose is to check that the "--generate-link-to-definition" -// option can only be used with HTML generation. - -// compile-flags: -Zunstable-options --generate-link-to-definition --output-format json - -pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt.stderr b/tests/rustdoc-ui/generate-link-to-definition-opt.stderr deleted file mode 100644 index 4c8c607e7..000000000 --- a/tests/rustdoc-ui/generate-link-to-definition-opt.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: --generate-link-to-definition option can only be used with HTML output format - diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt2.rs b/tests/rustdoc-ui/generate-link-to-definition-opt2.rs deleted file mode 100644 index da5142087..000000000 --- a/tests/rustdoc-ui/generate-link-to-definition-opt2.rs +++ /dev/null @@ -1,6 +0,0 @@ -// This test purpose is to check that the "--generate-link-to-definition" -// option can only be used with HTML generation. - -// compile-flags: -Zunstable-options --generate-link-to-definition --show-coverage - -pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt2.stderr b/tests/rustdoc-ui/generate-link-to-definition-opt2.stderr deleted file mode 100644 index 4c8c607e7..000000000 --- a/tests/rustdoc-ui/generate-link-to-definition-opt2.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: --generate-link-to-definition option can only be used with HTML output format - diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs new file mode 100644 index 000000000..87620d74e --- /dev/null +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs @@ -0,0 +1,6 @@ +// This test purpose is to check that the "--generate-link-to-definition" +// option can only be used on nightly. + +// compile-flags: --generate-link-to-definition + +pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.stderr b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.stderr new file mode 100644 index 000000000..a8ddf91bc --- /dev/null +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.stderr @@ -0,0 +1,2 @@ +error: the `-Z unstable-options` flag must also be passed to enable the flag `generate-link-to-definition` + diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs new file mode 100644 index 000000000..8f4f561b4 --- /dev/null +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs @@ -0,0 +1,6 @@ +// This test purpose is to check that the "--generate-link-to-definition" +// option can only be used with HTML generation. + +// compile-flags: -Zunstable-options --generate-link-to-definition --output-format json + +pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr new file mode 100644 index 000000000..4c8c607e7 --- /dev/null +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr @@ -0,0 +1,2 @@ +error: --generate-link-to-definition option can only be used with HTML output format + diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs new file mode 100644 index 000000000..da5142087 --- /dev/null +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs @@ -0,0 +1,6 @@ +// This test purpose is to check that the "--generate-link-to-definition" +// option can only be used with HTML generation. + +// compile-flags: -Zunstable-options --generate-link-to-definition --show-coverage + +pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr new file mode 100644 index 000000000..4c8c607e7 --- /dev/null +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr @@ -0,0 +1,2 @@ +error: --generate-link-to-definition option can only be used with HTML output format + diff --git a/tests/rustdoc-ui/ice-bug-report-url.rs b/tests/rustdoc-ui/ice-bug-report-url.rs new file mode 100644 index 000000000..8ede91cf8 --- /dev/null +++ b/tests/rustdoc-ui/ice-bug-report-url.rs @@ -0,0 +1,14 @@ +// compile-flags: -Ztreat-err-as-bug +// failure-status: 101 +// error-pattern: aborting due to +// error-pattern: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md + +// normalize-stderr-test "note: compiler flags.*\n\n" -> "" +// normalize-stderr-test "note: rustc.*running on.*" -> "note: rustc {version} running on {platform}" +// normalize-stderr-test "thread.*panicked at .*, compiler.*" -> "thread panicked at 'aborting due to `-Z treat-err-as-bug`'" +// normalize-stderr-test " +\d{1,}: .*\n" -> "" +// normalize-stderr-test " + at .*\n" -> "" +// normalize-stderr-test ".*note: Some details are omitted.*\n" -> "" + +fn wrong() +//~^ ERROR expected one of diff --git a/tests/rustdoc-ui/ice-bug-report-url.stderr b/tests/rustdoc-ui/ice-bug-report-url.stderr new file mode 100644 index 000000000..98c08b9a8 --- /dev/null +++ b/tests/rustdoc-ui/ice-bug-report-url.stderr @@ -0,0 +1,17 @@ +error: expected one of `->`, `where`, or `{`, found `` + --> $DIR/ice-bug-report-url.rs:13:10 + | +LL | fn wrong() + | ^ expected one of `->`, `where`, or `{` + +thread panicked at 'aborting due to `-Z treat-err-as-bug`' +stack backtrace: + +error: the compiler unexpectedly panicked. this is a bug. + +note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md + +note: rustc {version} running on {platform} + +query stack during panic: +end of query stack diff --git a/tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.rs b/tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.rs deleted file mode 100644 index 939da186f..000000000 --- a/tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.rs +++ /dev/null @@ -1,14 +0,0 @@ -// normalize-stderr-test: "`.*`" -> "`DEF_ID`" -// normalize-stdout-test: "`.*`" -> "`DEF_ID`" -// edition:2018 - -pub async fn f() -> impl std::fmt::Debug { - #[derive(Debug)] - enum E { //~ ERROR - This(E), - Unit, - } - E::Unit -} - -fn main() {} diff --git a/tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.stderr b/tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.stderr deleted file mode 100644 index aff7402bc..000000000 --- a/tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0072]: recursive type `DEF_ID` has infinite size - --> $DIR/infinite-recursive-type-impl-trait-return.rs:7:5 - | -LL | enum E { - | ^^^^^^ -LL | This(E), - | - recursive without indirection - | -help: insert some indirection (e.g., a `DEF_ID`) to break the cycle - | -LL | This(Box), - | ++++ + - -error: aborting due to previous error - -For more information about this error, try `DEF_ID`. diff --git a/tests/rustdoc-ui/infinite-recursive-type-impl-trait.rs b/tests/rustdoc-ui/infinite-recursive-type-impl-trait.rs deleted file mode 100644 index ac5172574..000000000 --- a/tests/rustdoc-ui/infinite-recursive-type-impl-trait.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn f() -> impl Sized { - enum E { //~ ERROR - V(E), - } - unimplemented!() -} diff --git a/tests/rustdoc-ui/infinite-recursive-type-impl-trait.stderr b/tests/rustdoc-ui/infinite-recursive-type-impl-trait.stderr deleted file mode 100644 index a61577bd1..000000000 --- a/tests/rustdoc-ui/infinite-recursive-type-impl-trait.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0072]: recursive type `f::E` has infinite size - --> $DIR/infinite-recursive-type-impl-trait.rs:2:5 - | -LL | enum E { - | ^^^^^^ -LL | V(E), - | - recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle - | -LL | V(Box), - | ++++ + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0072`. diff --git a/tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.rs b/tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.rs new file mode 100644 index 000000000..0976515f4 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.rs @@ -0,0 +1,22 @@ +#![deny(rustdoc::broken_intra_doc_links)] + +#[derive(Debug)] +/// Link to [`S::fmt`] +//~^ ERROR unresolved link +pub struct S; + +pub mod inner { + use std::fmt::Debug; + use super::S; + + /// Link to [`S::fmt`] + pub fn f() {} +} + +pub mod ambiguous { + use std::fmt::{Display, Debug}; + use super::S; + + /// Link to [`S::fmt`] + pub fn f() {} +} diff --git a/tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.stderr b/tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.stderr new file mode 100644 index 000000000..04594ad41 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.stderr @@ -0,0 +1,14 @@ +error: unresolved link to `S::fmt` + --> $DIR/assoc-item-not-in-scope.rs:4:15 + | +LL | /// Link to [`S::fmt`] + | ^^^^^^ the struct `S` has no field or associated item named `fmt` + | +note: the lint level is defined here + --> $DIR/assoc-item-not-in-scope.rs:1:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs b/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs deleted file mode 100644 index 6c48f5aa0..000000000 --- a/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub enum O { - L = -1, -} diff --git a/tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.rs b/tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.rs new file mode 100644 index 000000000..09da124b1 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.rs @@ -0,0 +1,4 @@ +#![deny(rustdoc::broken_intra_doc_links)] + +/// [v2] //~ ERROR +pub fn foo() {} diff --git a/tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.stderr b/tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.stderr new file mode 100644 index 000000000..3e08354a6 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.stderr @@ -0,0 +1,15 @@ +error: unresolved link to `v2` + --> $DIR/deny-intra-link-resolution-failure.rs:3:6 + | +LL | /// [v2] + | ^^ no item named `v2` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` +note: the lint level is defined here + --> $DIR/deny-intra-link-resolution-failure.rs:1:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/intra-doc/inline-external-enum.rs b/tests/rustdoc-ui/intra-doc/inline-external-enum.rs deleted file mode 100644 index 363dd7f64..000000000 --- a/tests/rustdoc-ui/intra-doc/inline-external-enum.rs +++ /dev/null @@ -1,8 +0,0 @@ -// check-pass -// aux-build: inner-crate-enum.rs -// compile-flags:-Z unstable-options --output-format json - -#[doc(inline)] -pub extern crate inner_crate_enum; - -fn main() {} diff --git a/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs b/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs new file mode 100644 index 000000000..ef9c56f75 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs @@ -0,0 +1,6 @@ +// this test used to ICE +#![deny(rustdoc::broken_intra_doc_links)] +//! [Clone ()]. //~ ERROR unresolved +//! [Clone !]. //~ ERROR incompatible +//! [`Clone ()`]. //~ ERROR unresolved +//! [`Clone !`]. //~ ERROR incompatible diff --git a/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr b/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr new file mode 100644 index 000000000..6c834fd0a --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr @@ -0,0 +1,55 @@ +error: unresolved link to `Clone` + --> $DIR/issue-110495-suffix-with-space.rs:3:6 + | +LL | //! [Clone ()]. + | ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +note: the lint level is defined here + --> $DIR/issue-110495-suffix-with-space.rs:2:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: to link to the trait, prefix with `trait@` + | +LL - //! [Clone ()]. +LL + //! [trait@Clone ]. + | + +error: incompatible link kind for `Clone` + --> $DIR/issue-110495-suffix-with-space.rs:4:6 + | +LL | //! [Clone !]. + | ^^^^^^^ this link resolved to a derive macro, which is not a macro + | +help: to link to the derive macro, prefix with `derive@` + | +LL - //! [Clone !]. +LL + //! [derive@Clone ]. + | + +error: unresolved link to `Clone` + --> $DIR/issue-110495-suffix-with-space.rs:5:7 + | +LL | //! [`Clone ()`]. + | ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - //! [`Clone ()`]. +LL + //! [`trait@Clone `]. + | + +error: incompatible link kind for `Clone` + --> $DIR/issue-110495-suffix-with-space.rs:6:7 + | +LL | //! [`Clone !`]. + | ^^^^^^^ this link resolved to a derive macro, which is not a macro + | +help: to link to the derive macro, prefix with `derive@` + | +LL - //! [`Clone !`]. +LL + //! [`derive@Clone `]. + | + +error: aborting due to 4 previous errors + diff --git a/tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.rs b/tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.rs new file mode 100644 index 000000000..4e74278dc --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.rs @@ -0,0 +1,10 @@ +// Regression test for . +// This test ensures that it doesn't crash. + +#![deny(warnings)] + +/// #[rustfmt::skip] +//~^ ERROR unresolved link to `rustfmt::skip` +/// #[clippy::whatever] +//~^ ERROR unresolved link to `clippy::whatever` +pub fn foo() {} diff --git a/tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.stderr b/tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.stderr new file mode 100644 index 000000000..edd3dfa7d --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.stderr @@ -0,0 +1,21 @@ +error: unresolved link to `rustfmt::skip` + --> $DIR/issue-111189-resolution-ice.rs:6:7 + | +LL | /// #[rustfmt::skip] + | ^^^^^^^^^^^^^ no item named `rustfmt` in scope + | +note: the lint level is defined here + --> $DIR/issue-111189-resolution-ice.rs:4:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]` + +error: unresolved link to `clippy::whatever` + --> $DIR/issue-111189-resolution-ice.rs:8:7 + | +LL | /// #[clippy::whatever] + | ^^^^^^^^^^^^^^^^ no item named `clippy` in scope + +error: aborting due to 2 previous errors + diff --git a/tests/rustdoc-ui/intra-doc/pub-export-lint.rs b/tests/rustdoc-ui/intra-doc/pub-export-lint.rs new file mode 100644 index 000000000..f2e66b77b --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/pub-export-lint.rs @@ -0,0 +1,5 @@ +#![deny(rustdoc::broken_intra_doc_links)] + +/// [aloha] +//~^ ERROR unresolved link to `aloha` +pub use std::task::RawWakerVTable; diff --git a/tests/rustdoc-ui/intra-doc/pub-export-lint.stderr b/tests/rustdoc-ui/intra-doc/pub-export-lint.stderr new file mode 100644 index 000000000..81ef79961 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/pub-export-lint.stderr @@ -0,0 +1,15 @@ +error: unresolved link to `aloha` + --> $DIR/pub-export-lint.rs:3:6 + | +LL | /// [aloha] + | ^^^^^ no item named `aloha` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` +note: the lint level is defined here + --> $DIR/pub-export-lint.rs:1:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.rs b/tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.rs new file mode 100644 index 000000000..71bd2c522 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.rs @@ -0,0 +1,20 @@ +#![deny(rustdoc::broken_intra_doc_links)] + +/// Links to [a] [link][a] +/// And also a [third link][a] +/// And also a [reference link][b] +/// +/// Other links to the same target should still emit error: [ref] //~ERROR unresolved link to `ref` +/// Duplicate [ref] //~ERROR unresolved link to `ref` +/// +/// Other links to other targets should still emit error: [ref2] //~ERROR unresolved link to `ref2` +/// Duplicate [ref2] //~ERROR unresolved link to `ref2` +/// +/// [a]: ref +//~^ ERROR unresolved link to `ref` +/// [b]: ref2 +//~^ ERROR unresolved link to + +/// [ref][] +//~^ ERROR unresolved link +pub fn f() {} diff --git a/tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.stderr b/tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.stderr new file mode 100644 index 000000000..2ab67090f --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.stderr @@ -0,0 +1,63 @@ +error: unresolved link to `ref` + --> $DIR/reference-link-reports-error-once.rs:13:10 + | +LL | /// [a]: ref + | ^^^ no item named `ref` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` +note: the lint level is defined here + --> $DIR/reference-link-reports-error-once.rs:1:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unresolved link to `ref2` + --> $DIR/reference-link-reports-error-once.rs:15:10 + | +LL | /// [b]: ref2 + | ^^^^ no item named `ref2` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `ref` + --> $DIR/reference-link-reports-error-once.rs:7:62 + | +LL | /// Other links to the same target should still emit error: [ref] + | ^^^ no item named `ref` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `ref` + --> $DIR/reference-link-reports-error-once.rs:8:16 + | +LL | /// Duplicate [ref] + | ^^^ no item named `ref` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `ref2` + --> $DIR/reference-link-reports-error-once.rs:10:60 + | +LL | /// Other links to other targets should still emit error: [ref2] + | ^^^^ no item named `ref2` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `ref2` + --> $DIR/reference-link-reports-error-once.rs:11:16 + | +LL | /// Duplicate [ref2] + | ^^^^ no item named `ref2` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `ref` + --> $DIR/reference-link-reports-error-once.rs:18:6 + | +LL | /// [ref][] + | ^^^ no item named `ref` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: aborting due to 7 previous errors + diff --git a/tests/rustdoc-ui/intra-doc/reference-links.rs b/tests/rustdoc-ui/intra-doc/reference-links.rs new file mode 100644 index 000000000..e81e03446 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/reference-links.rs @@ -0,0 +1,6 @@ +// Test that errors point to the reference, not to the title text. +#![deny(rustdoc::broken_intra_doc_links)] +//! Links to [a] [link][a] +//! +//! [a]: std::process::Comman +//~^ ERROR unresolved diff --git a/tests/rustdoc-ui/intra-doc/reference-links.stderr b/tests/rustdoc-ui/intra-doc/reference-links.stderr new file mode 100644 index 000000000..c98a2fd7c --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/reference-links.stderr @@ -0,0 +1,14 @@ +error: unresolved link to `std::process::Comman` + --> $DIR/reference-links.rs:5:10 + | +LL | //! [a]: std::process::Comman + | ^^^^^^^^^^^^^^^^^^^^ no item named `Comman` in module `process` + | +note: the lint level is defined here + --> $DIR/reference-links.rs:2:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.rs b/tests/rustdoc-ui/intra-doc/weird-syntax.rs new file mode 100644 index 000000000..ca18842fb --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/weird-syntax.rs @@ -0,0 +1,140 @@ +// Many examples are from +// https://github.com/rust-lang/rust/issues/110111#issuecomment-1517800781 +#![deny(rustdoc::broken_intra_doc_links)] + +//! This test case is closely linked to [raphlinus/pulldown-cmark#441], getting offsets of +//! link components. In particular, pulldown-cmark doesn't provide the offsets of the contents +//! of a link. +//! +//! To work around this, rustdoc parses parts of a link definition itself. This is basically a +//! test suite for that link syntax parser. +//! +//! [raphlinus/pulldown-cmark#441]: https://github.com/raphlinus/pulldown-cmark/issues/441 + +use std::clone::Clone; + +// Basic version // + +/// [`struct@Clone`] //~ERROR link +pub struct LinkToCloneWithBackquotes; + +/// [```struct@Clone```] //~ERROR link +pub struct LinkToCloneWithMultipleBackquotes; + +/// [ ` struct@Clone ` ] //~ERROR link +pub struct LinkToCloneWithSpacesAndBackquotes; + +/// [ `Clone ()` ] //~ERROR link +pub struct LinkToCloneWithSpacesBackquotesAndParens; + +/// [`Clone ()` ] //~ERROR link +pub struct LinkToCloneWithSpacesEndBackquotesAndParens; + +/// [ `Clone ()`] //~ERROR link +pub struct LinkToCloneWithSpacesStartBackquotesAndParens; + +/// [```Clone ()```] //~ERROR link +pub struct LinkToCloneWithMultipleBackquotesAndParens; + +/// [```Clone \(\)```] // not URL-shaped enough +pub struct LinkToCloneWithMultipleBackquotesAndEscapedParens; + +/// [ ``` Clone () ``` ] //~ERROR link +pub struct LinkToCloneWithSpacesMultipleBackquotesAndParens; + +/// [ x \] ] // not URL-shaped enough +pub struct LinkWithEscapedCloseBrace; + +/// [ x \[ ] // not URL-shaped enough +pub struct LinkWithEscapedOpenBrace; + +/// [ x \( ] // not URL-shaped enough +pub struct LinkWithEscapedCloseParen; + +/// [ x \) ] // not URL-shaped enough +pub struct LinkWithEscapedOpenParen; + +/// [ Clone \(\) ] // not URL-shaped enough +pub struct LinkWithEscapedParens; + +// [][] version // + +/// [x][ struct@Clone] //~ERROR link +pub struct XLinkToCloneWithStartSpace; + +/// [x][struct@Clone ] //~ERROR link +pub struct XLinkToCloneWithEndSpace; + +/// [x][Clone\(\)] not URL-shaped enough +pub struct XLinkToCloneWithEscapedParens; + +/// [x][`Clone`] not URL-shaped enough +pub struct XLinkToCloneWithBackquotes; + +/// [x][Clone()] //~ERROR link +pub struct XLinkToCloneWithUnescapedParens; + +/// [x][Clone ()] //~ERROR link +pub struct XLinkToCloneWithUnescapedParensAndDoubleSpace; + +/// [x][Clone [] //~ERROR unresolved link to `x` +pub struct XLinkToCloneWithUnmatchedOpenParenAndDoubleSpace; + +/// [x][Clone \[] // not URL-shaped enough +pub struct XLinkToCloneWithUnmatchedEscapedOpenParenAndDoubleSpace; + +/// [x][Clone \]] // not URL-shaped enough +pub struct XLinkToCloneWithUnmatchedEscapedCloseParenAndDoubleSpace; + +// []() version // + +/// [w]( struct@Clone) //~ERROR link +pub struct WLinkToCloneWithStartSpace; + +/// [w](struct@Clone ) //~ERROR link +pub struct WLinkToCloneWithEndSpace; + +/// [w](Clone\(\)) //~ERROR link +pub struct WLinkToCloneWithEscapedParens; + +/// [w](`Clone`) not URL-shaped enough +pub struct WLinkToCloneWithBackquotes; + +/// [w](Clone()) //~ERROR link +pub struct WLinkToCloneWithUnescapedParens; + +/// [w](Clone ()) not URL-shaped enough +pub struct WLinkToCloneWithUnescapedParensAndDoubleSpace; + +/// [w](Clone () //~ERROR unresolved link to `w` +pub struct WLinkToCloneWithUnmatchedOpenParenAndDoubleSpace; + +/// [w](Clone \() //~ERROR unresolved link to `w` +pub struct WLinkToCloneWithUnmatchedEscapedOpenParenAndDoubleSpace; + +/// [w](Clone \)) //~ERROR unresolved link to `w` +pub struct WLinkToCloneWithUnmatchedEscapedCloseParenAndDoubleSpace; + +// References + +/// The [cln][] link here is going to be unresolved, because `Clone()` gets rejected //~ERROR link +/// in Markdown for not being URL-shaped enough. +/// +/// [cln]: Clone() //~ERROR link +pub struct LinkToCloneWithParensInReference; + +/// The [cln][] link here is going to be unresolved, because `struct@Clone` gets //~ERROR link +/// rejected in Markdown for not being URL-shaped enough. +/// +/// [cln]: struct@Clone //~ERROR link +pub struct LinkToCloneWithWrongPrefix; + +/// The [cln][] link here will produce a plain text suggestion //~ERROR link +/// +/// [cln]: Clone\(\) +pub struct LinkToCloneWithEscapedParensInReference; + +/// The [cln][] link here will produce a plain text suggestion //~ERROR link +/// +/// [cln]: struct\@Clone +pub struct LinkToCloneWithEscapedAtsInReference; diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr new file mode 100644 index 000000000..f50feb57f --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr @@ -0,0 +1,272 @@ +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:18:7 + | +LL | /// [`struct@Clone`] + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +note: the lint level is defined here + --> $DIR/weird-syntax.rs:3:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: to link to the trait, prefix with `trait@` + | +LL | /// [`trait@Clone`] + | ~~~~~~ + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:21:9 + | +LL | /// [```struct@Clone```] + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL | /// [```trait@Clone```] + | ~~~~~~ + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:24:11 + | +LL | /// [ ` struct@Clone ` ] + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL | /// [ ` trait@Clone ` ] + | ~~~~~~ + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:27:9 + | +LL | /// [ `Clone ()` ] + | ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [ `Clone ()` ] +LL + /// [ `trait@Clone ` ] + | + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:30:7 + | +LL | /// [`Clone ()` ] + | ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [`Clone ()` ] +LL + /// [`trait@Clone ` ] + | + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:33:9 + | +LL | /// [ `Clone ()`] + | ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [ `Clone ()`] +LL + /// [ `trait@Clone `] + | + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:36:9 + | +LL | /// [```Clone ()```] + | ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [```Clone ()```] +LL + /// [```trait@Clone ```] + | + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:42:13 + | +LL | /// [ ``` Clone () ``` ] + | ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [ ``` Clone () ``` ] +LL + /// [ ``` trait@Clone ``` ] + | + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:62:10 + | +LL | /// [x][ struct@Clone] + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL | /// [x][ trait@Clone] + | ~~~~~~ + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:65:9 + | +LL | /// [x][struct@Clone ] + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL | /// [x][trait@Clone ] + | ~~~~~~ + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:74:9 + | +LL | /// [x][Clone()] + | ^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [x][Clone()] +LL + /// [x][trait@Clone] + | + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:77:9 + | +LL | /// [x][Clone ()] + | ^^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [x][Clone ()] +LL + /// [x][trait@Clone ] + | + +error: unresolved link to `x` + --> $DIR/weird-syntax.rs:80:6 + | +LL | /// [x][Clone [] + | ^ no item named `x` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:91:10 + | +LL | /// [w]( struct@Clone) + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL | /// [w]( trait@Clone) + | ~~~~~~ + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:94:9 + | +LL | /// [w](struct@Clone ) + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL | /// [w](trait@Clone ) + | ~~~~~~ + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:97:9 + | +LL | /// [w](Clone\(\)) + | ^^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [w](Clone\(\)) +LL + /// [w](trait@Clone) + | + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:103:9 + | +LL | /// [w](Clone()) + | ^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [w](Clone()) +LL + /// [w](trait@Clone) + | + +error: unresolved link to `w` + --> $DIR/weird-syntax.rs:109:6 + | +LL | /// [w](Clone () + | ^ no item named `w` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `w` + --> $DIR/weird-syntax.rs:112:6 + | +LL | /// [w](Clone \() + | ^ no item named `w` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `w` + --> $DIR/weird-syntax.rs:115:6 + | +LL | /// [w](Clone \)) + | ^ no item named `w` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `cln` + --> $DIR/weird-syntax.rs:120:10 + | +LL | /// The [cln][] link here is going to be unresolved, because `Clone()` gets rejected + | ^^^ no item named `cln` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `cln` + --> $DIR/weird-syntax.rs:123:6 + | +LL | /// [cln]: Clone() + | ^^^ no item named `cln` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `cln` + --> $DIR/weird-syntax.rs:126:10 + | +LL | /// The [cln][] link here is going to be unresolved, because `struct@Clone` gets + | ^^^ no item named `cln` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `cln` + --> $DIR/weird-syntax.rs:129:6 + | +LL | /// [cln]: struct@Clone + | ^^^ no item named `cln` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `Clone` + --> $DIR/weird-syntax.rs:132:9 + | +LL | /// The [cln][] link here will produce a plain text suggestion + | ^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace + | + = help: to link to the trait, prefix with `trait@`: trait@Clone + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:137:9 + | +LL | /// The [cln][] link here will produce a plain text suggestion + | ^^^^^ this link resolved to a trait, which is not a struct + | + = help: to link to the trait, prefix with `trait@`: trait@Clone + +error: aborting due to 26 previous errors + diff --git a/tests/rustdoc-ui/invalid-doc-attr.rs b/tests/rustdoc-ui/invalid-doc-attr.rs deleted file mode 100644 index de004b41e..000000000 --- a/tests/rustdoc-ui/invalid-doc-attr.rs +++ /dev/null @@ -1,32 +0,0 @@ -#![crate_type = "lib"] -#![deny(warnings)] - -#[doc(test(no_crate_inject))] -//~^ ERROR can only be applied at the crate level -//~| WARN is being phased out -//~| HELP to apply to the crate, use an inner attribute -//~| SUGGESTION #![doc(test(no_crate_inject))] -#[doc(inline)] -//~^ ERROR can only be applied to a `use` item -//~| WARN is being phased out -pub fn foo() {} - -pub mod bar { - #![doc(test(no_crate_inject))] - //~^ ERROR can only be applied at the crate level - //~| WARN is being phased out - - #[doc(test(no_crate_inject))] - //~^ ERROR can only be applied at the crate level - //~| WARN is being phased out - #[doc(inline)] - //~^ ERROR can only be applied to a `use` item - //~| WARN is being phased out - pub fn baz() {} -} - -#[doc(inline)] -#[doc(no_inline)] -//~^^ ERROR conflicting doc inlining attributes -//~| HELP remove one of the conflicting attributes -pub use bar::baz; diff --git a/tests/rustdoc-ui/invalid-doc-attr.stderr b/tests/rustdoc-ui/invalid-doc-attr.stderr deleted file mode 100644 index 3c66e587b..000000000 --- a/tests/rustdoc-ui/invalid-doc-attr.stderr +++ /dev/null @@ -1,78 +0,0 @@ -error: this attribute can only be applied at the crate level - --> $DIR/invalid-doc-attr.rs:4:7 - | -LL | #[doc(test(no_crate_inject))] - | ^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - = note: read for more information -note: the lint level is defined here - --> $DIR/invalid-doc-attr.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` -help: to apply to the crate, use an inner attribute - | -LL | #![doc(test(no_crate_inject))] - | - -error: this attribute can only be applied to a `use` item - --> $DIR/invalid-doc-attr.rs:9:7 - | -LL | #[doc(inline)] - | ^^^^^^ only applicable on `use` items -... -LL | pub fn foo() {} - | ------------ not a `use` item - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - = note: read for more information - -error: this attribute can only be applied at the crate level - --> $DIR/invalid-doc-attr.rs:15:12 - | -LL | #![doc(test(no_crate_inject))] - | ^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - = note: read for more information - -error: conflicting doc inlining attributes - --> $DIR/invalid-doc-attr.rs:28:7 - | -LL | #[doc(inline)] - | ^^^^^^ this attribute... -LL | #[doc(no_inline)] - | ^^^^^^^^^ ...conflicts with this attribute - | - = help: remove one of the conflicting attributes - -error: this attribute can only be applied at the crate level - --> $DIR/invalid-doc-attr.rs:19:11 - | -LL | #[doc(test(no_crate_inject))] - | ^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - = note: read for more information - -error: this attribute can only be applied to a `use` item - --> $DIR/invalid-doc-attr.rs:22:11 - | -LL | #[doc(inline)] - | ^^^^^^ only applicable on `use` items -... -LL | pub fn baz() {} - | ------------ not a `use` item - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - = note: read for more information - -error: aborting due to 6 previous errors - diff --git a/tests/rustdoc-ui/invalid-html-self-closing-tag.rs b/tests/rustdoc-ui/invalid-html-self-closing-tag.rs deleted file mode 100644 index d973a53cb..000000000 --- a/tests/rustdoc-ui/invalid-html-self-closing-tag.rs +++ /dev/null @@ -1,70 +0,0 @@ -#![deny(rustdoc::invalid_html_tags)] - -///

-//~^ ERROR invalid self-closing HTML tag `p` -pub struct A; - -///

-//~^ ERROR invalid self-closing HTML tag `p` -pub struct B; - -///

-//~^ ERROR invalid self-closing HTML tag `p` -pub struct C; - -///

-//~^ ERROR invalid self-closing HTML tag `p` -pub struct D; - -///

-pub struct G; - -///

-//~^ ERROR invalid self-closing HTML tag `p` -pub struct H; - -///

-//~^ ERROR invalid self-closing HTML tag `p` -pub struct I; - -///
-pub struct J; - -/// -pub struct K; - -/// -pub struct L; - -/// -//~^ ERROR invalid self-closing HTML tag `a` -pub struct M; - -/// -//~^ ERROR invalid self-closing HTML tag `a` -pub struct N; - -/// -//~^ ERROR invalid self-closing HTML tag `a` -pub struct O; - -/// -pub struct P; - -/// -pub struct Q; - -/// -//~^ ERROR unclosed HTML tag `rect` -pub struct R; - -/// -pub struct S; diff --git a/tests/rustdoc-ui/invalid-html-self-closing-tag.stderr b/tests/rustdoc-ui/invalid-html-self-closing-tag.stderr deleted file mode 100644 index e45edfb43..000000000 --- a/tests/rustdoc-ui/invalid-html-self-closing-tag.stderr +++ /dev/null @@ -1,80 +0,0 @@ -error: invalid self-closing HTML tag `p` - --> $DIR/invalid-html-self-closing-tag.rs:3:5 - | -LL | ///

- | ^^ - | -note: the lint level is defined here - --> $DIR/invalid-html-self-closing-tag.rs:1:9 - | -LL | #![deny(rustdoc::invalid_html_tags)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: invalid self-closing HTML tag `p` - --> $DIR/invalid-html-self-closing-tag.rs:7:5 - | -LL | ///

- | ^^ - -error: invalid self-closing HTML tag `p` - --> $DIR/invalid-html-self-closing-tag.rs:11:5 - | -LL | ///

- | ^^ - -error: invalid self-closing HTML tag `p` - --> $DIR/invalid-html-self-closing-tag.rs:15:5 - | -LL | ///

- | ^^ - -error: unclosed quoted HTML attribute on tag `p` - --> $DIR/invalid-html-self-closing-tag.rs:19:14 - | -LL | ///

- | ^^ - -error: invalid self-closing HTML tag `p` - --> $DIR/invalid-html-self-closing-tag.rs:34:5 - | -LL | ///

- | ^^ - -error: invalid self-closing HTML tag `a` - --> $DIR/invalid-html-self-closing-tag.rs:47:5 - | -LL | /// - | ^^ - -error: invalid self-closing HTML tag `a` - --> $DIR/invalid-html-self-closing-tag.rs:51:5 - | -LL | /// - | ^^ - -error: invalid self-closing HTML tag `a` - --> $DIR/invalid-html-self-closing-tag.rs:55:5 - | -LL | /// - | ^^ - -error: unclosed HTML tag `rect` - --> $DIR/invalid-html-self-closing-tag.rs:65:10 - | -LL | /// - | ^^^^^ - -error: aborting due to 12 previous errors - diff --git a/tests/rustdoc-ui/invalid-html-tags.rs b/tests/rustdoc-ui/invalid-html-tags.rs deleted file mode 100644 index 317f1fd1d..000000000 --- a/tests/rustdoc-ui/invalid-html-tags.rs +++ /dev/null @@ -1,123 +0,0 @@ -#![deny(rustdoc::invalid_html_tags)] - -//!

💩

-//~^ ERROR unclosed HTML tag `p` -//~^^ ERROR unclosed HTML tag `p` - -/// -/// -/// -//~^ ERROR unclosed HTML tag `unknown` -/// < ok -/// -/// -pub fn d() {} - -// Unclosed tags shouldn't warn if they are nested inside a -/// -pub fn e() {} - -// Closing tags need to have ">" at the end, otherwise it's not a closing tag! -///

-///
-/// -/// -/// -pub fn g() {} - -/// -pub fn h() {} - -/// $DIR/invalid-html-tags.rs:3:5 - | -LL | //!

💩

- | ^^^ - | -note: the lint level is defined here - --> $DIR/invalid-html-tags.rs:1:9 - | -LL | #![deny(rustdoc::invalid_html_tags)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: unclosed HTML tag `p` - --> $DIR/invalid-html-tags.rs:3:9 - | -LL | //!

💩

- | ^^^ - -error: unclosed HTML tag `unknown` - --> $DIR/invalid-html-tags.rs:11:5 - | -LL | /// - | ^^^^^^^^^ - -error: unclosed HTML tag `script` - --> $DIR/invalid-html-tags.rs:14:5 - | -LL | /// +/// +//~^ ERROR unclosed HTML tag `unknown` +/// < ok +/// +/// +pub fn d() {} + +// Unclosed tags shouldn't warn if they are nested inside a +/// +pub fn e() {} + +// Closing tags need to have ">" at the end, otherwise it's not a closing tag! +///

+///
+/// +/// +/// +pub fn g() {} + +/// +pub fn h() {} + +/// $DIR/invalid-html-tags.rs:3:5 + | +LL | //!

💩

+ | ^^^ + | +note: the lint level is defined here + --> $DIR/invalid-html-tags.rs:1:9 + | +LL | #![deny(rustdoc::invalid_html_tags)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unclosed HTML tag `p` + --> $DIR/invalid-html-tags.rs:3:9 + | +LL | //!

💩

+ | ^^^ + +error: unclosed HTML tag `unknown` + --> $DIR/invalid-html-tags.rs:11:5 + | +LL | /// + | ^^^^^^^^^ + +error: unclosed HTML tag `script` + --> $DIR/invalid-html-tags.rs:14:5 + | +LL | ///