diff --git a/tests/ui/feature-gates/feature-gate-stmt_expr_attributes.rs b/tests/ui/feature-gates/feature-gate-stmt_expr_attributes.rs index f213e8933bf..85c08ec035e 100644 --- a/tests/ui/feature-gates/feature-gate-stmt_expr_attributes.rs +++ b/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() {} diff --git a/tests/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr b/tests/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr index 67fdae030c0..6cca0680722 100644 --- a/tests/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr +++ b/tests/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr @@ -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 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 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`.