summaryrefslogtreecommitdiffstats
path: root/src/test/ui/impl-trait/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/impl-trait/diagnostics')
-rw-r--r--src/test/ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.rs15
-rw-r--r--src/test/ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.stderr9
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.rs b/src/test/ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.rs
new file mode 100644
index 000000000..3a47710d5
--- /dev/null
+++ b/src/test/ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.rs
@@ -0,0 +1,15 @@
+trait Foo<T> {
+ fn foo(self, f: impl FnOnce());
+}
+
+impl<T> Foo<T> for () {
+ fn foo(self, f: impl FnOnce()) {
+ f()
+ }
+}
+
+fn main() {
+ // FIXME: This should ideally use a fully qualified path
+ // without mentioning the generic arguments of `foo`.
+ ().foo(|| ()) //~ ERROR type annotations needed
+}
diff --git a/src/test/ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.stderr b/src/test/ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.stderr
new file mode 100644
index 000000000..a1a629bdd
--- /dev/null
+++ b/src/test/ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+ --> $DIR/fully-qualified-path-impl-trait.rs:14:8
+ |
+LL | ().foo(|| ())
+ | ^^^ cannot infer type for type parameter `T` declared on the trait `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.