rust/tests/rustdoc-ui
bors 71b68da1bd Auto merge of #139578 - ferrocene:pa-compiletest-edition, r=jieyouxu
Fix breakage when running compiletest with `--test-args=--edition=2015`

Compiletest has an `--edition` flag to change the default edition tests are run with. Unfortunately no test suite successfully executes when that flag is passed. If the edition is set to something greater than 2015 the breakage is expected, since the test suite currently supports only edition 2015 (Ferrous Systems will open an MCP about fixing that soonish). Surprisingly, the test suite is also broken if `--edition=2015` is passed to compiletest. This PR focuses on fixing the latter.

This PR fixes the two categories of failures happening when `--edition=2015` is passed:

* Some edition-specific tests set their edition through `//@ compile-flags` instead of `//@ edition`. Compiletest doesn't parse the compile flags, so it would see no `//@ edition` and add another `--edition` flag, leading to a rustc error.
* Compiletest would add the edition after `//@ compile-flags`, while some tests depend on flags passed to `//@ compile-flags` being the last flags in the rustc invocation.

Note that for the first category, I opted to manually go and replace all `//@ compile-flags` setting an edition with an explicit `//@ edition`. We could've changed compiletest to instead check whether an edition was set in `//@ compile-flags`, but I thought it was better to enforce a consistent way to set the edition in tests.

I also added the edition to the stamp, so that changing `--edition` results in tests being re-executed.

