about summary refs log tree commit diff
path: root/tests/rustdoc-ui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-ui')
-rw-r--r--tests/rustdoc-ui/doctest/check-attr-test.stderr48
-rw-r--r--tests/rustdoc-ui/doctest/doctest-output-include-fail.md7
-rw-r--r--tests/rustdoc-ui/doctest/doctest-output-include-fail.rs7
-rw-r--r--tests/rustdoc-ui/doctest/doctest-output-include-fail.stdout24
-rw-r--r--tests/rustdoc-ui/doctest/doctest-output.stdout2
-rw-r--r--tests/rustdoc-ui/doctest/non-local-defs-impl.rs5
-rw-r--r--tests/rustdoc-ui/doctest/non-local-defs-impl.stdout19
-rw-r--r--tests/rustdoc-ui/doctest/non_local_defs.rs2
-rw-r--r--tests/rustdoc-ui/doctest/non_local_defs.stderr8
-rw-r--r--tests/rustdoc-ui/doctest/non_local_defs.stdout2
-rw-r--r--tests/rustdoc-ui/doctest/standalone-warning-2024.rs16
-rw-r--r--tests/rustdoc-ui/doctest/standalone-warning-2024.stderr38
-rw-r--r--tests/rustdoc-ui/doctest/standalone-warning.rs10
-rw-r--r--tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr2
-rw-r--r--tests/rustdoc-ui/issues/issue-105742.stderr2
-rw-r--r--tests/rustdoc-ui/lints/check-attr.stderr52
-rw-r--r--tests/rustdoc-ui/lints/check-fail.stderr8
17 files changed, 175 insertions, 77 deletions
diff --git a/tests/rustdoc-ui/doctest/check-attr-test.stderr b/tests/rustdoc-ui/doctest/check-attr-test.stderr
index 10f763a6f9d..257136d1633 100644
--- a/tests/rustdoc-ui/doctest/check-attr-test.stderr
+++ b/tests/rustdoc-ui/doctest/check-attr-test.stderr
@@ -8,8 +8,8 @@ error: unknown attribute `compile-fail`
 9 | | /// ```
   | |_______^
   |
-  = help: there is an attribute with a similar name: `compile_fail`
-  = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
+  = help: use `compile_fail` to invert the results of this test, so that it passes if it cannot be compiled and fails if it can
+  = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 note: the lint level is defined here
  --> $DIR/check-attr-test.rs:3:9
   |
@@ -26,8 +26,8 @@ error: unknown attribute `compilefail`
 9 | | /// ```
   | |_______^
   |
-  = help: there is an attribute with a similar name: `compile_fail`
-  = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
+  = help: use `compile_fail` to invert the results of this test, so that it passes if it cannot be compiled and fails if it can
+  = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `comPile_fail`
  --> $DIR/check-attr-test.rs:5:1
@@ -39,8 +39,8 @@ error: unknown attribute `comPile_fail`
 9 | | /// ```
   | |_______^
   |
-  = help: there is an attribute with a similar name: `compile_fail`
-  = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
+  = help: use `compile_fail` to invert the results of this test, so that it passes if it cannot be compiled and fails if it can
+  = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `should-panic`
   --> $DIR/check-attr-test.rs:12:1
@@ -52,8 +52,8 @@ error: unknown attribute `should-panic`
 16 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `should_panic`
-   = 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
+   = help: use `should_panic` to invert the results of this test, so that if passes if it panics and fails if it does not
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `shouldpanic`
   --> $DIR/check-attr-test.rs:12:1
@@ -65,8 +65,8 @@ error: unknown attribute `shouldpanic`
 16 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `should_panic`
-   = 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
+   = help: use `should_panic` to invert the results of this test, so that if passes if it panics and fails if it does not
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `shOuld_panic`
   --> $DIR/check-attr-test.rs:12:1
@@ -78,8 +78,8 @@ error: unknown attribute `shOuld_panic`
 16 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `should_panic`
