tests: add tests for doc comments on expressions

This commit is contained in:
Xiretza 2024-04-11 16:11:14 +00:00
parent 72fe8a0f00
commit c649c6c2f8
2 changed files with 34 additions and 1 deletions

View File

@ -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() {}

View File

@ -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`.