about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-04-28 18:23:49 +0900
committerYuki Okushi <jtitor@2k36.org>2021-04-28 18:23:49 +0900
commitde92dfb3b604cfb6316ba7d5a3dea2bd36b6072d (patch)
treedb8b002f8ed41f5e244ba88dea4a0623ad416cee /src
parenteb753e8ea65deeaf1ed27d3b82e49bbfac6798af (diff)
downloadrust-de92dfb3b604cfb6316ba7d5a3dea2bd36b6072d.tar.gz
rust-de92dfb3b604cfb6316ba7d5a3dea2bd36b6072d.zip
Add a regression test for #80779
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/typeck/issue-80779.rs13
-rw-r--r--src/test/ui/typeck/issue-80779.stderr21
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/typeck/issue-80779.rs b/src/test/ui/typeck/issue-80779.rs
new file mode 100644
index 00000000000..6791976196f
--- /dev/null
+++ b/src/test/ui/typeck/issue-80779.rs
@@ -0,0 +1,13 @@
+// Regression test for #80779.
+
+pub struct T<'a>(&'a str);
+
+pub fn f<'a>(val: T<'a>) -> _ {
+    //~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
+    g(val)
+}
+
+pub fn g(_: T<'static>) -> _ {}
+//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
+
+fn main() {}
diff --git a/src/test/ui/typeck/issue-80779.stderr b/src/test/ui/typeck/issue-80779.stderr
new file mode 100644
index 00000000000..aca494520f8
--- /dev/null
+++ b/src/test/ui/typeck/issue-80779.stderr
@@ -0,0 +1,21 @@
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/issue-80779.rs:10:28
+   |
+LL | pub fn g(_: T<'static>) -> _ {}
+   |                            ^
+   |                            |
+   |                            not allowed in type signatures
+   |                            help: replace with the correct return type: `()`
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/issue-80779.rs:5:29
+   |
+LL | pub fn f<'a>(val: T<'a>) -> _ {
+   |                             ^
+   |                             |
+   |                             not allowed in type signatures
+   |                             help: replace with the correct return type: `()`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0121`.