Skip to content

Commit 3d4bd83

Browse files
Add ui regression test for new rustdoc failed_merged_doctest_compilation lint
1 parent c8fde07 commit 3d4bd83

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Regression test for the `failed_merged_doctest_compilation` lint.
2+
3+
//@ edition: 2024
4+
//@ compile-flags:--test
5+
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
6+
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
7+
//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME"
8+
//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME"
9+
//@ failure-status: 101
10+
11+
#![deny(rustdoc::failed_merged_doctest_compilation)] //~ ERROR
12+
13+
//! ```
14+
//!
15+
//! let x
16+
//! ```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: failed to compile merged doctests for edition 2024. Reverting to standalone doctests.
2+
--> $DIR/failed_merged_doctest_compilation-lint.rs:11:1
3+
|
4+
LL | / #![deny(rustdoc::failed_merged_doctest_compilation)]
5+
LL | |
6+
LL | | //! ```
7+
LL | | //!
8+
LL | | //! let x
9+
LL | | //! ```
10+
| |_______^
11+
|
12+
note: the lint level is defined here
13+
--> $DIR/failed_merged_doctest_compilation-lint.rs:11:9
14+
|
15+
LL | #![deny(rustdoc::failed_merged_doctest_compilation)]
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
running 1 test
3+
test $DIR/failed_merged_doctest_compilation-lint.rs - (line 13) ... FAILED
4+
5+
failures:
6+
7+
---- $DIR/failed_merged_doctest_compilation-lint.rs - (line 13) stdout ----
8+
error: expected `;`, found `}`
9+
--> $DIR/failed_merged_doctest_compilation-lint.rs:14:6
10+
|
11+
LL | let x
12+
| ^ help: add `;` here
13+
LL | } _doctest_main_tests_rustdoc_ui_doctest_failed_merged_doctest_compilation_lint_rs_13_0() }
14+
| - unexpected token
15+
16+
error[E0282]: type annotations needed
17+
--> $DIR/failed_merged_doctest_compilation-lint.rs:14:5
18+
|
19+
LL | let x
20+
| ^
21+
|
22+
help: consider giving `x` an explicit type
23+
|
24+
LL | let x: /* Type */
25+
| ++++++++++++
26+
27+
error: aborting due to 2 previous errors
28+
29+
For more information about this error, try `rustc --explain E0282`.
30+
Couldn't compile the test.
31+
32+
failures:
33+
$DIR/failed_merged_doctest_compilation-lint.rs - (line 13)
34+
35+
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
36+
37+
all doctests ran in $TIME; merged doctests compilation took $TIME

0 commit comments

Comments
 (0)