-   = 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
+   = help: use `should_panic` to invert the results of this test, so that if passes if it panics and fails if it does not
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `no-run`
   --> $DIR/check-attr-test.rs:19:1
@@ -91,8 +91,8 @@ error: unknown attribute `no-run`
 23 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `no_run`
-   = 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)
+   = help: use `no_run` to compile, but not run, the code sample during testing
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `norun`
   --> $DIR/check-attr-test.rs:19:1
@@ -104,8 +104,8 @@ error: unknown attribute `norun`
 23 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `no_run`
-   = 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)
+   = help: use `no_run` to compile, but not run, the code sample during testing
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `nO_run`
   --> $DIR/check-attr-test.rs:19:1
@@ -117,8 +117,8 @@ error: unknown attribute `nO_run`
 23 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `no_run`
-   = 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)
+   = help: use `no_run` to compile, but not run, the code sample during testing
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `test-harness`
   --> $DIR/check-attr-test.rs:26:1
@@ -130,8 +130,8 @@ error: unknown attribute `test-harness`
 30 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `test_harness`
-   = 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
+   = help: use `test_harness` to run functions marked `#[test]` instead of a potentially-implicit `main` function
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `testharness`
   --> $DIR/check-attr-test.rs:26:1
@@ -143,8 +143,8 @@ error: unknown attribute `testharness`
 30 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `test_harness`
-   = 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
+   = help: use `test_harness` to run functions marked `#[test]` instead of a potentially-implicit `main` function
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `tesT_harness`
   --> $DIR/check-attr-test.rs:26:1
@@ -156,8 +156,8 @@ error: unknown attribute `tesT_harness`
 30 | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `test_harness`
-   = 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
+   = help: use `test_harness` to run functions marked `#[test]` instead of a potentially-implicit `main` function
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: aborting due to 12 previous errors
 
diff --git a/tests/rustdoc-ui/doctest/doctest-output-include-fail.md b/tests/rustdoc-ui/doctest/doctest-output-include-fail.md
new file mode 100644
index 00000000000..a8e61238f31
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/doctest-output-include-fail.md
@@ -0,0 +1,7 @@
+With a code sample, that has an error:
+
+```rust
+fn main() {
+    let x = 234 // no semicolon here! oh no!
+}
+```
diff --git a/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs b/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs
new file mode 100644
index 00000000000..4fc0674a0c9
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs
@@ -0,0 +1,7 @@
+//@ 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"
+//@ failure-status: 101
+
+// https://github.com/rust-lang/rust/issues/130470
+#![doc = include_str!("doctest-output-include-fail.md")]
diff --git a/tests/rustdoc-ui/doctest/doctest-output-include-fail.stdout b/tests/rustdoc-ui/doctest/doctest-output-include-fail.stdout
new file mode 100644
index 00000000000..22d15f8743c
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/doctest-output-include-fail.stdout
@@ -0,0 +1,24 @@
+
+running 1 test
+test $DIR/doctest-output-include-fail.md - (line 3) ... FAILED
+
+failures:
+
+---- $DIR/doctest-output-include-fail.md - (line 3) stdout ----
+error: expected `;`, found `}`
+  --> $DIR/doctest-output-include-fail.md:5:16
+   |
+LL |     let x = 234 // no semicolon here! oh no!
+   |                ^ help: add `;` here
+LL | }
+   | - unexpected token
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+
+failures:
+    $DIR/doctest-output-include-fail.md - (line 3)
+
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/rustdoc-ui/doctest/doctest-output.stdout b/tests/rustdoc-ui/doctest/doctest-output.stdout
index 35b0e366fb5..c3b1570c43e 100644
--- a/tests/rustdoc-ui/doctest/doctest-output.stdout
+++ b/tests/rustdoc-ui/doctest/doctest-output.stdout
@@ -1,7 +1,7 @@
 
 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 - ExpandedStruct (line 25) ... 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/non-local-defs-impl.rs b/tests/rustdoc-ui/doctest/non-local-defs-impl.rs
