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.rs12
-rw-r--r--tests/rustdoc-ui/doctest/check-attr-test.stderr24
-rw-r--r--tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs1
-rw-r--r--tests/rustdoc-ui/doctest/main-alongside-stmts.rs2
-rw-r--r--tests/rustdoc-ui/doctest/main-alongside-stmts.stderr8
-rw-r--r--tests/rustdoc-ui/doctest/main-alongside-stmts.stdout4
-rw-r--r--tests/rustdoc-ui/doctest/standalone-warning-2024.rs2
-rw-r--r--tests/rustdoc-ui/doctest/standalone-warning-2024.stderr12
-rw-r--r--tests/rustdoc-ui/doctest/test-compile-fail1.rs1
-rw-r--r--tests/rustdoc-ui/doctest/test-compile-fail2.rs1
-rw-r--r--tests/rustdoc-ui/doctest/test-compile-fail3.rs1
-rw-r--r--tests/rustdoc-ui/doctest/test-compile-fail3.stderr5
-rw-r--r--tests/rustdoc-ui/doctest/warn-main-not-called.rs2
-rw-r--r--tests/rustdoc-ui/doctest/warn-main-not-called.stderr4
14 files changed, 51 insertions, 28 deletions
diff --git a/tests/rustdoc-ui/doctest/check-attr-test.rs b/tests/rustdoc-ui/doctest/check-attr-test.rs
index 81281db624b..d69dae63860 100644
--- a/tests/rustdoc-ui/doctest/check-attr-test.rs
+++ b/tests/rustdoc-ui/doctest/check-attr-test.rs
@@ -2,6 +2,9 @@
 
 #![deny(rustdoc::invalid_codeblock_attributes)]
 
+//~vvv ERROR unknown attribute `compile-fail`
+//~| ERROR unknown attribute `compilefail`
+//~| ERROR unknown attribute `comPile_fail`
 /// foo
 ///
 /// ```compile-fail,compilefail,comPile_fail
@@ -9,6 +12,9 @@
 /// ```
 pub fn foo() {}
 
+//~vvv ERROR unknown attribute `should-panic`
+//~| ERROR unknown attribute `shouldpanic`
+//~| ERROR unknown attribute `shOuld_panic`
 /// bar
 ///
 /// ```should-panic,shouldpanic,shOuld_panic
@@ -16,6 +22,9 @@ pub fn foo() {}
 /// ```
 pub fn bar() {}
 
+//~vvv ERROR unknown attribute `no-run`
+//~| ERROR unknown attribute `norun`
+//~| ERROR unknown attribute `nO_run`
 /// foobar
 ///
 /// ```no-run,norun,nO_run
@@ -23,6 +32,9 @@ pub fn bar() {}
 /// ```
 pub fn foobar() {}
 
+//~vvv ERROR unknown attribute `test-harness`
+//~| ERROR unknown attribute `testharness`
+//~| ERROR unknown attribute `tesT_harness`
 /// b
 ///
 /// ```test-harness,testharness,tesT_harness
diff --git a/tests/rustdoc-ui/doctest/check-attr-test.stderr b/tests/rustdoc-ui/doctest/check-attr-test.stderr
index 4cf93033ae8..1fc7ab592de 100644
--- a/tests/rustdoc-ui/doctest/check-attr-test.stderr
+++ b/tests/rustdoc-ui/doctest/check-attr-test.stderr
@@ -1,5 +1,5 @@
 error: unknown attribute `compile-fail`
-  --> $DIR/check-attr-test.rs:5:1
+  --> $DIR/check-attr-test.rs:8:1
    |
 LL | / /// foo
 LL | | ///
@@ -17,7 +17,7 @@ LL | #![deny(rustdoc::invalid_codeblock_attributes)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: unknown attribute `compilefail`
-  --> $DIR/check-attr-test.rs:5:1
+  --> $DIR/check-attr-test.rs:8:1
    |
 LL | / /// foo
 LL | | ///
@@ -30,7 +30,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:8:1
    |
 LL | / /// foo
 LL | | ///
@@ -43,7 +43,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:18:1
    |
 LL | / /// bar
 LL | | ///
@@ -56,7 +56,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:18:1
    |
 LL | / /// bar
 LL | | ///
@@ -69,7 +69,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:18:1
    |
 LL | / /// bar
 LL | | ///
@@ -82,7 +82,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:28:1
    |
 LL | / /// foobar
 LL | | ///
