Skip to content

Commit

Permalink
tests: add tests for doc comments on expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiretza committed Apr 24, 2024
1 parent 7bb4f08 commit 5ad7c39
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tests/ui/feature-gates/feature-gate-stmt_expr_attributes.rs
@@ -1,4 +1,15 @@
const X: i32 = #[allow(dead_code)] 8;
//~^ ERROR attributes on expressions are experimental

const Y: i32 =
/// foo
//~^ ERROR attributes on expressions are experimental
8;

const Z: i32 = {
//! foo
//~^ ERROR attributes on expressions are experimental
8
};

fn main() {}
24 changes: 23 additions & 1 deletion tests/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr
Expand Up @@ -8,6 +8,28 @@ LL | const X: i32 = #[allow(dead_code)] 8;
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 1 previous error
error[E0658]: attributes on expressions are experimental
--> $DIR/feature-gate-stmt_expr_attributes.rs:5:5
|
LL | /// foo
| ^^^^^^^
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= help: `///` is for documentation comments. For a plain comment, use `//`.

error[E0658]: attributes on expressions are experimental
--> $DIR/feature-gate-stmt_expr_attributes.rs:10:5
|
LL | //! foo
| ^^^^^^^
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= help: `///` is for documentation comments. For a plain comment, use `//`.

error: aborting due to 3 previous errors

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

0 comments on commit 5ad7c39

Please sign in to comment.