about summary refs log tree commit diff
path: root/tests/ui/loop-match
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/loop-match')
-rw-r--r--tests/ui/loop-match/invalid-attribute.rs24
-rw-r--r--tests/ui/loop-match/invalid-attribute.stderr160
2 files changed, 84 insertions, 100 deletions
diff --git a/tests/ui/loop-match/invalid-attribute.rs b/tests/ui/loop-match/invalid-attribute.rs
index d8d2f605eb4..a5d7daac583 100644
--- a/tests/ui/loop-match/invalid-attribute.rs
+++ b/tests/ui/loop-match/invalid-attribute.rs
@@ -3,17 +3,17 @@
 
 #![allow(incomplete_features)]
 #![feature(loop_match)]
-#![loop_match] //~ ERROR should be applied to a loop
-#![const_continue] //~ ERROR should be applied to a break expression
+#![loop_match] //~ ERROR attribute cannot be used on
+#![const_continue] //~ ERROR attribute cannot be used on
 
 extern "C" {
-    #[loop_match] //~ ERROR should be applied to a loop
-    #[const_continue] //~ ERROR should be applied to a break expression
+    #[loop_match] //~ ERROR attribute cannot be used on
+    #[const_continue] //~ ERROR attribute cannot be used on
     fn f();
 }
 
