Skip to content

Commit c649c6c

Browse files
committed
tests: add tests for doc comments on expressions
1 parent 72fe8a0 commit c649c6c

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
const X: i32 = #[allow(dead_code)] 8;
22
//~^ ERROR attributes on expressions are experimental
33

4+
const Y: i32 =
5+
/// foo
6+
//~^ ERROR attributes on expressions are experimental
7+
8;
8+
9+
const Z: i32 = {
10+
//! foo
11+
//~^ ERROR attributes on expressions are experimental
12+
8
13+
};
14+
415
fn main() {}

tests/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr

+23-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ LL | const X: i32 = #[allow(dead_code)] 8;
88
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

11-
error: aborting due to 1 previous error
11+
error[E0658]: attributes on expressions are experimental
12+
--> $DIR/feature-gate-stmt_expr_attributes.rs:5:5
13+
|
14+
LL | /// foo
15+
| ^^^^^^^
16+
|
17+
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
18+
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
19+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
= help: `///` is for documentation comments. For a plain comment, use `//`.
21+
22+
error[E0658]: attributes on expressions are experimental
23+
--> $DIR/feature-gate-stmt_expr_attributes.rs:10:5
24+
|
25+
LL | //! foo
26+
| ^^^^^^^
27+
|
28+
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
29+
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
30+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
31+
= help: `///` is for documentation comments. For a plain comment, use `//`.
32+
33+
error: aborting due to 3 previous errors
1234

1335
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)