mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
If there is a ; alone, we consider that the doctest needs to be put inside a function
This commit is contained in:
@@ -444,8 +444,6 @@ fn check_item(item: &ast::Item, info: &mut ParseSourceInfo, crate_name: &Option<
|
||||
}
|
||||
}
|
||||
}
|
||||
// We do nothing in this case. Not marking it as `non_module_items` either.
|
||||
StmtKind::Empty => {}
|
||||
_ => {
|
||||
has_non_items = true;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
//@ compile-flags:--test
|
||||
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
//@ failure-status: 101
|
||||
//@ check-pass
|
||||
|
||||
/// <https://github.com/rust-lang/rust/issues/91014>
|
||||
///
|
||||
/// ```rust
|
||||
/// struct S {}; // unexpected semicolon after struct def
|
||||
/// struct S {};
|
||||
///
|
||||
/// fn main() {
|
||||
/// assert_eq!(0, 1);
|
||||
|
||||
@@ -1,29 +1,6 @@
|
||||
|
||||
running 1 test
|
||||
test $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) ... FAILED
|
||||
test $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) ... ok
|
||||
|
||||
failures:
|
||||
|
||||
---- $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) stdout ----
|
||||
error: expected item, found `;`
|
||||
--> $DIR/failed-doctest-extra-semicolon-on-item.rs:12:12
|
||||
|
|
||||
LL | struct S {}; // unexpected semicolon after struct def
|
||||
| ^
|
||||
|
|
||||
= help: braced struct declarations are not followed by a semicolon
|
||||
help: remove this semicolon
|
||||
|
|
||||
LL - struct S {}; // unexpected semicolon after struct def
|
||||
LL + struct S {} // unexpected semicolon after struct def
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Couldn't compile the test.
|
||||
|
||||
failures:
|
||||
$DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11)
|
||||
|
||||
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
||||
|
||||
Reference in New Issue
Block a user