index 37c80bc1f27..b1ab5323a2b 100644
--- a/tests/rustdoc-ui/doctest/non-local-defs-impl.rs
+++ b/tests/rustdoc-ui/doctest/non-local-defs-impl.rs
@@ -15,7 +15,10 @@
 /// # use pub_trait::Trait;
 ///
 /// struct Local;
-/// impl Trait for &Local {}
+///
+/// fn foo() {
+///     impl Trait for &Local {}
+/// }
 /// ```
 ///
 /// But this shoudln't produce a warning:
diff --git a/tests/rustdoc-ui/doctest/non-local-defs-impl.stdout b/tests/rustdoc-ui/doctest/non-local-defs-impl.stdout
index 27797e22f8e..f39d2c2608b 100644
--- a/tests/rustdoc-ui/doctest/non-local-defs-impl.stdout
+++ b/tests/rustdoc-ui/doctest/non-local-defs-impl.stdout
@@ -1,24 +1,23 @@
 
 running 2 tests
 test $DIR/non-local-defs-impl.rs - doctest (line 13) - compile ... FAILED
-test $DIR/non-local-defs-impl.rs - doctest (line 22) - compile ... ok
+test $DIR/non-local-defs-impl.rs - doctest (line 25) - compile ... ok
 
 failures:
 
 ---- $DIR/non-local-defs-impl.rs - doctest (line 13) stdout ----
 error: non-local `impl` definition, `impl` blocks should be written at the same level as their item
-  --> $DIR/non-local-defs-impl.rs:18:1
+  --> $DIR/non-local-defs-impl.rs:20:5
    |