-#[loop_match] //~ ERROR should be applied to a loop
-#[const_continue] //~ ERROR should be applied to a break expression
+#[loop_match] //~ ERROR attribute cannot be used on
+#[const_continue] //~ ERROR attribute cannot be used on
 #[repr(C)]
 struct S {
     a: u32,
@@ -21,18 +21,18 @@ struct S {
 }
 
 trait Invoke {
-    #[loop_match] //~ ERROR should be applied to a loop
-    #[const_continue] //~ ERROR should be applied to a break expression
+    #[loop_match] //~ ERROR attribute cannot be used on
+    #[const_continue] //~ ERROR attribute cannot be used on
     extern "C" fn invoke(&self);
 }
 
-#[loop_match] //~ ERROR should be applied to a loop
-#[const_continue] //~ ERROR should be applied to a break expression
+#[loop_match] //~ ERROR attribute cannot be used on
+#[const_continue] //~ ERROR attribute cannot be used on
 extern "C" fn ok() {}
 
 fn main() {
-    #[loop_match] //~ ERROR should be applied to a loop
-    #[const_continue] //~ ERROR should be applied to a break expression
+    #[loop_match] //~ ERROR attribute cannot be used on
+    #[const_continue] //~ ERROR attribute cannot be used on
     || {};
 
     {
diff --git a/tests/ui/loop-match/invalid-attribute.stderr b/tests/ui/loop-match/invalid-attribute.stderr
index 07015311f9c..ddb68aea31b 100644
--- a/tests/ui/loop-match/invalid-attribute.stderr
+++ b/tests/ui/loop-match/invalid-attribute.stderr
@@ -1,54 +1,98 @@
-error: `#[const_continue]` should be applied to a break expression
-  --> $DIR/invalid-attribute.rs:16:1
+error: `#[loop_match]` attribute cannot be used on crates
+  --> $DIR/invalid-attribute.rs:6:1
    |
-LL | #[const_continue]
-   | ^^^^^^^^^^^^^^^^^
-LL | #[repr(C)]
-LL | struct S {
-   | -------- not a break expression
+LL | #![loop_match]
+   | ^^^^^^^^^^^^^^
+   |
+   = help: `#[loop_match]` can be applied to 
 
-error: `#[loop_match]` should be applied to a loop
+error: `#[const_continue]` attribute cannot be used on crates
+  --> $DIR/invalid-attribute.rs:7:1
+   |
+LL | #![const_continue]
+   | ^^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[const_continue]` can be applied to 
+
+error: `#[loop_match]` attribute cannot be used on foreign functions
+  --> $DIR/invalid-attribute.rs:10:5
+   |
+LL |     #[loop_match]
+   |     ^^^^^^^^^^^^^
+   |
+   = help: `#[loop_match]` can be applied to 
+
+error: `#[const_continue]` attribute cannot be used on foreign functions
+  --> $DIR/invalid-attribute.rs:11:5
+   |
+LL |     #[const_continue]
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[const_continue]` can be applied to 
+
+error: `#[loop_match]` attribute cannot be used on structs
   --> $DIR/invalid-attribute.rs:15:1
    |
 LL | #[loop_match]
    | ^^^^^^^^^^^^^
-...
-LL | struct S {
-   | -------- not a loop
+   |
+   = help: `#[loop_match]` can be applied to 
 
-error: `#[const_continue]` should be applied to a break expression
-  --> $DIR/invalid-attribute.rs:30:1
+error: `#[const_continue]` attribute cannot be used on structs
+  --> $DIR/invalid-attribute.rs:16:1
    |
 LL | #[const_continue]
    | ^^^^^^^^^^^^^^^^^
-LL | extern "C" fn ok() {}
-   | ------------------ not a break expression
+   |
+   = help: `#[const_continue]` can be applied to 
 
-error: `#[loop_match]` should be applied to a loop
+error: `#[loop_match]` attribute cannot be used on required trait methods
+  --> $DIR/invalid-attribute.rs:24:5
+   |
+LL |     #[loop_match]
+   |     ^^^^^^^^^^^^^
+   |
+   = help: `#[loop_match]` can be applied to 
+
+error: `#[const_continue]` attribute cannot be used on required trait methods
+  --> $DIR/invalid-attribute.rs:25:5
+   |
+LL |     #[const_continue]
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[const_continue]` can be applied to 
+
+error: `#[loop_match]` attribute cannot be used on functions
   --> $DIR/invalid-attribute.rs:29:1
    |
 LL | #[loop_match]
    | ^^^^^^^^^^^^^
-LL | #[const_continue]
-LL | extern "C" fn ok() {}
-   | ------------------ not a loop
+   |
+   = help: `#[loop_match]` can be applied to 
 
-error: `#[const_continue]` should be applied to a break expression
-  --> $DIR/invalid-attribute.rs:35:5
+error: `#[const_continue]` attribute cannot be used on functions
+  --> $DIR/invalid-attribute.rs:30:1
    |
-LL |     #[const_continue]
-   |     ^^^^^^^^^^^^^^^^^
-LL |     || {};
-   |     -- not a break expression
+LL | #[const_continue]
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[const_continue]` can be applied to 
 
-error: `#[loop_match]` should be applied to a loop
+error: `#[loop_match]` attribute cannot be used on closures
   --> $DIR/invalid-attribute.rs:34:5
    |
 LL |     #[loop_match]
    |     ^^^^^^^^^^^^^
+   |
+   = help: `#[loop_match]` can be applied to 
+
+error: `#[const_continue]` attribute cannot be used on closures
+  --> $DIR/invalid-attribute.rs:35:5
+   |
 LL |     #[const_continue]
-LL |     || {};
-   |     -- not a loop
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[const_continue]` can be applied to 
 
 error: `#[const_continue]` should be applied to a break expression
   --> $DIR/invalid-attribute.rs:40:9
@@ -67,65 +111,5 @@ LL |         #[const_continue]
 LL |         5
    |         - not a loop
 
-error: `#[const_continue]` should be applied to a break expression
-  --> $DIR/invalid-attribute.rs:25:5
-   |
-LL |     #[const_continue]
-   |     ^^^^^^^^^^^^^^^^^
-LL |     extern "C" fn invoke(&self);
-   |     ---------------------------- not a break expression
-
-error: `#[loop_match]` should be applied to a loop
-  --> $DIR/invalid-attribute.rs:24:5
-   |
-LL |     #[loop_match]
-   |     ^^^^^^^^^^^^^
-LL |     #[const_continue]
-LL |     extern "C" fn invoke(&self);
-   |     ---------------------------- not a loop
-
-error: `#[const_continue]` should be applied to a break expression
-  --> $DIR/invalid-attribute.rs:11:5
-   |
-LL |     #[const_continue]
-   |     ^^^^^^^^^^^^^^^^^
-LL |     fn f();
-   |     ------- not a break expression
-
-error: `#[loop_match]` should be applied to a loop
-  --> $DIR/invalid-attribute.rs:10:5
-   |
-LL |     #[loop_match]
-   |     ^^^^^^^^^^^^^
-LL |     #[const_continue]
-LL |     fn f();
-   |     ------- not a loop
-
-error: `#[const_continue]` should be applied to a break expression
-  --> $DIR/invalid-attribute.rs:7:1
-   |
-LL | / #![allow(incomplete_features)]
-LL | | #![feature(loop_match)]
-LL | | #![loop_match]
-LL | | #![const_continue]
-   | | ^^^^^^^^^^^^^^^^^^
-...  |
-LL | |     };
-LL | | }
-   | |_- not a break expression
-
-error: `#[loop_match]` should be applied to a loop
-  --> $DIR/invalid-attribute.rs:6:1
-   |
-LL | / #![allow(incomplete_features)]
-LL | | #![feature(loop_match)]
-LL | | #![loop_match]
-   | | ^^^^^^^^^^^^^^
-LL | | #![const_continue]
-...  |
-LL | |     };
-LL | | }
-   | |_- not a loop
-
 error: aborting due to 14 previous errors