r? `@jieyouxu`
2025-04-11 10:53:45 +00:00
..
argfile Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
auxiliary Move "unused_exter_crate" test from rustdoc-ui to rustdoc 2025-02-27 13:22:46 +00:00
coverage compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
doctest replace //@ compile-flags: --edition with //@ edition 2025-04-10 09:56:37 +02:00
error-in-impl-trait Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
generate-link-to-definition compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
intra-doc replace //@ compile-flags: --edition with //@ edition 2025-04-10 09:56:37 +02:00
issues UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
lints compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
scrape-examples compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
suggestions [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
synthetic-auto-trait-impls fix rustdoc test 2024-12-07 21:37:15 +00:00
2024-doctests-checks.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
2024-doctests-checks.stdout Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
2024-doctests-crate-attribute.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
2024-doctests-crate-attribute.stdout Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
ambiguous-inherent-assoc-ty.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
apit-46976.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
associated-constant-not-allowed-102467.rs rustdoc: rename issue-\d+.rs tests to have meaningful names 2024-09-12 13:47:51 -07:00
associated-constant-not-allowed-102467.stderr rustdoc: re-bless stderrs after renaming the test case 2024-09-12 13:48:51 -07:00
bounded-hr-lifetime.rs Simple modification of diagnostic information 2023-12-21 10:17:11 +08:00
bounded-hr-lifetime.stderr Simple modification of diagnostic information 2023-12-21 10:17:11 +08:00
cfg-boolean-literal.rs Adjust rustdoc for literal boolean support 2024-10-04 09:09:20 +02:00
check-cfg.rs Stabilize checking of cfgs at compile-time: --check-cfg option 2024-04-15 21:49:55 +02:00
check-cfg.stderr Move --check-cfg documentation to stable books 2024-04-15 21:49:56 +02:00
check-doc-alias-attr-location.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
check-doc-alias-attr-location.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
check-doc-alias-attr.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
check-doc-alias-attr.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
circular-intra-doc-link-48414.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
const_arg_in_type_position.rs rustdoc: run more HIR validation to mirror rustc 2023-03-30 14:55:03 +02:00
const_arg_in_type_position.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
const-evalutation-ice.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-evalutation-ice.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
crate-reference-in-block-module.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
custom_code_classes_in_docs-warning3.rs Add missing lang items in no_core tests in rustdoc 2025-02-04 01:05:31 +00:00
custom_code_classes_in_docs-warning3.stderr Add missing lang items in no_core tests in rustdoc 2025-02-04 01:05:31 +00:00
deprecated-attrs.rs compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
deprecated-attrs.stderr Add doc(plugins), doc(passes), etc. to INVALID_DOC_ATTRIBUTES 2024-10-15 13:28:39 +02:00
deref-generic.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
diagnostic-width.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
diagnostic-width.stderr Fix rustdoc test 2025-03-07 17:55:08 +00:00
disambiguator-endswith-named-suffix.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
disambiguator-endswith-named-suffix.stderr add test for #126986 2024-06-28 08:01:07 +08:00
disambiguator-macro-endswith-exclamatory.rs add test for #126986 2024-06-28 08:01:07 +08:00
disambiguator-macro-endswith-exclamatory.stderr add test for #126986 2024-06-28 08:01:07 +08:00
doc-alias-assoc-const.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
doc-alias-assoc-const.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
doc-alias-crate-level.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
doc-alias-crate-level.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
doc-alias-same-name.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
doc-alias-same-name.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
doc-cfg-check-cfg.rs rustdoc: Add FIXME test for doc_cfg interaction with check_cfg 2025-03-11 17:03:00 +00:00
doc-cfg-unstable.rs rustdoc: Gate unstable doc(cfg()) predicates 2025-03-10 14:18:56 +00:00
doc-cfg-unstable.stderr rustdoc: Gate unstable doc(cfg()) predicates 2025-03-10 14:18:56 +00:00
doc-cfg.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
doc-cfg.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
doc-include-suggestion.rs Update ui tests 2024-02-29 14:43:43 +01:00
doc-include-suggestion.stderr Update ui tests 2024-02-29 14:43:43 +01:00
doctest-output.rs compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
doctest-output.stderr Improve check for --output-format combinations and add ui regression test 2025-01-29 15:18:14 +01:00
extract-doctests.rs Add ui test for new rustdoc --output-format=doctest option 2025-01-29 13:57:27 +01:00
extract-doctests.stdout Update rustdoc-ui tests 2025-03-27 11:18:43 +01:00
feature-gate-doc_cfg_hide.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
feature-gate-doc_cfg_hide.stderr Bless tests 2024-01-13 12:46:58 -05:00
hashtag-doctest.rs Add regression test for #136899 2025-02-12 19:46:07 +01:00
hidden-trait-method-34423.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
ice-assoc-const-for-primitive-31808.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
ice-assoc-type-loop-102154.rs Move assertion-free rustdoc ice tests to rustdoc-ui 2024-07-12 18:18:30 -07:00
ice-blanket-impl-52873.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
ice-blanket-impl-56701.rs Move ice tests to rustdoc-ui 2024-04-15 15:11:49 -07:00
ice-blanket-impl-119792.rs Add a regression test for a former blanket impl synthesis ICE 2024-06-03 03:50:15 +02:00
ice-blanket-impl-selection-55001.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
ice-bug-report-url.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
ice-bug-report-url.stderr Try to write the panic message with a single write_all call 2025-01-01 15:58:29 +01:00
ice-cross-crate-opaque-assoc-type-73061.rs Move ice tests to rustdoc-ui 2024-04-15 15:11:49 -07:00
ice-method-where-clause-circular-100620.rs Move assertion-free rustdoc ice tests to rustdoc-ui 2024-07-12 18:18:30 -07:00
ice-unresolved-import-100241.rs Move assertion-free rustdoc ice tests to rustdoc-ui 2024-07-12 18:18:30 -07:00
ice-unresolved-import-100241.stderr Reword "crate not found" resolve message 2025-01-24 01:19:50 +00:00
ignore-block-help.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
ignore-block-help.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
impl-fn-nesting.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
impl-fn-nesting.stderr Make configure_and_expand "infalllible" by just aborting the compilation if it fails instead of bubbling out an error 2023-02-20 15:28:59 +00:00
include-str-bare-urls.rs compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
include-str-bare-urls.stderr Adjust rustdoc automatic link suggestion 2024-07-04 00:40:04 +00:00
infinite-recursive-type.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
infinite-recursive-type.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
inherent-assoc-consts-36031.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
invalid_associated_const.rs Rename HIR TypeBinding to AssocItemConstraint and related cleanup 2024-05-30 22:52:33 +02:00
invalid_associated_const.stderr Fix associated item removal suggestion 2024-07-17 21:30:40 +00:00
invalid_const_in_lifetime_position.rs Refactor dyn-compatibility error and suggestions 2025-01-22 09:20:57 -08:00
invalid_const_in_lifetime_position.stderr Compiler: Finalize dyn compatibility renaming 2025-01-26 21:20:31 +01:00
invalid_infered_static_and_const.rs rustdoc: run more HIR validation to mirror rustc 2023-03-30 14:55:03 +02:00
invalid_infered_static_and_const.stderr rustdoc: run more HIR validation to mirror rustc 2023-03-30 14:55:03 +02:00
invalid-cfg.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
invalid-cfg.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
invalid-keyword.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
invalid-keyword.stderr Remove rustc::existing_doc_keyword lint. 2024-12-17 13:56:10 +11:00
invalid-redundant-explicit-link.rs Add regression test for #123158 2024-03-28 11:09:08 +01:00
invalid-syntax.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
invalid-syntax.stderr Account for /// when rendering multiline spans 2024-12-13 18:48:33 +00:00
invalid-theme-name.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
invalid-theme-name.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
macro-docs.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
macro-docs.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mismatched_arg_count.rs rustdoc: remove excess from rustdoc test 2023-03-30 14:55:03 +02:00
mismatched_arg_count.stderr Revert suggestion verbosity change 2024-07-22 22:51:53 +00:00
multi-par-footnote.rs rustdoc: Enable Markdown extensions when looking for doctests 2025-04-09 13:04:57 -04:00
multi-par-footnote.stdout rustdoc: Enable Markdown extensions when looking for doctests 2025-04-09 13:04:57 -04:00
nested-extern-crate-46271.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nested-macro-rules-47639.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
normalize-cycle.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
normalize-in-inlined-type-alias.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
normalize-overflow.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
not-wf-ambiguous-normalization.rs Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
not-wf-ambiguous-normalization.stderr Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
output-format-html-stable.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
private-type-cycle-110629.rs rustdoc: rename issue-\d+.rs tests to have meaningful names 2024-09-12 13:47:51 -07:00
private-type-cycle-dyn-110629.rs rustdoc: rename issue-\d+.rs tests to have meaningful names 2024-09-12 13:47:51 -07:00
private-type-cycle-dyn-110629.stderr rustdoc: re-bless stderrs after renaming the test case 2024-09-12 13:48:51 -07:00
proc_macro_bug.rs Test rustdoc encountering proc_macro_derive in a non-proc-macro crate 2023-02-23 09:00:33 +00:00
proc_macro_bug.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
projection-as-union-type-error.rs rustdoc: add two regression tests 2024-09-09 22:35:10 +02:00
projection-as-union-type-error.stderr rustdoc: add two regression tests 2024-09-09 22:35:10 +02:00
pub-use-primitive-document-private-items-95633.rs Move tests into appropriate subdirectories 2024-05-21 21:21:26 -07:00
range-pattern.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
recursive-deref-ice.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
recursive-type-alias-impl-trait-declaration-too-subtle-2.rs rustdoc: add two regression tests 2024-09-09 22:35:10 +02:00
redundant-explicit-links-123677.rs rustdoc: check redundant explicit links with correct itemid 2024-04-13 19:32:39 -07:00
remap-path-prefix-failed-doctest-output.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
remap-path-prefix-failed-doctest-output.stdout Try to write the panic message with a single write_all call 2025-01-01 15:58:29 +01:00
remap-path-prefix-invalid-doctest.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
remap-path-prefix-invalid-doctest.stdout Update rustdoc-ui tests 2025-03-27 11:18:43 +01:00
remap-path-prefix-lint.rs compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
remap-path-prefix-lint.stderr Add regression test for #69264 2024-08-06 16:56:48 +02:00
remap-path-prefix-macro.rs Fix ICE: attempted to remap an already remapped filename 2025-03-16 23:37:09 +01:00
remap-path-prefix-passed-doctest-output.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
remap-path-prefix-passed-doctest-output.stdout rustdoc: Add support for --remap-path-prefix 2024-06-09 10:34:54 -07:00
rustc-check-passes.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustc-check-passes.stderr terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it) 2024-10-22 07:37:54 +01:00
search-index-generics-recursion-bug-issue-59502.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
show-coverage-json.rs Add UI regressions tests for rustdoc --show-coverage option 2024-11-04 14:46:04 +01:00
show-coverage-json.stdout Do not emit missing_doc_code_examples rustdoc lint on module and a few other items 2024-11-28 21:22:06 +01:00
show-coverage.rs Add UI regressions tests for rustdoc --show-coverage option 2024-11-04 14:46:04 +01:00
show-coverage.stdout Do not emit missing_doc_code_examples rustdoc lint on module and a few other items 2024-11-28 21:22:06 +01:00
super-glob-40936.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
target-feature-stability.rs also skip abi_required_features check in rustdoc 2025-03-01 15:14:02 +01:00
track-diagnostics.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
track-diagnostics.stderr Don't typeck during WF, instead check outside of WF in check_crate 2025-03-03 23:09:42 +00:00
tuple-variadic-check.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
tuple-variadic-check.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
unable-fulfill-trait.rs Dont create trait object if it has errors in it 2024-11-23 23:31:30 +00:00
unable-fulfill-trait.stderr Dont create trait object if it has errors in it 2024-11-23 23:31:30 +00:00
unescaped_backticks.rs Remove last vestiges of HybridBitSet. 2024-11-29 17:23:34 +11:00
unescaped_backticks.stderr Account for /// when rendering multiline spans 2024-12-13 18:48:33 +00:00
unportable-markdown.rs Adjust expected errors for a rustdoc test 2024-08-18 22:52:54 -05:00
unportable-markdown.stderr Adjust expected errors for a rustdoc test 2024-08-18 22:52:54 -05:00
use_both_out_dir_and_output_options.rs compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
use_both_out_dir_and_output_options.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
wasm-safe.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00