@@ -95,7 +95,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:28:1
    |
 LL | / /// foobar
 LL | | ///
@@ -108,7 +108,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:28:1
    |
 LL | / /// foobar
 LL | | ///
@@ -121,7 +121,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:38:1
    |
 LL | / /// b
 LL | | ///
@@ -134,7 +134,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:38:1
    |
 LL | / /// b
 LL | | ///
@@ -147,7 +147,7 @@ LL | | /// ```
    = 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
+  --> $DIR/check-attr-test.rs:38:1
    |
 LL | / /// b
 LL | | ///
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
index ca5dd787467..05e4a348d11 100644
--- a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs
+++ b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs
@@ -9,6 +9,7 @@
 /// <https://github.com/rust-lang/rust/issues/91014>
 ///
 /// ```rust
+//~^ WARN the `main` function of this doctest won't be run
 /// struct S {};
 ///
 /// fn main() {
diff --git a/tests/rustdoc-ui/doctest/main-alongside-stmts.rs b/tests/rustdoc-ui/doctest/main-alongside-stmts.rs
index 5965f928cdd..595de133932 100644
--- a/tests/rustdoc-ui/doctest/main-alongside-stmts.rs
+++ b/tests/rustdoc-ui/doctest/main-alongside-stmts.rs
@@ -14,6 +14,7 @@
 //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
 //@ check-pass
 
+//~v WARN the `main` function of this doctest won't be run
 //! ```
 //! # if cfg!(miri) { return; }
 //! use std::ops::Deref;
@@ -22,6 +23,7 @@
 //!     assert!(false);
 //! }
 //! ```
+//~v WARN the `main` function of this doctest won't be run
 //!
 //! ```
 //! let x = 2;
diff --git a/tests/rustdoc-ui/doctest/main-alongside-stmts.stderr b/tests/rustdoc-ui/doctest/main-alongside-stmts.stderr
index 3f347d96ab0..b7a5421f8f7 100644
--- a/tests/rustdoc-ui/doctest/main-alongside-stmts.stderr
+++ b/tests/rustdoc-ui/doctest/main-alongside-stmts.stderr
@@ -1,14 +1,14 @@
 warning: the `main` function of this doctest won't be run as it contains expressions at the top level, meaning that the whole doctest code will be wrapped in a function
-  --> $DIR/main-alongside-stmts.rs:17:1
+  --> $DIR/main-alongside-stmts.rs:18:1
    |
 LL | //! ```
    | ^^^^^^^
 
 warning: the `main` function of this doctest won't be run as it contains expressions at the top level, meaning that the whole doctest code will be wrapped in a function
-  --> $DIR/main-alongside-stmts.rs:26:1
+  --> $DIR/main-alongside-stmts.rs:27:1
    |
-LL | //! ```
-   | ^^^^^^^
+LL | //!
+   | ^^^
 
 warning: 2 warnings emitted
 
diff --git a/tests/rustdoc-ui/doctest/main-alongside-stmts.stdout b/tests/rustdoc-ui/doctest/main-alongside-stmts.stdout
index 9b9a3fe8a68..bebaeb49c5a 100644
--- a/tests/rustdoc-ui/doctest/main-alongside-stmts.stdout
+++ b/tests/rustdoc-ui/doctest/main-alongside-stmts.stdout
@@ -1,7 +1,7 @@
 
 running 2 tests
-test $DIR/main-alongside-stmts.rs - (line 17) ... ok
-test $DIR/main-alongside-stmts.rs - (line 26) ... ok
+test $DIR/main-alongside-stmts.rs - (line 18) ... ok
+test $DIR/main-alongside-stmts.rs - (line 27) ... 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/standalone-warning-2024.rs b/tests/rustdoc-ui/doctest/standalone-warning-2024.rs
index c53a8b48749..3bb0083d849 100644
--- a/tests/rustdoc-ui/doctest/standalone-warning-2024.rs
+++ b/tests/rustdoc-ui/doctest/standalone-warning-2024.rs
@@ -9,6 +9,8 @@
 #![deny(warnings)]
 
 //! ```standalone
+//~^ ERROR unknown attribute `standalone`
+//~| ERROR unknown attribute `standalone-crate`
 //! bla
 //! ```
 //!
