about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2022-09-16 11:24:14 +0900
committerTakayuki Maeda <takoyaki0316@gmail.com>2022-09-16 11:24:14 +0900
commit527292a1a697c8831fc1ec01b1047ecebc10f809 (patch)
treebf0afe4c72b4c7fd2684d2818063472f1589c5bc /src
parentb44197abb0b3ffe4908892e1e08ab1cd721ff3b9 (diff)
downloadrust-527292a1a697c8831fc1ec01b1047ecebc10f809.tar.gz
rust-527292a1a697c8831fc1ec01b1047ecebc10f809.zip
do not suggest a placeholder to const and static without a type
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs8
-rw-r--r--src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr20
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs
new file mode 100644
index 00000000000..97e0b213f2e
--- /dev/null
+++ b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs
@@ -0,0 +1,8 @@
+trait Foo {
+    const A; //~ ERROR missing type for `const` item
+    static B;
+    //~^ ERROR associated `static` items are not allowed
+    //~| ERROR missing type for `static` item
+}
+
+fn main() {}
diff --git a/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr
new file mode 100644
index 00000000000..8982d628561
--- /dev/null
+++ b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr
@@ -0,0 +1,20 @@
+error: associated `static` items are not allowed
+  --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:5
+   |
+LL |     static B;
+   |     ^^^^^^^^^
+
+error: missing type for `const` item
+  --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:2:12
+   |
+LL |     const A;
+   |            ^ help: provide a type for the item: `: <type>`
+
+error: missing type for `static` item
+  --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:13
+   |
+LL |     static B;
+   |             ^ help: provide a type for the item: `: <type>`
+
+error: aborting due to 3 previous errors
+