-LL | impl Trait for &Local {}
-   | ^^^^^-----^^^^^------
-   |      |         |
-   |      |         `&'_ Local` is not local
-   |      |         help: remove `&` to make the `impl` local
-   |      `Trait` is not local
+LL | fn foo() {
+   | -------- move the `impl` block outside of this function `foo` and up 3 bodies
+LL |     impl Trait for &Local {}
+   |     ^^^^^-----^^^^^^-----
+   |          |          |
+   |          |          `Local` is not local
+   |          `Trait` is not local
    |
-   = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
    = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
-   = help: make this doc-test a standalone test with its own `fn main() { ... }`
    = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
 note: the lint level is defined here
   --> $DIR/non-local-defs-impl.rs:11:9
diff --git a/tests/rustdoc-ui/doctest/non_local_defs.rs b/tests/rustdoc-ui/doctest/non_local_defs.rs
index 83327eb1e3f..a2f66c39223 100644
--- a/tests/rustdoc-ui/doctest/non_local_defs.rs
+++ b/tests/rustdoc-ui/doctest/non_local_defs.rs
@@ -4,8 +4,6 @@
 //@ normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
 //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
 
-#![doc(test(attr(warn(non_local_definitions))))]
-
 //! ```
 //! #[macro_export]
 //! macro_rules! a_macro { () => {} }
diff --git a/tests/rustdoc-ui/doctest/non_local_defs.stderr b/tests/rustdoc-ui/doctest/non_local_defs.stderr
index 13cd2558793..2b47e6b5bc4 100644
--- a/tests/rustdoc-ui/doctest/non_local_defs.stderr
+++ b/tests/rustdoc-ui/doctest/non_local_defs.stderr
@@ -1,5 +1,5 @@
 warning: non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module
-  --> $DIR/non_local_defs.rs:11:1
+  --> $DIR/non_local_defs.rs:9:1
    |
 LL | macro_rules! a_macro { () => {} }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,11 +7,7 @@ LL | macro_rules! a_macro { () => {} }
    = help: remove the `#[macro_export]` or make this doc-test a standalone test with its own `fn main() { ... }`
    = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
    = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
-note: the lint level is defined here
-  --> $DIR/non_local_defs.rs:8:9
-   |
-LL | #![warn(non_local_definitions)]
-   |         ^^^^^^^^^^^^^^^^^^^^^
+   = note: `#[warn(non_local_definitions)]` on by default
 
 warning: 1 warning emitted
 
diff --git a/tests/rustdoc-ui/doctest/non_local_defs.stdout b/tests/rustdoc-ui/doctest/non_local_defs.stdout
index 61b4074886e..bee195fcdd7 100644
--- a/tests/rustdoc-ui/doctest/non_local_defs.stdout
+++ b/tests/rustdoc-ui/doctest/non_local_defs.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/non_local_defs.rs - (line 9) ... ok
+test $DIR/non_local_defs.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/standalone-warning-2024.rs b/tests/rustdoc-ui/doctest/standalone-warning-2024.rs
new file mode 100644
index 00000000000..aac43031546
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/standalone-warning-2024.rs
@@ -0,0 +1,16 @@
+// This test checks that it will output warnings for usage of `standalone` or `standalone_crate`.
+
+//@ compile-flags:--test -Zunstable-options --edition 2024
+//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
+
+#![deny(warnings)]
+
+//! ```standalone
+//! bla
+//! ```
+//!
+//! ```standalone-crate
+//! bla
+//! ```
diff --git a/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr b/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr
new file mode 100644
index 00000000000..d69d03d8657
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr
@@ -0,0 +1,38 @@
+error: unknown attribute `standalone`
+  --> $DIR/standalone-warning-2024.rs:10:1
+   |
+10 | / //! ```standalone
+11 | | //! bla
+12 | | //! ```
+13 | | //!
+14 | | //! ```standalone-crate
+15 | | //! bla
+16 | | //! ```
+   | |_______^
+   |
+   = help: use `standalone_crate` to compile this code block separately
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
+note: the lint level is defined here
+  --> $DIR/standalone-warning-2024.rs:8:9
+   |
+8  | #![deny(warnings)]
+   |         ^^^^^^^^
+   = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
+
+error: unknown attribute `standalone-crate`
+  --> $DIR/standalone-warning-2024.rs:10:1
+   |
+10 | / //! ```standalone
+11 | | //! bla
+12 | | //! ```
+13 | | //!
+14 | | //! ```standalone-crate
+15 | | //! bla
+16 | | //! ```
+   | |_______^
+   |
+   = help: use `standalone_crate` to compile this code block separately
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/rustdoc-ui/doctest/standalone-warning.rs b/tests/rustdoc-ui/doctest/standalone-warning.rs
new file mode 100644
index 00000000000..ce081c7641c
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/standalone-warning.rs
@@ -0,0 +1,10 @@
+// This test checks that it will not output warning for usage of `standalone` or `standalone_crate`.
+//@ check-pass
+
+//! ```standalone
+//! bla
+//! ```
+//!
+//! ```standalone-crate
+//! bla
+//! ```
diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
index ef551cbea3e..0c3826c5665 100644
--- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
+++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
@@ -98,7 +98,7 @@ error[E0038]: the trait `X` cannot be made into an object
 LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
    |                    ^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
    |
-note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
   --> $DIR/invalid_const_in_lifetime_position.rs:2:10
    |
 LL | trait X {
diff --git a/tests/rustdoc-ui/issues/issue-105742.stderr b/tests/rustdoc-ui/issues/issue-105742.stderr
index 0f01bc59759..0f09d637f38 100644
--- a/tests/rustdoc-ui/issues/issue-105742.stderr
+++ b/tests/rustdoc-ui/issues/issue-105742.stderr
@@ -300,7 +300,7 @@ error[E0038]: the trait `SVec` cannot be made into an object
 LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object
    |
-note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
   --> $DIR/issue-105742.rs:14:17
    |
 LL |    pub trait SVec: Index<
diff --git a/tests/rustdoc-ui/lints/check-attr.stderr b/tests/rustdoc-ui/lints/check-attr.stderr
index d640125ab51..e23806e0bab 100644
--- a/tests/rustdoc-ui/lints/check-attr.stderr
+++ b/tests/rustdoc-ui/lints/check-attr.stderr
@@ -10,8 +10,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `compile_fail`
-   = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
+   = help: use `compile_fail` to invert the results of this test, so that it passes if it cannot be compiled and fails if it can
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 note: the lint level is defined here
   --> $DIR/check-attr.rs:1:9
    |
@@ -30,8 +30,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `compile_fail`
-   = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
+   = help: use `compile_fail` to invert the results of this test, so that it passes if it cannot be compiled and fails if it can
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `comPile_fail`
   --> $DIR/check-attr.rs:3:1
@@ -45,8 +45,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `compile_fail`
-   = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
+   = help: use `compile_fail` to invert the results of this test, so that it passes if it cannot be compiled and fails if it can
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `should-panic`
   --> $DIR/check-attr.rs:13:1
@@ -60,8 +60,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `should_panic`
-   = 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
+   = help: use `should_panic` to invert the results of this test, so that if passes if it panics and fails if it does not
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `shouldpanic`
   --> $DIR/check-attr.rs:13:1
@@ -75,8 +75,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `should_panic`
-   = 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
+   = help: use `should_panic` to invert the results of this test, so that if passes if it panics and fails if it does not
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `sHould_panic`
   --> $DIR/check-attr.rs:13:1
@@ -90,8 +90,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `should_panic`
-   = 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
+   = help: use `should_panic` to invert the results of this test, so that if passes if it panics and fails if it does not
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `no-run`
   --> $DIR/check-attr.rs:23:1
@@ -105,8 +105,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `no_run`
-   = 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)
+   = help: use `no_run` to compile, but not run, the code sample during testing
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `norun`
   --> $DIR/check-attr.rs:23:1
@@ -120,8 +120,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `no_run`
-   = 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)
+   = help: use `no_run` to compile, but not run, the code sample during testing
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `no_Run`
   --> $DIR/check-attr.rs:23:1
