about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-02-14 16:54:47 +0100
committerGitHub <noreply@github.com>2021-02-14 16:54:47 +0100
commita6809d00aed27db9ac99841d2bd34060a77d2708 (patch)
treea94621efcee625e1699086d48da838f5060e9ba3 /src/test
parent25315635ef50e57e70cc680a0f70926ec24ed0db (diff)
parent1adc6be23f93c2a348cbf568fb89dc546319e199 (diff)
Rollup merge of #81914 - kper:fixing-81885, r=estebank
Fixing bad suggestion for `_` in `const` type when a function #81885

Closes #81885

```
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> $DIR/typeck_type_placeholder_item_help.rs:13:22
   |
LL | const TEST4: fn() -> _ = 42;
   |                      ^
   |                      |
   |                      not allowed in type signatures
   |                      help: use type parameters instead: `T`
```

Do not show the suggestion `help: use type parameters instead: T` when `fn`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/issues/issue-74086.stderr5
-rw-r--r--src/test/ui/issues/issue-81885.rs10
-rw-r--r--src/test/ui/issues/issue-81885.stderr15
-rw-r--r--src/test/ui/typeck/typeck_type_placeholder_item_help.stderr5
4 files changed, 27 insertions, 8 deletions
diff --git a/src/test/ui/issues/issue-74086.stderr b/src/test/ui/issues/issue-74086.stderr
index 4127f48a093..e602425059e 100644
--- a/src/test/ui/issues/issue-74086.stderr
+++ b/src/test/ui/issues/issue-74086.stderr
@@ -2,10 +2,7 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
   --> $DIR/issue-74086.rs:2:20
    |
 LL |     static BUG: fn(_) -> u8 = |_| 8;
-   |                    ^
-   |                    |
-   |                    not allowed in type signatures
-   |                    help: use type parameters instead: `T`
+   |                    ^ not allowed in type signatures
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-81885.rs b/src/test/ui/issues/issue-81885.rs
new file mode 100644
index 00000000000..86c39d4a48c
--- /dev/null
+++ b/src/test/ui/issues/issue-81885.rs
@@ -0,0 +1,10 @@
+const TEST4: fn() -> _ = 42;
+                  //~^ ERROR the type placeholder `_` is not allowed within types on item
+                  //signatures
+
+fn main() {
+    const TEST5: fn() -> _ = 42;
+                      //~^ ERROR the type placeholder `_` is not allowed within types on item
+                      //signatures
+
+}
diff --git a/src/test/ui/issues/issue-81885.stderr b/src/test/ui/issues/issue-81885.stderr
new file mode 100644
index 00000000000..955b4283874
--- /dev/null
+++ b/src/test/ui/issues/issue-81885.stderr
@@ -0,0 +1,15 @@
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/issue-81885.rs:1:22
+   |
+LL | const TEST4: fn() -> _ = 42;
+   |                      ^ not allowed in type signatures
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/issue-81885.rs:6:26
+   |
+LL |     const TEST5: fn() -> _ = 42;
+   |                          ^ not allowed in type signatures
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0121`.
diff --git a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr
index 0121e186316..f868c8d4834 100644
--- a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr
+++ b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr
@@ -29,10 +29,7 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
   --> $DIR/typeck_type_placeholder_item_help.rs:13:22
    |
 LL | const TEST4: fn() -> _ = 42;
-   |                      ^
-   |                      |
-   |                      not allowed in type signatures
-   |                      help: use type parameters instead: `T`
+   |                      ^ not allowed in type signatures
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
   --> $DIR/typeck_type_placeholder_item_help.rs:17:18