diff --git a/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr b/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr
index 1af2ded58e8..db0d53a204c 100644
--- a/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr
+++ b/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr
@@ -2,10 +2,10 @@ error: unknown attribute `standalone`
   --> $DIR/standalone-warning-2024.rs:11:1
    |
 LL | / //! ```standalone
+LL | |
+LL | |
 LL | | //! bla
-LL | | //! ```
-LL | | //!
-LL | | //! ```standalone-crate
+...  |
 LL | | //! bla
 LL | | //! ```
    | |_______^
@@ -23,10 +23,10 @@ error: unknown attribute `standalone-crate`
   --> $DIR/standalone-warning-2024.rs:11:1
    |
 LL | / //! ```standalone
+LL | |
+LL | |
 LL | | //! bla
-LL | | //! ```
-LL | | //!
-LL | | //! ```standalone-crate
+...  |
 LL | | //! bla
 LL | | //! ```
    | |_______^
diff --git a/tests/rustdoc-ui/doctest/test-compile-fail1.rs b/tests/rustdoc-ui/doctest/test-compile-fail1.rs
index 278f01f4c83..c692c4c61bc 100644
--- a/tests/rustdoc-ui/doctest/test-compile-fail1.rs
+++ b/tests/rustdoc-ui/doctest/test-compile-fail1.rs
@@ -6,3 +6,4 @@
 pub fn f() {}
 
 pub fn f() {}
+//~^ ERROR the name `f` is defined multiple times
diff --git a/tests/rustdoc-ui/doctest/test-compile-fail2.rs b/tests/rustdoc-ui/doctest/test-compile-fail2.rs
index 7432cc9f826..8239440262d 100644
--- a/tests/rustdoc-ui/doctest/test-compile-fail2.rs
+++ b/tests/rustdoc-ui/doctest/test-compile-fail2.rs
@@ -1,3 +1,4 @@
 //@ compile-flags:--test
 
 fail
+//~^ ERROR
diff --git a/tests/rustdoc-ui/doctest/test-compile-fail3.rs b/tests/rustdoc-ui/doctest/test-compile-fail3.rs
index a2486d9dc6f..272ba95396c 100644
--- a/tests/rustdoc-ui/doctest/test-compile-fail3.rs
+++ b/tests/rustdoc-ui/doctest/test-compile-fail3.rs
@@ -1,3 +1,4 @@
 //@ compile-flags:--test
 
 "fail
+//~^ ERROR
diff --git a/tests/rustdoc-ui/doctest/test-compile-fail3.stderr b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr
index 9f90a428d48..8061097e73a 100644
--- a/tests/rustdoc-ui/doctest/test-compile-fail3.stderr
+++ b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr
@@ -1,8 +1,9 @@
 error[E0765]: unterminated double quote string
   --> $DIR/test-compile-fail3.rs:3:1
    |
-LL | "fail
-   | ^^^^^
+LL | / "fail
+LL | |
+   | |___________^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/rustdoc-ui/doctest/warn-main-not-called.rs b/tests/rustdoc-ui/doctest/warn-main-not-called.rs
index 25d92e9cee9..ec762486d5d 100644
--- a/tests/rustdoc-ui/doctest/warn-main-not-called.rs
+++ b/tests/rustdoc-ui/doctest/warn-main-not-called.rs
@@ -8,6 +8,7 @@
 // won't be called.
 
 //! ```
+//~^ WARN the `main` function of this doctest won't be run
 //! macro_rules! bla {
 //!     ($($x:tt)*) => {}
 //! }
@@ -17,6 +18,7 @@
 //! ```
 //!
 //! ```
+//~^^ WARN the `main` function of this doctest won't be run
 //! let x = 12;
 //! fn main() {}
 //! ```
diff --git a/tests/rustdoc-ui/doctest/warn-main-not-called.stderr b/tests/rustdoc-ui/doctest/warn-main-not-called.stderr
index b5b7bc57644..5feca6f9175 100644
--- a/tests/rustdoc-ui/doctest/warn-main-not-called.stderr
+++ b/tests/rustdoc-ui/doctest/warn-main-not-called.stderr
@@ -7,8 +7,8 @@ LL | //! ```
 warning: the `main` function of this doctest won't be run as it contains expressions at the top level, meaning that the whole doctest code will be wrapped in a function
   --> $DIR/warn-main-not-called.rs:19:1
    |
-LL | //! ```
-   | ^^^^^^^
+LL | //!
+   | ^^^
 
 warning: 2 warnings emitted