@@ -135,8 +135,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `no_run`
-   = 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)
+   = help: use `no_run` to compile, but not run, the code sample during testing
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `test-harness`
   --> $DIR/check-attr.rs:33:1
@@ -150,8 +150,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `test_harness`
-   = 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
+   = help: use `test_harness` to run functions marked `#[test]` instead of a potentially-implicit `main` function
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `testharness`
   --> $DIR/check-attr.rs:33:1
@@ -165,8 +165,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `test_harness`
-   = 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
+   = help: use `test_harness` to run functions marked `#[test]` instead of a potentially-implicit `main` function
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `teSt_harness`
   --> $DIR/check-attr.rs:33:1
@@ -180,8 +180,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `test_harness`
-   = 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
+   = help: use `test_harness` to run functions marked `#[test]` instead of a potentially-implicit `main` function
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: unknown attribute `rust2018`
   --> $DIR/check-attr.rs:43:1
@@ -222,8 +222,8 @@ LL | | /// boo
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `should_panic`
-   = 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
+   = help: use `should_panic` to invert the results of this test, so that if passes if it panics and fails if it does not
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: aborting due to 15 previous errors
 
diff --git a/tests/rustdoc-ui/lints/check-fail.stderr b/tests/rustdoc-ui/lints/check-fail.stderr
index 99b01bac598..2eb9496e5dc 100644
--- a/tests/rustdoc-ui/lints/check-fail.stderr
+++ b/tests/rustdoc-ui/lints/check-fail.stderr
@@ -31,8 +31,8 @@ LL | | //! let x = 12;
 LL | | //! ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `test_harness`
-   = 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
+   = help: use `test_harness` to run functions marked `#[test]` instead of a potentially-implicit `main` function
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 note: the lint level is defined here
   --> $DIR/check-fail.rs:6:9
    |
@@ -51,8 +51,8 @@ LL | | /// let x = 12;
 LL | | /// ```
    | |_______^
    |
-   = help: there is an attribute with a similar name: `test_harness`
-   = 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
+   = help: use `test_harness` to run functions marked `#[test]` instead of a potentially-implicit `main` function
+   = help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
 
 error: aborting due to 4 previous errors