about summary refs log tree commit diff
path: root/tests/rustdoc-ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-25 16:42:36 +0000
committerbors <bors@rust-lang.org>2025-03-25 16:42:36 +0000
commit40507bded561ca6d28f3e187aed8317bb81ce9e2 (patch)
tree645b301936cf53db0db5bb60f45e9ae496faf99b /tests/rustdoc-ui
parent48994b1674b3212d27b5e83841c0966bc2b4be43 (diff)
parent8d5109aa6ea1b54a560774eb95ba7c1b8d404faa (diff)
Auto merge of #138865 - petrochenkov:errwhere, r=jieyouxu
compiletest: Support matching on diagnostics without a span

Using `//~? ERROR my message` on any line of the test.

The new checks are exhaustive, like all other `//~` checks, and unlike the `error-pattern` directive that is sometimes used now to check for span-less diagnostics.

This will allow to eliminate most on `error-pattern` directives in compile-fail tests (except those that are intentionally imprecise due to platform-specific diagnostics).
I didn't migrate any of `error-pattern`s in this PR though, except those where the migration was necessary for the tests to pass.
Diffstat (limited to 'tests/rustdoc-ui')
-rw-r--r--tests/rustdoc-ui/coverage/html.rs2
-rw-r--r--tests/rustdoc-ui/deprecated-attrs.rs4
-rw-r--r--tests/rustdoc-ui/doctest-output.rs2
-rw-r--r--tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs2
-rw-r--r--tests/rustdoc-ui/include-str-bare-urls.rs2
-rw-r--r--tests/rustdoc-ui/lints/check.rs2
-rw-r--r--tests/rustdoc-ui/remap-path-prefix-lint.rs2
-rw-r--r--tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs2
-rw-r--r--tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs2
-rw-r--r--tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs2
-rw-r--r--tests/rustdoc-ui/use_both_out_dir_and_output_options.rs2
11 files changed, 24 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/coverage/html.rs b/tests/rustdoc-ui/coverage/html.rs
index 41e1ce1609d..7fd080f0758 100644
--- a/tests/rustdoc-ui/coverage/html.rs
+++ b/tests/rustdoc-ui/coverage/html.rs
@@ -2,3 +2,5 @@
 
 /// Foo
 pub struct Xo;
+
+//~? ERROR `--output-format=html` is not supported for the `--show-coverage` option
diff --git a/tests/rustdoc-ui/deprecated-attrs.rs b/tests/rustdoc-ui/deprecated-attrs.rs
index 3b59e05a012..0ae65a5eaf7 100644
--- a/tests/rustdoc-ui/deprecated-attrs.rs
+++ b/tests/rustdoc-ui/deprecated-attrs.rs
@@ -19,3 +19,7 @@
 //~| NOTE see issue #44136
 //~| NOTE no longer functions
 //~| NOTE `doc(plugins)` is now a no-op
+
+//~? WARN the `passes` flag no longer functions
+//~? NOTE see issue #44136
+//~? HELP you may want to use --document-private-items
diff --git a/tests/rustdoc-ui/doctest-output.rs b/tests/rustdoc-ui/doctest-output.rs
index 720f2952980..28364c3a3ea 100644
--- a/tests/rustdoc-ui/doctest-output.rs
+++ b/tests/rustdoc-ui/doctest-output.rs
@@ -1 +1,3 @@
 //@ compile-flags:-Z unstable-options --show-coverage --output-format=doctest
+
+//~? ERROR `--output-format=doctest` is not supported for the `--show-coverage` option
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
index babdbd0a692..9d6ec0caf9f 100644
--- 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
@@ -5,3 +5,5 @@
 //@ check-pass
 
 pub fn f() {}
+
+//~? WARN `--generate-link-to-definition` option can only be used with HTML output format
diff --git a/tests/rustdoc-ui/include-str-bare-urls.rs b/tests/rustdoc-ui/include-str-bare-urls.rs
index c452c88cdd3..f80e28e8ca7 100644
--- a/tests/rustdoc-ui/include-str-bare-urls.rs
+++ b/tests/rustdoc-ui/include-str-bare-urls.rs
@@ -13,3 +13,5 @@
 
 #![deny(rustdoc::bare_urls)]
 #![doc=include_str!("auxiliary/include-str-bare-urls.md")]
+
+//~? ERROR this URL is not a hyperlink
diff --git a/tests/rustdoc-ui/lints/check.rs b/tests/rustdoc-ui/lints/check.rs
index 61c9f188952..0943f9f6053 100644
--- a/tests/rustdoc-ui/lints/check.rs
+++ b/tests/rustdoc-ui/lints/check.rs
@@ -12,3 +12,5 @@
 pub fn foo() {}
 //~^ WARN
 //~^^ WARN
+
+//~? WARN no documentation found for this crate's top-level module
diff --git a/tests/rustdoc-ui/remap-path-prefix-lint.rs b/tests/rustdoc-ui/remap-path-prefix-lint.rs
index f27863e825d..d003e19f200 100644
--- a/tests/rustdoc-ui/remap-path-prefix-lint.rs
+++ b/tests/rustdoc-ui/remap-path-prefix-lint.rs
@@ -8,3 +8,5 @@
 
 /// </script>
 pub struct Bar;
+
+//~? ERROR unopened HTML tag `script`
diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs
index 4fb5c9ab36f..c8e82d3a20b 100644
--- a/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs
+++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs
@@ -5,3 +5,5 @@ pub fn foo() {
   INVALID_FUNC();
   //~^ ERROR could not resolve path
 }
+
+//~? ERROR Compilation failed, aborting rustdoc
diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs
index df7b41e20f6..3db7924dbe1 100644
--- a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs
+++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs
@@ -1 +1,3 @@
 //@ compile-flags: -Z unstable-options --scrape-examples-target-crate foobar
+
+//~? ERROR must use --scrape-examples-output-path and --scrape-examples-target-crate together
diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs
index ef270a08f48..7b6a30291ce 100644
--- a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs
+++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs
@@ -1 +1,3 @@
 //@ compile-flags: -Z unstable-options --scrape-examples-output-path ex.calls
+
+//~? ERROR must use --scrape-examples-output-path and --scrape-examples-target-crate together
diff --git a/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs b/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs
index 62d3d955855..42847203d48 100644
--- a/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs
+++ b/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs
@@ -1 +1,3 @@
 //@ compile-flags: --output ./foo
+
+//~? ERROR cannot use both 'out-dir' and 'output' at once