about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorRémy Rakic <remy.rakic+github@gmail.com>2024-06-06 20:39:54 +0000
committerRémy Rakic <remy.rakic+github@gmail.com>2024-06-06 20:39:54 +0000
commit216424da32db1bf0d224b97ff3d0424622c97c4c (patch)
tree15e79fd69aacc97b61979ad5a7bc8d320d123de2 /tests/ui
parente1ac0fa95ba15221ee195647cb12464df3164513 (diff)
Revert "Rollup merge of #124099 - voidc:disallow-ambiguous-expr-attrs, r=davidtwco"
This reverts commit 57dad1d75e562ff73051c1c43b07eaf65c7dbd74, reversing
changes made to 36316df9fe6c3e246153fe6e78967643cf08c148.
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/lint/unused/unused-doc-comments-edge-cases.rs4
-rw-r--r--tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr14
-rw-r--r--tests/ui/parser/attribute/attr-binary-expr-ambigous.fixed15
-rw-r--r--tests/ui/parser/attribute/attr-binary-expr-ambigous.rs15
-rw-r--r--tests/ui/parser/attribute/attr-binary-expr-ambigous.stderr46
-rw-r--r--tests/ui/proc-macro/issue-81555.rs3
6 files changed, 11 insertions, 86 deletions
diff --git a/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs b/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
index 0f9eac93930..ba32fb566e8 100644
--- a/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
+++ b/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
@@ -20,10 +20,10 @@ fn doc_comment_between_if_else(num: u8) -> bool {
 }
 
 fn doc_comment_on_expr(num: u8) -> bool {
-    (/// useless doc comment
+    /// useless doc comment
     //~^ ERROR: attributes on expressions are experimental
     //~| ERROR: unused doc comment
-    num) == 3
+    num == 3
 }
 
 fn doc_comment_on_expr_field() -> bool {
diff --git a/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr b/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
index 1ff5c8d8825..c0741174554 100644
--- a/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
+++ b/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
@@ -5,10 +5,10 @@ LL |     else {
    |     ^^^^ expected expression
 
 error[E0658]: attributes on expressions are experimental
-  --> $DIR/unused-doc-comments-edge-cases.rs:23:6
+  --> $DIR/unused-doc-comments-edge-cases.rs:23:5
    |
-LL |     (/// useless doc comment
-   |      ^^^^^^^^^^^^^^^^^^^^^^^
+LL |     /// useless doc comment
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = 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
@@ -32,12 +32,12 @@ LL | #![deny(unused_doc_comments)]
    |         ^^^^^^^^^^^^^^^^^^^
 
 error: unused doc comment
-  --> $DIR/unused-doc-comments-edge-cases.rs:23:6
+  --> $DIR/unused-doc-comments-edge-cases.rs:23:5
    |
-LL |     (/// useless doc comment
-   |      ^^^^^^^^^^^^^^^^^^^^^^^
+LL |     /// useless doc comment
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
 ...
-LL |     num) == 3
+LL |     num == 3
    |     --- rustdoc does not generate documentation for expressions
    |
    = help: use `//` for a plain comment
diff --git a/tests/ui/parser/attribute/attr-binary-expr-ambigous.fixed b/tests/ui/parser/attribute/attr-binary-expr-ambigous.fixed
deleted file mode 100644
index aae71ede771..00000000000
--- a/tests/ui/parser/attribute/attr-binary-expr-ambigous.fixed
+++ /dev/null
@@ -1,15 +0,0 @@
-//@ run-rustfix
-#![feature(stmt_expr_attributes)]
-#![allow(unused_assignments, unused_attributes)]
-
-fn main() {
-    let mut x = (#[deprecated] 1) + 2; //~ ERROR ambiguous
-
-    (#[deprecated] x) = 4; //~ ERROR ambiguous
-
-    x = (#[deprecated] 5) as i32; //~ ERROR ambiguous
-
-    let _r = (#[deprecated] 1)..6; //~ ERROR ambiguous
-
-    println!("{}", x);
-}
diff --git a/tests/ui/parser/attribute/attr-binary-expr-ambigous.rs b/tests/ui/parser/attribute/attr-binary-expr-ambigous.rs
deleted file mode 100644
index 613e01d743b..00000000000
--- a/tests/ui/parser/attribute/attr-binary-expr-ambigous.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//@ run-rustfix
-#![feature(stmt_expr_attributes)]
-#![allow(unused_assignments, unused_attributes)]
-
-fn main() {
-    let mut x = #[deprecated] 1 + 2; //~ ERROR ambiguous
-
-    #[deprecated] x = 4; //~ ERROR ambiguous
-
-    x = #[deprecated] 5 as i32; //~ ERROR ambiguous
-
-    let _r = #[deprecated] 1..6; //~ ERROR ambiguous
-
-    println!("{}", x);
-}
diff --git a/tests/ui/parser/attribute/attr-binary-expr-ambigous.stderr b/tests/ui/parser/attribute/attr-binary-expr-ambigous.stderr
deleted file mode 100644
index 0430570fd49..00000000000
--- a/tests/ui/parser/attribute/attr-binary-expr-ambigous.stderr
+++ /dev/null
@@ -1,46 +0,0 @@
-error: ambiguous outer attributes
-  --> $DIR/attr-binary-expr-ambigous.rs:6:17
-   |
-LL |     let mut x = #[deprecated] 1 + 2;
-   |                 ^^^^^^^^^^^^^^^^^^^
-   |
-help: wrap the expression in parentheses
-   |
-LL |     let mut x = (#[deprecated] 1) + 2;
-   |                 +               +
-
-error: ambiguous outer attributes
-  --> $DIR/attr-binary-expr-ambigous.rs:8:5
-   |
-LL |     #[deprecated] x = 4;
-   |     ^^^^^^^^^^^^^^^^^^^
-   |
-help: wrap the expression in parentheses
-   |
-LL |     (#[deprecated] x) = 4;
-   |     +               +
-
-error: ambiguous outer attributes
-  --> $DIR/attr-binary-expr-ambigous.rs:10:9
-   |
-LL |     x = #[deprecated] 5 as i32;
-   |         ^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: wrap the expression in parentheses
-   |
-LL |     x = (#[deprecated] 5) as i32;
-   |         +               +
-
-error: ambiguous outer attributes
-  --> $DIR/attr-binary-expr-ambigous.rs:12:14
-   |
-LL |     let _r = #[deprecated] 1..6;
-   |              ^^^^^^^^^^^^^^^^^^
-   |
-help: wrap the expression in parentheses
-   |
-LL |     let _r = (#[deprecated] 1)..6;
-   |              +               +
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/proc-macro/issue-81555.rs b/tests/ui/proc-macro/issue-81555.rs
index b337ab7ce37..7a61a31952f 100644
--- a/tests/ui/proc-macro/issue-81555.rs
+++ b/tests/ui/proc-macro/issue-81555.rs
@@ -10,5 +10,6 @@ use test_macros::identity_attr;
 fn main() {
     let _x;
     let y = ();
-    (#[identity_attr] _x) = y;
+    #[identity_attr]
+    _x = y;
 }