about summary refs log tree commit diff
path: root/tests/ui/trait-bounds/mismatch-fn-trait.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/trait-bounds/mismatch-fn-trait.rs')
-rw-r--r--tests/ui/trait-bounds/mismatch-fn-trait.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/trait-bounds/mismatch-fn-trait.rs b/tests/ui/trait-bounds/mismatch-fn-trait.rs
new file mode 100644
index 00000000000..0ed64043a9a
--- /dev/null
+++ b/tests/ui/trait-bounds/mismatch-fn-trait.rs
@@ -0,0 +1,28 @@
+fn take(_f: impl FnMut(i32)) {}
+
+fn test1(f: impl FnMut(u32)) {
+    take(f)
+    //~^ ERROR [E0277]
+}
+
+fn test2(f: impl FnMut(i32, i32)) {
+    take(f)
+    //~^ ERROR [E0277]
+}
+
+fn test3(f: impl FnMut()) {
+    take(f)
+    //~^ ERROR [E0277]
+}
+
+fn test4(f: impl FnOnce(i32)) {
+    take(f)
+    //~^ ERROR [E0277]
+}
+
+fn test5(f: impl FnOnce(u32)) {
+    take(f)
+    //~^ ERROR [E0277]
+}
+
+fn main() {}