From de92dfb3b604cfb6316ba7d5a3dea2bd36b6072d Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 28 Apr 2021 18:23:49 +0900 Subject: [PATCH] Add a regression test for #80779 --- src/test/ui/typeck/issue-80779.rs | 13 +++++++++++++ src/test/ui/typeck/issue-80779.stderr | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/test/ui/typeck/issue-80779.rs create mode 100644 src/test/ui/typeck/issue-80779.stderr 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`.